From b7f2af7d6a8f4f0598e7870b31fb02183fd200b6 Mon Sep 17 00:00:00 2001 From: xboard Date: Mon, 13 Jan 2025 20:29:09 +0800 Subject: [PATCH] fix: resolve various issues and add new features --- .../V1/Client/ClientController.php | 61 +++- .../Controllers/V2/Admin/StatController.php | 136 +++++++- app/Http/Routes/V2/AdminRoute.php | 8 +- composer.json | 1 + public/assets/admin/assets/index.css | 2 +- public/assets/admin/assets/index.js | 8 +- public/assets/admin/assets/vendor.js | 34 +- resources/lang/en-US.json | 20 +- resources/lang/zh-CN.json | 20 +- resources/lang/zh-TW.json | 20 +- resources/views/client/subscribe.blade.php | 296 ++++++++++++++++++ 11 files changed, 563 insertions(+), 43 deletions(-) create mode 100644 resources/views/client/subscribe.blade.php diff --git a/app/Http/Controllers/V1/Client/ClientController.php b/app/Http/Controllers/V1/Client/ClientController.php index 832f9d6..2f840e0 100644 --- a/app/Http/Controllers/V1/Client/ClientController.php +++ b/app/Http/Controllers/V1/Client/ClientController.php @@ -47,6 +47,60 @@ class ClientController extends Controller private const ALLOWED_TYPES = ['vmess', 'vless', 'trojan', 'hysteria', 'shadowsocks', 'hysteria2']; + /** + * 处理浏览器访问订阅的情况 + */ + private function handleBrowserSubscribe($user, UserService $userService) + { + $useTraffic = $user['u'] + $user['d']; + $totalTraffic = $user['transfer_enable']; + $remainingTraffic = Helper::trafficConvert($totalTraffic - $useTraffic); + $expiredDate = $user['expired_at'] ? date('Y-m-d', $user['expired_at']) : __('Unlimited'); + $resetDay = $userService->getResetDay($user); + + // 获取通用订阅地址 + $subscriptionUrl = Helper::getSubscribeUrl($user->token); + + // 生成二维码 + $writer = new \BaconQrCode\Writer( + new \BaconQrCode\Renderer\ImageRenderer( + new \BaconQrCode\Renderer\RendererStyle\RendererStyle(200), + new \BaconQrCode\Renderer\Image\SvgImageBackEnd() + ) + ); + $qrCode = base64_encode($writer->writeString($subscriptionUrl)); + + $data = [ + 'username' => $user->email, + 'status' => $userService->isAvailable($user) ? 'active' : 'inactive', + 'data_limit' => $totalTraffic ? Helper::trafficConvert($totalTraffic) : '∞', + 'data_used' => Helper::trafficConvert($useTraffic), + 'expired_date' => $expiredDate, + 'reset_day' => $resetDay, + 'subscription_url' => $subscriptionUrl, + 'qr_code' => $qrCode + ]; + + // 只有当 device_limit 不为 null 时才添加到返回数据中 + if ($user->device_limit !== null) { + $data['device_limit'] = $user->device_limit; + } + + return response()->view('client.subscribe', $data); + } + + /** + * 检查是否是浏览器访问 + */ + private function isBrowserAccess(Request $request): bool + { + $userAgent = strtolower($request->header('User-Agent')); + return str_contains($userAgent, 'mozilla') + || str_contains($userAgent, 'chrome') + || str_contains($userAgent, 'safari') + || str_contains($userAgent, 'edge'); + } + public function subscribe(Request $request) { $request->validate([ @@ -62,6 +116,11 @@ class ClientController extends Controller return response()->json(['message' => 'Account unavailable'], 403); } + // 检测是否是浏览器访问 + if ($this->isBrowserAccess($request)) { + return $this->handleBrowserSubscribe($user, $userService); + } + $types = $this->getFilteredTypes($request->input('types', 'all')); $filterArr = $this->getFilterArray($request->input('filter')); $clientInfo = $this->getClientInfo($request); @@ -178,7 +237,7 @@ class ClientController extends Controller $useTraffic = $user['u'] + $user['d']; $totalTraffic = $user['transfer_enable']; $remainingTraffic = Helper::trafficConvert($totalTraffic - $useTraffic); - $expiredDate = $user['expired_at'] ? date('Y-m-d', $user['expired_at']) : '长期有效'; + $expiredDate = $user['expired_at'] ? date('Y-m-d', $user['expired_at']) : __('长期有效'); $userService = new UserService(); $resetDay = $userService->getResetDay($user); array_unshift($servers, array_merge($servers[0], [ diff --git a/app/Http/Controllers/V2/Admin/StatController.php b/app/Http/Controllers/V2/Admin/StatController.php index 0b689bf..5eac168 100644 --- a/app/Http/Controllers/V2/Admin/StatController.php +++ b/app/Http/Controllers/V2/Admin/StatController.php @@ -23,6 +23,35 @@ class StatController extends Controller } public function getOverride(Request $request) { + // 获取在线节点数 + $onlineNodes = Server::all()->filter(function ($server) { + $server->loadServerStatus(); + return $server->is_online; + })->count(); + // 获取在线设备数和在线用户数 + $onlineDevices = User::where('t', '>=', time() - 600) + ->sum('online_count'); + $onlineUsers = User::where('t', '>=', time() - 600) + ->count(); + + // 获取今日流量统计 + $todayStart = strtotime('today'); + $todayTraffic = StatServer::where('record_at', '>=', $todayStart) + ->where('record_at', '<', time()) + ->selectRaw('SUM(u) as upload, SUM(d) as download, SUM(u + d) as total') + ->first(); + + // 获取本月流量统计 + $monthStart = strtotime(date('Y-m-1')); + $monthTraffic = StatServer::where('record_at', '>=', $monthStart) + ->where('record_at', '<', time()) + ->selectRaw('SUM(u) as upload, SUM(d) as download, SUM(u + d) as total') + ->first(); + + // 获取总流量统计 + $totalTraffic = StatServer::selectRaw('SUM(u) as upload, SUM(d) as download, SUM(u + d) as total') + ->first(); + return [ 'data' => [ 'month_income' => Order::where('created_at', '>=', strtotime(date('Y-m-1'))) @@ -53,6 +82,25 @@ class StatController extends Controller 'commission_last_month_payout' => CommissionLog::where('created_at', '>=', strtotime('-1 month', strtotime(date('Y-m-1')))) ->where('created_at', '<', strtotime(date('Y-m-1'))) ->sum('get_amount'), + // 新增统计数据 + 'online_nodes' => $onlineNodes, + 'online_devices' => $onlineDevices, + 'online_users' => $onlineUsers, + 'today_traffic' => [ + 'upload' => $todayTraffic->upload ?? 0, + 'download' => $todayTraffic->download ?? 0, + 'total' => $todayTraffic->total ?? 0 + ], + 'month_traffic' => [ + 'upload' => $monthTraffic->upload ?? 0, + 'download' => $monthTraffic->download ?? 0, + 'total' => $monthTraffic->total ?? 0 + ], + 'total_traffic' => [ + 'upload' => $totalTraffic->upload ?? 0, + 'download' => $totalTraffic->download ?? 0, + 'total' => $totalTraffic->total ?? 0 + ] ] ]; } @@ -213,11 +261,39 @@ class StatController extends Controller $currentMonthStart = strtotime(date('Y-m-01')); $lastMonthStart = strtotime('-1 month', $currentMonthStart); $twoMonthsAgoStart = strtotime('-2 month', $currentMonthStart); - + // Today's start timestamp $todayStart = strtotime('today'); $yesterdayStart = strtotime('-1 day', $todayStart); + // 获取在线节点数 + $onlineNodes = Server::all()->filter(function ($server) { + $server->loadServerStatus(); + return $server->is_online; + })->count(); + + // 获取在线设备数和在线用户数 + $onlineDevices = User::where('t', '>=', time() - 600) + ->sum('online_count'); + $onlineUsers = User::where('t', '>=', time() - 600) + ->count(); + + // 获取今日流量统计 + $todayTraffic = StatServer::where('record_at', '>=', $todayStart) + ->where('record_at', '<', time()) + ->selectRaw('SUM(u) as upload, SUM(d) as download, SUM(u + d) as total') + ->first(); + + // 获取本月流量统计 + $monthTraffic = StatServer::where('record_at', '>=', $currentMonthStart) + ->where('record_at', '<', time()) + ->selectRaw('SUM(u) as upload, SUM(d) as download, SUM(u + d) as total') + ->first(); + + // 获取总流量统计 + $totalTraffic = StatServer::selectRaw('SUM(u) as upload, SUM(d) as download, SUM(u + d) as total') + ->first(); + // Today's income $todayIncome = Order::where('created_at', '>=', $todayStart) ->where('created_at', '<', time()) @@ -230,10 +306,6 @@ class StatController extends Controller ->whereNotIn('status', [0, 2]) ->sum('total_amount'); - // Online users (active in last 10 minutes) - $onlineUsers = User::where('t', '>=', time() - 600) - ->count(); - // Current month income $currentMonthIncome = Order::where('created_at', '>=', $currentMonthStart) ->where('created_at', '<', time()) @@ -251,6 +323,11 @@ class StatController extends Controller ->where('created_at', '<', $currentMonthStart) ->sum('get_amount'); + // Current month commission payout + $currentMonthCommissionPayout = CommissionLog::where('created_at', '>=', $currentMonthStart) + ->where('created_at', '<', time()) + ->sum('get_amount'); + // Current month new users $currentMonthNewUsers = User::where('created_at', '>=', $currentMonthStart) ->where('created_at', '<', time()) @@ -288,21 +365,60 @@ class StatController extends Controller $userGrowth = $lastMonthNewUsers > 0 ? round(($currentMonthNewUsers - $lastMonthNewUsers) / $lastMonthNewUsers * 100, 1) : 0; $dayIncomeGrowth = $yesterdayIncome > 0 ? round(($todayIncome - $yesterdayIncome) / $yesterdayIncome * 100, 1) : 0; + // 获取待处理工单和佣金数据 + $ticketPendingTotal = Ticket::where('status', 0)->count(); + $commissionPendingTotal = Order::where('commission_status', 0) + ->where('invite_user_id', '!=', NULL) + ->whereIn('status', [Order::STATUS_COMPLETED]) + ->where('commission_balance', '>', 0) + ->count(); + return [ 'data' => [ + // 收入相关 'todayIncome' => $todayIncome, - 'onlineUsers' => $onlineUsers, 'dayIncomeGrowth' => $dayIncomeGrowth, 'currentMonthIncome' => $currentMonthIncome, 'lastMonthIncome' => $lastMonthIncome, + 'monthIncomeGrowth' => $monthIncomeGrowth, + 'lastMonthIncomeGrowth' => $lastMonthIncomeGrowth, + + // 佣金相关 + 'currentMonthCommissionPayout' => $currentMonthCommissionPayout, 'lastMonthCommissionPayout' => $lastMonthCommissionPayout, + 'commissionGrowth' => $commissionGrowth, + 'commissionPendingTotal' => $commissionPendingTotal, + + // 用户相关 'currentMonthNewUsers' => $currentMonthNewUsers, 'totalUsers' => $totalUsers, 'activeUsers' => $activeUsers, - 'monthIncomeGrowth' => $monthIncomeGrowth, - 'lastMonthIncomeGrowth' => $lastMonthIncomeGrowth, - 'commissionGrowth' => $commissionGrowth, - 'userGrowth' => $userGrowth + 'userGrowth' => $userGrowth, + 'onlineUsers' => $onlineUsers, + 'onlineDevices' => $onlineDevices, + + // 工单相关 + 'ticketPendingTotal' => $ticketPendingTotal, + + // 节点相关 + 'onlineNodes' => $onlineNodes, + + // 流量统计 + 'todayTraffic' => [ + 'upload' => $todayTraffic->upload ?? 0, + 'download' => $todayTraffic->download ?? 0, + 'total' => $todayTraffic->total ?? 0 + ], + 'monthTraffic' => [ + 'upload' => $monthTraffic->upload ?? 0, + 'download' => $monthTraffic->download ?? 0, + 'total' => $monthTraffic->total ?? 0 + ], + 'totalTraffic' => [ + 'upload' => $totalTraffic->upload ?? 0, + 'download' => $totalTraffic->download ?? 0, + 'total' => $totalTraffic->total ?? 0 + ] ] ]; } diff --git a/app/Http/Routes/V2/AdminRoute.php b/app/Http/Routes/V2/AdminRoute.php index 391510b..0eb522b 100644 --- a/app/Http/Routes/V2/AdminRoute.php +++ b/app/Http/Routes/V2/AdminRoute.php @@ -6,11 +6,6 @@ use App\Http\Controllers\V2\Admin\PlanController; use App\Http\Controllers\V2\Admin\Server\GroupController; use App\Http\Controllers\V2\Admin\Server\RouteController; use App\Http\Controllers\V2\Admin\Server\ManageController; -use App\Http\Controllers\V2\Admin\Server\TrojanController; -use App\Http\Controllers\V2\Admin\Server\VmessController; -use App\Http\Controllers\V2\Admin\Server\ShadowsocksController; -use App\Http\Controllers\V2\Admin\Server\HysteriaController; -use App\Http\Controllers\V2\Admin\Server\VlessController; use App\Http\Controllers\V2\Admin\OrderController; use App\Http\Controllers\V2\Admin\UserController; use App\Http\Controllers\V2\Admin\StatController; @@ -118,15 +113,14 @@ class AdminRoute $router->group([ 'prefix' => 'stat' ], function ($router) { - $router->get('/getStat', [StatController::class, 'getStat']); $router->get('/getOverride', [StatController::class, 'getOverride']); + $router->get('/getStats', [StatController::class, 'getStats']); $router->get('/getServerLastRank', [StatController::class, 'getServerLastRank']); $router->get('/getServerYesterdayRank', [StatController::class, 'getServerYesterdayRank']); $router->get('/getOrder', [StatController::class, 'getOrder']); $router->any('/getStatUser', [StatController::class, 'getStatUser']); $router->get('/getRanking', [StatController::class, 'getRanking']); $router->get('/getStatRecord', [StatController::class, 'getStatRecord']); - $router->get('/getStats', [StatController::class, 'getStats']); $router->get('/getTrafficRank', [StatController::class, 'getTrafficRank']); }); diff --git a/composer.json b/composer.json index 44544ef..e6dd07a 100755 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "license": "MIT", "require": { "php": "^8.2", + "bacon/bacon-qr-code": "^2.0", "doctrine/dbal": "^3.7", "google/cloud-storage": "^1.35", "google/recaptcha": "^1.2", diff --git a/public/assets/admin/assets/index.css b/public/assets/admin/assets/index.css index 80dc6bf..5a91775 100644 --- a/public/assets/admin/assets/index.css +++ b/public/assets/admin/assets/index.css @@ -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-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%}.collapsibleDropdown{overflow:hidden}.collapsibleDropdown[data-state=open]{animation:slideDown .2s ease-out}.collapsibleDropdown[data-state=closed]{animation:slideUp .2s ease-out}@keyframes slideDown{0%{height:0}to{height:var(--radix-collapsible-content-height)}}@keyframes slideUp{0%{height:var(--radix-collapsible-content-height)}to{height:0}}*{border-color:hsl(var(--border))}body{min-height:100svh;width:100%;background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-left-1{left:-.25rem}.-right-1{right:-.25rem}.-right-5{right:-1.25rem}.-top-1\/2{top:-50%}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-4{left:1rem}.left-5{left:1.25rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-5{right:1.25rem}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[-1\]{z-index:-1}.z-\[1\]{z-index:1}.col-span-2{grid-column:span 2 / span 2}.-m-0\.5{margin:-.125rem}.m-1{margin:.25rem}.m-auto{margin:auto}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.-ml-3{margin-left:-.75rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-8{margin-left:2rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\!table{display:table!important}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-\[16\/9\]{aspect-ratio:16/9}.aspect-square{aspect-ratio:1 / 1}.size-10{width:2.5rem;height:2.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[180px\]{height:180px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[90vh\]{height:90vh}.h-\[calc\(100\%-var\(--header-height\)\)\]{height:calc(100% - var(--header-height))}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-12{max-height:3rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95\%\]{max-height:95%}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-\[120px\]{min-height:120px}.min-h-\[200px\]{min-height:200px}.min-h-\[60px\]{min-height:60px}.w-0{width:0px}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[250px\]{width:250px}.w-\[300px\]{width:300px}.w-\[400px\]{width:400px}.w-\[50px\]{width:50px}.w-\[70px\]{width:70px}.w-\[80px\]{width:80px}.w-auto{width:auto}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.min-w-0{min-width:0px}.min-w-20{min-width:5rem}.min-w-\[10em\]{min-width:10em}.min-w-\[300px\]{min-width:300px}.min-w-\[40px\]{min-width:40px}.min-w-\[4rem\]{min-width:4rem}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-32{max-width:8rem}.max-w-4xl{max-width:56rem}.max-w-52{max-width:13rem}.max-w-80{max-width:20rem}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[500px\]{max-width:500px}.max-w-\[60\%\]{max-width:60%}.max-w-\[600px\]{max-width:600px}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-none{max-width:none}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-\[1\.2\]{flex:1.2}.flex-\[1\]{flex:1}.flex-\[2\]{flex:2}.flex-\[4\]{flex:4}.flex-\[5\]{flex:5}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-125{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-help{cursor:help}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[100px_1fr\]{grid-template-columns:100px 1fr}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-2{row-gap:.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-wrap{text-wrap:wrap}.text-nowrap{text-wrap:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-lg{border-top-left-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-lg{border-top-right-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-bl-none{border-bottom-left-radius:0}.rounded-br-none{border-bottom-right-radius:0}.rounded-tl-lg{border-top-left-radius:var(--radius)}.rounded-tl-none{border-top-left-radius:0}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-lg{border-top-right-radius:var(--radius)}.rounded-tr-none{border-top-right-radius:0}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-x-0{border-left-width:0px;border-right-width:0px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-0{border-left-width:0px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-r-0{border-right-width:0px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.border-blue-500\/50{border-color:#3b82f680}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-foreground\/10{border-color:hsl(var(--foreground) / .1)}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/25{border-color:hsl(var(--muted-foreground) / .25)}.border-orange-500\/50{border-color:#f9731680}.border-primary{border-color:hsl(var(--primary))}.border-primary\/40{border-color:hsl(var(--primary) / .4)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-l-slate-500{--tw-border-opacity: 1;border-left-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-r-muted{border-right-color:hsl(var(--muted))}.border-t-transparent{border-top-color:transparent}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/80{background-color:#000c}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-destructive\/15{background-color:hsl(var(--destructive) / .15)}.bg-destructive\/80{background-color:hsl(var(--destructive) / .8)}.bg-emerald-500\/80{background-color:#10b981cc}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-inherit{background-color:inherit}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground{background-color:hsl(var(--primary-foreground))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/50{background-color:hsl(var(--secondary) / .5)}.bg-slate-100\/80{background-color:#f1f5f9cc}.bg-transparent{background-color:transparent}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/80{background-color:#eab308cc}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-background\/95{--tw-gradient-from: hsl(var(--background) / .95) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background\/80{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .8) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-background\/60{--tw-gradient-to: hsl(var(--background) / .6) var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-primary{fill:hsl(var(--primary))}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-0\.5{padding-bottom:.125rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-3{padding-left:.75rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-7{padding-right:1.75rem}.pr-8{padding-right:2rem}.pr-9{padding-right:2.25rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-16{padding-top:4rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.625rem\]{font-size:.625rem}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[7rem\]{font-size:7rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-10{line-height:2.5rem}.leading-none{line-height:1}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/70{color:hsl(var(--foreground) / .7)}.text-foreground\/90{color:hsl(var(--foreground) / .9)}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/30{color:hsl(var(--muted-foreground) / .3)}.text-muted-foreground\/40{color:hsl(var(--muted-foreground) / .4)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/70{color:hsl(var(--muted-foreground) / .7)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/90{color:hsl(var(--primary) / .9)}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-destructive\/50{--tw-shadow-color: hsl(var(--destructive) / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/50{--tw-shadow-color: rgb(16 185 129 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-yellow-500\/50{--tw-shadow-color: rgb(234 179 8 / .5);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-gray-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(229 231 235 / var(--tw-ring-opacity, 1))}.ring-gray-300\/20{--tw-ring-color: rgb(209 213 219 / .2)}.ring-green-500\/20{--tw-ring-color: rgb(34 197 94 / .2)}.ring-primary\/20{--tw-ring-color: hsl(var(--primary) / .2)}.ring-offset-2{--tw-ring-offset-width: 2px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.ring-offset-white{--tw-ring-offset-color: #fff}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[1px\]{--tw-backdrop-blur: blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[max-height\,padding\]{transition-property:max-height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[opacity\]{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-100{transition-delay:.1s}.delay-150{transition-delay:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-150{animation-duration:.15s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-700{animation-duration:.7s}.delay-100{animation-delay:.1s}.delay-150{animation-delay:.15s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}html{overflow-y:scroll}.sticky{position:sticky!important;z-index:2;background-color:hsl(var(--card))}.sticky.before\:right-0:before,.sticky.before\:left-0:before{content:"";position:absolute;top:0;bottom:0;width:2px;background:linear-gradient(to right,rgba(0,0,0,.08),transparent);opacity:1;transition:opacity .3s ease}.sticky.before\:right-0:before{right:-1px;background:linear-gradient(to right,rgba(0,0,0,.08),transparent)}.sticky.before\:right-0:after{content:"";position:absolute;top:0;right:-8px;bottom:0;width:8px;pointer-events:none;background:linear-gradient(to right,rgba(0,0,0,.05),transparent)}.sticky.before\:left-0:before{left:-1px;background:linear-gradient(to left,rgba(0,0,0,.08),transparent)}.sticky.before\:left-0:after{content:"";position:absolute;top:0;left:-8px;bottom:0;width:8px;pointer-events:none;background:linear-gradient(to left,rgba(0,0,0,.05),transparent)}.sticky:hover:before{opacity:.8}.dark .sticky.before\:right-0:before,.dark .sticky.before\:left-0:before{background:linear-gradient(to right,rgba(255,255,255,.05),transparent)}.dark .sticky.before\:right-0:after,.dark .sticky.before\:left-0:after{background:linear-gradient(to right,rgba(255,255,255,.03),transparent)}.\*\:\!inline-block>*{display:inline-block!important}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:bottom-0:before{content:var(--tw-content);bottom:0}.before\:left-0:before{content:var(--tw-content);left:0}.before\:right-0:before{content:var(--tw-content);right:0}.before\:top-0:before{content:var(--tw-content);top:0}.before\:w-\[1px\]:before{content:var(--tw-content);width:1px}.before\:bg-border:before{content:var(--tw-content);background-color:hsl(var(--border))}.after\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:bottom-0:after{content:var(--tw-content);bottom:0}.after\:left-0:after{content:var(--tw-content);left:0}.after\:hidden:after{content:var(--tw-content);display:none}.after\:h-32:after{content:var(--tw-content);height:8rem}.after\:w-full:after{content:var(--tw-content);width:100%}.after\:bg-\[linear-gradient\(180deg\,_transparent_10\%\,_hsl\(var\(--background\)\)_70\%\)\]:after{content:var(--tw-content);background-image:linear-gradient(180deg,transparent 10%,hsl(var(--background)) 70%)}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.focus-within\:ring-1:focus-within{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-within\:ring-ring:focus-within{--tw-ring-color: hsl(var(--ring))}.hover\:-translate-y-1:hover{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-180:hover{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-background:hover{background-color:hsl(var(--background))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-card\/80:hover{background-color:hsl(var(--card) / .8)}.hover\:bg-destructive\/10:hover{background-color:hsl(var(--destructive) / .1)}.hover\:bg-destructive\/25:hover{background-color:hsl(var(--destructive) / .25)}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-100:hover{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.hover\:bg-inherit:hover{background-color:inherit}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/40:hover{background-color:hsl(var(--muted) / .4)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-muted\/60:hover{background-color:hsl(var(--muted) / .6)}.hover\:bg-muted\/70:hover{background-color:hsl(var(--muted) / .7)}.hover\:bg-primary:hover{background-color:hsl(var(--primary))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary-foreground\/10:hover{background-color:hsl(var(--secondary-foreground) / .1)}.hover\:bg-secondary\/70:hover{background-color:hsl(var(--secondary) / .7)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-200\/80:hover{background-color:#e2e8f0cc}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-yellow-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-80:hover{--tw-bg-opacity: .8}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-foreground\/70:hover{color:hsl(var(--foreground) / .7)}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-black\/30:hover{--tw-shadow-color: rgb(0 0 0 / .3);--tw-shadow: var(--tw-shadow-colored)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:z-10:focus{z-index:10}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-primary:focus{background-color:hsl(var(--primary))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-destructive:focus{color:hsl(var(--destructive))}.focus\:text-primary-foreground:focus{color:hsl(var(--primary-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-primary:focus-visible{--tw-ring-color: hsl(var(--primary))}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-90:active{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:via-background\/90{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .9) var(--tw-gradient-via-position), var(--tw-gradient-to)}.group:hover .group-hover\:to-background\/70{--tw-gradient-to: hsl(var(--background) / .7) var(--tw-gradient-to-position)}.group\/id:hover .group-hover\/id\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:justify-center{justify-content:center}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:px-2{padding-left:.5rem;padding-right:.5rem}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\:focus-visible\]\:outline-none:has(:focus-visible){outline:2px solid transparent;outline-offset:2px}.has-\[\:focus-visible\]\:ring-1:has(:focus-visible){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.has-\[\:focus-visible\]\:ring-neutral-950:has(:focus-visible){--tw-ring-opacity: 1;--tw-ring-color: rgb(10 10 10 / var(--tw-ring-opacity, 1))}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:bg-accent\/50[aria-selected=true]{background-color:hsl(var(--accent) / .5)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[state\=dragging\]\:cursor-grabbing[data-state=dragging]{cursor:grabbing}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[disabled\]\:bg-muted-foreground[data-disabled],.data-\[fixed\]\:bg-muted-foreground[data-fixed]{background-color:hsl(var(--muted-foreground))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[collapsed\=true\]\:py-2[data-collapsed=true]{padding-top:.5rem;padding-bottom:.5rem}.data-\[disabled\]\:text-muted[data-disabled],.data-\[fixed\]\:text-muted[data-fixed]{color:hsl(var(--muted))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{transition-duration:.3s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{animation-duration:.3s}.data-\[disabled\]\:hover\:bg-muted-foreground:hover[data-disabled],.data-\[fixed\]\:hover\:bg-muted-foreground:hover[data-fixed]{background-color:hsl(var(--muted-foreground))}.group[data-state=open] .group-data-\[state\=\"open\"\]\:-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:border-blue-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-green-500\/10:is(.dark *){background-color:#22c55e1a}.dark\:bg-red-500\/10:is(.dark *){background-color:#ef44441a}.dark\:bg-yellow-500\/10:is(.dark *){background-color:#eab3081a}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:ring-gray-700:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity, 1))}.dark\:ring-gray-800:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(31 41 55 / var(--tw-ring-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-blue-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-red-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-red-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:has-\[\:focus-visible\]\:ring-neutral-300:has(:focus-visible):is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(212 212 212 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:absolute{position:absolute}.sm\:inset-auto{inset:auto}.sm\:bottom-\[calc\(100\%\+10px\)\]{bottom:calc(100% + 10px)}.sm\:left-0{left:0}.sm\:right-0{right:0}.sm\:my-0{margin-top:0;margin-bottom:0}.sm\:my-4{margin-top:1rem;margin-bottom:1rem}.sm\:mt-0{margin-top:0}.sm\:hidden{display:none}.sm\:h-\[80vh\]{height:80vh}.sm\:h-full{height:100%}.sm\:max-h-\[500px\]{max-height:500px}.sm\:max-h-\[600px\]{max-height:600px}.sm\:max-h-\[700px\]{max-height:700px}.sm\:max-h-\[800px\]{max-height:800px}.sm\:w-48{width:12rem}.sm\:w-\[480px\]{width:480px}.sm\:w-\[540px\]{width:540px}.sm\:w-\[90vw\]{width:90vw}.sm\:w-full{width:100%}.sm\:max-w-72{max-width:18rem}.sm\:max-w-\[1025px\]{max-width:1025px}.sm\:max-w-\[425px\]{max-width:425px}.sm\:max-w-\[700px\]{max-width:700px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:max-w-xl{max-width:36rem}.sm\:translate-y-5{--tw-translate-y: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:bottom-0{bottom:0}.md\:right-auto{right:auto}.md\:col-span-1{grid-column:span 1 / span 1}.md\:ml-14{margin-left:3.5rem}.md\:ml-64{margin-left:16rem}.md\:block{display:block}.md\:flex{display:flex}.md\:inline-flex{display:inline-flex}.md\:hidden{display:none}.md\:h-svh{height:100svh}.md\:max-h-screen{max-height:100vh}.md\:w-14{width:3.5rem}.md\:w-32{width:8rem}.md\:w-64{width:16rem}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[31rem\]{max-width:31rem}.md\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:overflow-y-hidden{overflow-y:hidden}.md\:border-none{border-style:none}.md\:px-4{padding-left:1rem;padding-right:1rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\:pt-0{padding-top:0}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.after\:md\:block:after{content:var(--tw-content);display:block}}@media (min-width: 1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-1\/5{width:20%}.lg\:w-\[250px\]{width:250px}.lg\:max-w-none{max-width:none}.lg\:max-w-xl{max-width:36rem}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:flex-col{flex-direction:column}.lg\:gap-8{gap:2rem}.lg\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(0px * var(--tw-space-x-reverse));margin-left:calc(0px * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-12>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(3rem * var(--tw-space-x-reverse));margin-left:calc(3rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-3{padding-left:.75rem;padding-right:.75rem}}@media (min-width: 1280px){.xl\:mr-2{margin-right:.5rem}.xl\:flex{display:flex}.xl\:inline-flex{display:inline-flex}.xl\:h-10{height:2.5rem}.xl\:w-60{width:15rem}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:justify-start{justify-content:flex-start}.xl\:px-3{padding-left:.75rem;padding-right:.75rem}.xl\:py-2{padding-top:.5rem;padding-bottom:.5rem}}.\[\&\:\:-webkit-calendar-picker-indicator\]\:hidden::-webkit-calendar-picker-indicator{display:none}.\[\&\:has\(\>\.day-range-end\)\]\:rounded-r-md:has(>.day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\>\.day-range-start\)\]\:rounded-l-md:has(>.day-range-start){border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:rounded-md:has([aria-selected]){border-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:hsl(var(--accent))}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-accent\/50:has([aria-selected].day-outside){background-color:hsl(var(--accent) / .5)}.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} +*,: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-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%}.collapsibleDropdown{overflow:hidden}.collapsibleDropdown[data-state=open]{animation:slideDown .2s ease-out}.collapsibleDropdown[data-state=closed]{animation:slideUp .2s ease-out}@keyframes slideDown{0%{height:0}to{height:var(--radix-collapsible-content-height)}}@keyframes slideUp{0%{height:var(--radix-collapsible-content-height)}to{height:0}}*{border-color:hsl(var(--border))}body{min-height:100svh;width:100%;background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-left-1{left:-.25rem}.-right-1{right:-.25rem}.-right-5{right:-1.25rem}.-top-1\/2{top:-50%}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-4{left:1rem}.left-5{left:1.25rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-5{right:1.25rem}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[-1\]{z-index:-1}.z-\[1\]{z-index:1}.col-span-2{grid-column:span 2 / span 2}.-m-0\.5{margin:-.125rem}.m-1{margin:.25rem}.m-auto{margin:auto}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.-ml-3{margin-left:-.75rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-8{margin-left:2rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\!table{display:table!important}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-\[16\/9\]{aspect-ratio:16/9}.aspect-square{aspect-ratio:1 / 1}.size-10{width:2.5rem;height:2.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[180px\]{height:180px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[90vh\]{height:90vh}.h-\[calc\(100\%-var\(--header-height\)\)\]{height:calc(100% - var(--header-height))}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-12{max-height:3rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95\%\]{max-height:95%}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-\[120px\]{min-height:120px}.min-h-\[200px\]{min-height:200px}.min-h-\[60px\]{min-height:60px}.w-0{width:0px}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[250px\]{width:250px}.w-\[300px\]{width:300px}.w-\[400px\]{width:400px}.w-\[50px\]{width:50px}.w-\[70px\]{width:70px}.w-\[80px\]{width:80px}.w-auto{width:auto}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.min-w-0{min-width:0px}.min-w-20{min-width:5rem}.min-w-\[10em\]{min-width:10em}.min-w-\[300px\]{min-width:300px}.min-w-\[40px\]{min-width:40px}.min-w-\[4rem\]{min-width:4rem}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-32{max-width:8rem}.max-w-4xl{max-width:56rem}.max-w-52{max-width:13rem}.max-w-80{max-width:20rem}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[500px\]{max-width:500px}.max-w-\[60\%\]{max-width:60%}.max-w-\[600px\]{max-width:600px}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-none{max-width:none}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-\[1\.2\]{flex:1.2}.flex-\[1\]{flex:1}.flex-\[2\]{flex:2}.flex-\[4\]{flex:4}.flex-\[5\]{flex:5}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-125{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-help{cursor:help}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[100px_1fr\]{grid-template-columns:100px 1fr}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-2{row-gap:.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-wrap{text-wrap:wrap}.text-nowrap{text-wrap:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-lg{border-top-left-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-lg{border-top-right-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-bl-none{border-bottom-left-radius:0}.rounded-br-none{border-bottom-right-radius:0}.rounded-tl-lg{border-top-left-radius:var(--radius)}.rounded-tl-none{border-top-left-radius:0}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-lg{border-top-right-radius:var(--radius)}.rounded-tr-none{border-top-right-radius:0}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-x-0{border-left-width:0px;border-right-width:0px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-0{border-left-width:0px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-r-0{border-right-width:0px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.border-blue-500\/50{border-color:#3b82f680}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-foreground\/10{border-color:hsl(var(--foreground) / .1)}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/25{border-color:hsl(var(--muted-foreground) / .25)}.border-orange-500\/50{border-color:#f9731680}.border-primary{border-color:hsl(var(--primary))}.border-primary\/40{border-color:hsl(var(--primary) / .4)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-l-slate-500{--tw-border-opacity: 1;border-left-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-r-muted{border-right-color:hsl(var(--muted))}.border-t-transparent{border-top-color:transparent}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/80{background-color:#000c}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-destructive\/15{background-color:hsl(var(--destructive) / .15)}.bg-destructive\/80{background-color:hsl(var(--destructive) / .8)}.bg-emerald-500\/80{background-color:#10b981cc}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-inherit{background-color:inherit}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground{background-color:hsl(var(--primary-foreground))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/50{background-color:hsl(var(--secondary) / .5)}.bg-slate-100\/80{background-color:#f1f5f9cc}.bg-transparent{background-color:transparent}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/80{background-color:#eab308cc}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-background\/95{--tw-gradient-from: hsl(var(--background) / .95) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background\/80{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .8) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-background\/60{--tw-gradient-to: hsl(var(--background) / .6) var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-primary{fill:hsl(var(--primary))}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-0\.5{padding-bottom:.125rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-3{padding-left:.75rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-7{padding-right:1.75rem}.pr-8{padding-right:2rem}.pr-9{padding-right:2.25rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-16{padding-top:4rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.625rem\]{font-size:.625rem}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[7rem\]{font-size:7rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-10{line-height:2.5rem}.leading-none{line-height:1}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/70{color:hsl(var(--foreground) / .7)}.text-foreground\/90{color:hsl(var(--foreground) / .9)}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/30{color:hsl(var(--muted-foreground) / .3)}.text-muted-foreground\/40{color:hsl(var(--muted-foreground) / .4)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/70{color:hsl(var(--muted-foreground) / .7)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/90{color:hsl(var(--primary) / .9)}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-destructive\/50{--tw-shadow-color: hsl(var(--destructive) / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/50{--tw-shadow-color: rgb(16 185 129 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-yellow-500\/50{--tw-shadow-color: rgb(234 179 8 / .5);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-gray-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(229 231 235 / var(--tw-ring-opacity, 1))}.ring-gray-300\/20{--tw-ring-color: rgb(209 213 219 / .2)}.ring-green-500\/20{--tw-ring-color: rgb(34 197 94 / .2)}.ring-primary\/20{--tw-ring-color: hsl(var(--primary) / .2)}.ring-offset-2{--tw-ring-offset-width: 2px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.ring-offset-white{--tw-ring-offset-color: #fff}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[1px\]{--tw-backdrop-blur: blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[max-height\,padding\]{transition-property:max-height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[opacity\]{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-100{transition-delay:.1s}.delay-150{transition-delay:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-150{animation-duration:.15s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-700{animation-duration:.7s}.delay-100{animation-delay:.1s}.delay-150{animation-delay:.15s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}html{overflow-y:scroll}.sticky{position:sticky!important;z-index:2;background-color:hsl(var(--card))}.sticky.before\:right-0:before,.sticky.before\:left-0:before{content:"";position:absolute;top:0;bottom:0;width:2px;background:linear-gradient(to right,rgba(0,0,0,.08),transparent);opacity:1;transition:opacity .3s ease}.sticky.before\:right-0:before{right:-1px;background:linear-gradient(to right,rgba(0,0,0,.08),transparent)}.sticky.before\:right-0:after{content:"";position:absolute;top:0;right:-8px;bottom:0;width:8px;pointer-events:none;background:linear-gradient(to right,rgba(0,0,0,.05),transparent)}.sticky.before\:left-0:before{left:-1px;background:linear-gradient(to left,rgba(0,0,0,.08),transparent)}.sticky.before\:left-0:after{content:"";position:absolute;top:0;left:-8px;bottom:0;width:8px;pointer-events:none;background:linear-gradient(to left,rgba(0,0,0,.05),transparent)}.sticky:hover:before{opacity:.8}.dark .sticky.before\:right-0:before,.dark .sticky.before\:left-0:before{background:linear-gradient(to right,rgba(255,255,255,.05),transparent)}.dark .sticky.before\:right-0:after,.dark .sticky.before\:left-0:after{background:linear-gradient(to right,rgba(255,255,255,.03),transparent)}.\*\:\!inline-block>*{display:inline-block!important}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:bottom-0:before{content:var(--tw-content);bottom:0}.before\:left-0:before{content:var(--tw-content);left:0}.before\:right-0:before{content:var(--tw-content);right:0}.before\:top-0:before{content:var(--tw-content);top:0}.before\:w-\[1px\]:before{content:var(--tw-content);width:1px}.before\:bg-border:before{content:var(--tw-content);background-color:hsl(var(--border))}.after\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:bottom-0:after{content:var(--tw-content);bottom:0}.after\:left-0:after{content:var(--tw-content);left:0}.after\:hidden:after{content:var(--tw-content);display:none}.after\:h-32:after{content:var(--tw-content);height:8rem}.after\:w-full:after{content:var(--tw-content);width:100%}.after\:bg-\[linear-gradient\(180deg\,_transparent_10\%\,_hsl\(var\(--background\)\)_70\%\)\]:after{content:var(--tw-content);background-image:linear-gradient(180deg,transparent 10%,hsl(var(--background)) 70%)}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.focus-within\:ring-1:focus-within{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-within\:ring-ring:focus-within{--tw-ring-color: hsl(var(--ring))}.hover\:-translate-y-1:hover{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-180:hover{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-background:hover{background-color:hsl(var(--background))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-card\/80:hover{background-color:hsl(var(--card) / .8)}.hover\:bg-destructive\/10:hover{background-color:hsl(var(--destructive) / .1)}.hover\:bg-destructive\/25:hover{background-color:hsl(var(--destructive) / .25)}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-100:hover{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.hover\:bg-inherit:hover{background-color:inherit}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/40:hover{background-color:hsl(var(--muted) / .4)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-muted\/60:hover{background-color:hsl(var(--muted) / .6)}.hover\:bg-muted\/70:hover{background-color:hsl(var(--muted) / .7)}.hover\:bg-primary:hover{background-color:hsl(var(--primary))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary-foreground\/10:hover{background-color:hsl(var(--secondary-foreground) / .1)}.hover\:bg-secondary\/70:hover{background-color:hsl(var(--secondary) / .7)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-200\/80:hover{background-color:#e2e8f0cc}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-yellow-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-80:hover{--tw-bg-opacity: .8}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-foreground\/70:hover{color:hsl(var(--foreground) / .7)}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-black\/30:hover{--tw-shadow-color: rgb(0 0 0 / .3);--tw-shadow: var(--tw-shadow-colored)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:z-10:focus{z-index:10}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-primary:focus{background-color:hsl(var(--primary))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-destructive:focus{color:hsl(var(--destructive))}.focus\:text-primary-foreground:focus{color:hsl(var(--primary-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-primary:focus-visible{--tw-ring-color: hsl(var(--primary))}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-90:active{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:via-background\/90{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .9) var(--tw-gradient-via-position), var(--tw-gradient-to)}.group:hover .group-hover\:to-background\/70{--tw-gradient-to: hsl(var(--background) / .7) var(--tw-gradient-to-position)}.group\/id:hover .group-hover\/id\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:justify-center{justify-content:center}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:px-2{padding-left:.5rem;padding-right:.5rem}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\:focus-visible\]\:outline-none:has(:focus-visible){outline:2px solid transparent;outline-offset:2px}.has-\[\:focus-visible\]\:ring-1:has(:focus-visible){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.has-\[\:focus-visible\]\:ring-neutral-950:has(:focus-visible){--tw-ring-opacity: 1;--tw-ring-color: rgb(10 10 10 / var(--tw-ring-opacity, 1))}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:bg-accent\/50[aria-selected=true]{background-color:hsl(var(--accent) / .5)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[state\=dragging\]\:cursor-grabbing[data-state=dragging]{cursor:grabbing}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[disabled\]\:bg-muted-foreground[data-disabled],.data-\[fixed\]\:bg-muted-foreground[data-fixed]{background-color:hsl(var(--muted-foreground))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[collapsed\=true\]\:py-2[data-collapsed=true]{padding-top:.5rem;padding-bottom:.5rem}.data-\[disabled\]\:text-muted[data-disabled],.data-\[fixed\]\:text-muted[data-fixed]{color:hsl(var(--muted))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{transition-duration:.3s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{animation-duration:.3s}.data-\[disabled\]\:hover\:bg-muted-foreground:hover[data-disabled],.data-\[fixed\]\:hover\:bg-muted-foreground:hover[data-fixed]{background-color:hsl(var(--muted-foreground))}.group[data-state=open] .group-data-\[state\=\"open\"\]\:-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:border-blue-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-green-500\/10:is(.dark *){background-color:#22c55e1a}.dark\:bg-red-500\/10:is(.dark *){background-color:#ef44441a}.dark\:bg-yellow-500\/10:is(.dark *){background-color:#eab3081a}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:ring-gray-700:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity, 1))}.dark\:ring-gray-800:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(31 41 55 / var(--tw-ring-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-blue-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-red-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-red-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:has-\[\:focus-visible\]\:ring-neutral-300:has(:focus-visible):is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(212 212 212 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:absolute{position:absolute}.sm\:inset-auto{inset:auto}.sm\:bottom-\[calc\(100\%\+10px\)\]{bottom:calc(100% + 10px)}.sm\:left-0{left:0}.sm\:right-0{right:0}.sm\:my-0{margin-top:0;margin-bottom:0}.sm\:my-4{margin-top:1rem;margin-bottom:1rem}.sm\:mt-0{margin-top:0}.sm\:hidden{display:none}.sm\:h-\[80vh\]{height:80vh}.sm\:h-full{height:100%}.sm\:max-h-\[500px\]{max-height:500px}.sm\:max-h-\[600px\]{max-height:600px}.sm\:max-h-\[700px\]{max-height:700px}.sm\:max-h-\[800px\]{max-height:800px}.sm\:w-48{width:12rem}.sm\:w-\[480px\]{width:480px}.sm\:w-\[540px\]{width:540px}.sm\:w-\[90vw\]{width:90vw}.sm\:w-full{width:100%}.sm\:max-w-72{max-width:18rem}.sm\:max-w-\[1025px\]{max-width:1025px}.sm\:max-w-\[425px\]{max-width:425px}.sm\:max-w-\[700px\]{max-width:700px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:max-w-xl{max-width:36rem}.sm\:translate-y-5{--tw-translate-y: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:bottom-0{bottom:0}.md\:right-auto{right:auto}.md\:col-span-1{grid-column:span 1 / span 1}.md\:ml-14{margin-left:3.5rem}.md\:ml-64{margin-left:16rem}.md\:block{display:block}.md\:flex{display:flex}.md\:inline-flex{display:inline-flex}.md\:hidden{display:none}.md\:h-svh{height:100svh}.md\:max-h-screen{max-height:100vh}.md\:w-14{width:3.5rem}.md\:w-32{width:8rem}.md\:w-64{width:16rem}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[31rem\]{max-width:31rem}.md\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:overflow-y-hidden{overflow-y:hidden}.md\:border-none{border-style:none}.md\:px-4{padding-left:1rem;padding-right:1rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\:pt-0{padding-top:0}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.after\:md\:block:after{content:var(--tw-content);display:block}}@media (min-width: 1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-1\/5{width:20%}.lg\:w-\[250px\]{width:250px}.lg\:max-w-none{max-width:none}.lg\:max-w-xl{max-width:36rem}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:flex-col{flex-direction:column}.lg\:gap-8{gap:2rem}.lg\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(0px * var(--tw-space-x-reverse));margin-left:calc(0px * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-12>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(3rem * var(--tw-space-x-reverse));margin-left:calc(3rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-3{padding-left:.75rem;padding-right:.75rem}}@media (min-width: 1280px){.xl\:mr-2{margin-right:.5rem}.xl\:flex{display:flex}.xl\:inline-flex{display:inline-flex}.xl\:h-10{height:2.5rem}.xl\:w-60{width:15rem}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:justify-start{justify-content:flex-start}.xl\:px-3{padding-left:.75rem;padding-right:.75rem}.xl\:py-2{padding-top:.5rem;padding-bottom:.5rem}}.\[\&\:\:-webkit-calendar-picker-indicator\]\:hidden::-webkit-calendar-picker-indicator{display:none}.\[\&\:has\(\>\.day-range-end\)\]\:rounded-r-md:has(>.day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\>\.day-range-start\)\]\:rounded-l-md:has(>.day-range-start){border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:rounded-md:has([aria-selected]){border-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:hsl(var(--accent))}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-accent\/50:has([aria-selected].day-outside){background-color:hsl(var(--accent) / .5)}.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} diff --git a/public/assets/admin/assets/index.js b/public/assets/admin/assets/index.js index 8e25f82..a69d59d 100644 --- a/public/assets/admin/assets/index.js +++ b/public/assets/admin/assets/index.js @@ -1,7 +1,7 @@ -import{r as c,j as e,t as hl,c as jl,I as ba,a as _s,S as Wt,u as ns,b as Jt,d as gl,O as Qt,e as fl,f as A,g as pl,h as vl,i as bl,Q as yl,k as Nl,R as wl,l as _l,P as Cl,m as Sl,B as kl,n as qa,F as Dl,C as Tl,o as Pl,p as Il,q as Vl,s as Rl,v as El,z as u,w as Ua,x as ae,y as ie,A as Ba,D as _t,E as Ct,G as Zt,H as Me,T as St,J as kt,K as Ga,L as Ya,M as Fl,N as Ml,U as zl,V as Ol,W as Wa,X as Xt,Y as Ja,Z as Ll,_ as Qa,$ as Za,a0 as Xa,a1 as en,a2 as Cs,a3 as sn,a4 as $l,a5 as tn,a6 as an,a7 as Al,a8 as Hl,a9 as Kl,aa as ql,ab as nn,ac as Ul,ad as Bl,ae as Ss,af as rn,ag as Gl,ah as Yl,ai as ln,aj as Wl,ak as Jl,al as ya,am as Ql,an as on,ao as Zl,ap as cn,aq as Xl,ar as ei,as as si,at as ti,au as ai,av as ni,aw as dn,ax as ri,ay as li,az as ii,aA as we,aB as oi,aC as ci,aD as di,aE as ui,aF as un,aG as xn,aH as mn,aI as xi,aJ as hn,aK as jn,aL as gn,aM as mi,aN as hi,aO as ji,aP as fn,aQ as gi,aR as ea,aS as pn,aT as fi,aU as vn,aV as pi,aW as bn,aX as vi,aY as yn,aZ as Nn,a_ as bi,a$ as yi,b0 as wn,b1 as Ni,b2 as wi,b3 as _n,b4 as _i,b5 as Cn,b6 as Ci,b7 as Si,b8 as He,b9 as Q,ba as Pe,bb as rt,bc as ki,bd as Di,be as Ti,bf as Pi,bg as Ii,bh as Vi,bi as Na,bj as wa,bk as Ri,bl as Ei,bm as Fi,bn as Mi,bo as zi,bp as Oi,bq as Sn,br as Li,bs as kn,bt as $i,bu as Ai,bv as Dn,bw as Hi,bx as de,by as Ki,bz as _a,bA as At,bB as Ht,bC as qi,bD as Ui,bE as Tn,bF as Bi,bG as sa,bH as Gi,bI as Yi,bJ as Wi,bK as Pn,bL as In,bM as Vn,bN as Ji,bO as Qi,bP as Zi,bQ as Xi,bR as Rn,bS as eo,bT as Je,bU as so,bV as to,bW as vt,bX as ve,bY as Ca,bZ as ao,b_ as En,b$ as Fn,c0 as Mn,c1 as zn,c2 as On,c3 as Ln,c4 as no,c5 as ro,c6 as lo,c7 as Dt,c8 as ks,c9 as rs,ca as Le,cb as $e,cc as Ke,cd as qe,ce as Ue,cf as Sa,cg as io,ch as oo,ci as co,cj as Kt,ck as ta,cl as aa,cm as uo,cn as ls,co as is,cp as lt,cq as xo,cr as mo,cs as ka,ct as Da,cu as $n,cv as Ta,cw as bt,cx as ho,cy as jo,cz as An,cA as go,cB as fo,cC as Hn,cD as qt,cE as Kn,cF as po,cG as qn,cH as Un,cI as vo,cJ as bo,cK as yo,cL as No,cM as wo}from"./vendor.js";import"./index.js";var ph=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vh(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function _o(s){if(s.__esModule)return s;var t=s.default;if(typeof t=="function"){var a=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};a.prototype=t.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(s).forEach(function(n){var l=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(a,n,l.get?l:{enumerable:!0,get:function(){return s[n]}})}),a}const Co={theme:"system",setTheme:()=>null},Bn=c.createContext(Co);function So({children:s,defaultTheme:t="system",storageKey:a="vite-ui-theme",...n}){const[l,o]=c.useState(()=>localStorage.getItem(a)||t);c.useEffect(()=>{const x=window.document.documentElement;if(x.classList.remove("light","dark"),l==="system"){const r=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";x.classList.add(r);return}x.classList.add(l)},[l]);const d={theme:l,setTheme:x=>{localStorage.setItem(a,x),o(x)}};return e.jsx(Bn.Provider,{...n,value:d,children:s})}const ko=()=>{const s=c.useContext(Bn);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Do=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),To=function(s,t){return new URL(s,t).href},Pa={},X=function(t,a,n){let l=Promise.resolve();if(a&&a.length>0){const d=document.getElementsByTagName("link"),x=document.querySelector("meta[property=csp-nonce]"),r=x?.nonce||x?.getAttribute("nonce");l=Promise.allSettled(a.map(i=>{if(i=To(i,n),i in Pa)return;Pa[i]=!0;const h=i.endsWith(".css"),T=h?'[rel="stylesheet"]':"";if(!!n)for(let w=d.length-1;w>=0;w--){const _=d[w];if(_.href===i&&(!h||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${T}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":Do,h||(m.as="script"),m.crossOrigin="",m.href=i,r&&m.setAttribute("nonce",r),document.head.appendChild(m),h)return new Promise((w,_)=>{m.addEventListener("load",w),m.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${i}`)))})}))}function o(d){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=d,window.dispatchEvent(x),!x.defaultPrevented)throw d}return l.then(d=>{for(const x of d||[])x.status==="rejected"&&o(x.reason);return t().catch(o)})};function y(...s){return hl(jl(s))}const $s=_s("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),D=c.forwardRef(({className:s,variant:t,size:a,asChild:n=!1,children:l,disabled:o,loading:d=!1,leftSection:x,rightSection:r,...i},h)=>{const T=n?Wt:"button";return e.jsxs(T,{className:y($s({variant:t,size:a,className:s})),disabled:d||o,ref:h,...i,children:[(x&&d||!x&&!r&&d)&&e.jsx(ba,{className:"mr-2 h-4 w-4 animate-spin"}),!d&&x&&e.jsx("div",{className:"mr-2",children:x}),l,!d&&r&&e.jsx("div",{className:"ml-2",children:r}),r&&d&&e.jsx(ba,{className:"ml-2 h-4 w-4 animate-spin"})]})});D.displayName="Button";function Vs({className:s,minimal:t=!1}){const a=ns();return e.jsx("div",{className:y("h-svh w-full",s),children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[!t&&e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"500"}),e.jsxs("span",{className:"font-medium",children:["Oops! Something went wrong ",":')"]}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["We apologize for the inconvenience. ",e.jsx("br",{})," Please try again later."]}),!t&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(D,{variant:"outline",onClick:()=>a(-1),children:"Go Back"}),e.jsx(D,{onClick:()=>a("/"),children:"Back to Home"})]})]})})}function Ia(){const s=ns();return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"404"}),e.jsx("span",{className:"font-medium",children:"Oops! Page Not Found!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["It seems like the page you're looking for ",e.jsx("br",{}),"does not exist or might have been removed."]}),e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(D,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(D,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function Po(){return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"503"}),e.jsx("span",{className:"font-medium",children:"Website is under maintenance!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["The site is not available at the moment. ",e.jsx("br",{}),"We'll be back online shortly."]}),e.jsx("div",{className:"mt-6 flex gap-4",children:e.jsx(D,{variant:"outline",children:"Learn more"})})]})})}function Io(s){return typeof s>"u"}function Vo(s){return s===null}function Ro(s){return Vo(s)||Io(s)}class Eo{storage;prefixKey;constructor(t){this.storage=t.storage,this.prefixKey=t.prefixKey}getKey(t){return`${this.prefixKey}${t}`.toUpperCase()}set(t,a,n=null){const l=JSON.stringify({value:a,time:Date.now(),expire:n!==null?new Date().getTime()+n*1e3:null});this.storage.setItem(this.getKey(t),l)}get(t,a=null){const n=this.storage.getItem(this.getKey(t));if(!n)return{value:a,time:0};try{const l=JSON.parse(n),{value:o,time:d,expire:x}=l;return Ro(x)||x>new Date().getTime()?{value:o,time:d}:(this.remove(t),{value:a,time:0})}catch{return this.remove(t),{value:a,time:0}}}remove(t){this.storage.removeItem(this.getKey(t))}clear(){this.storage.clear()}}function Gn({prefixKey:s="",storage:t=sessionStorage}){return new Eo({prefixKey:s,storage:t})}const Yn="Xboard_",Fo=function(s={}){return Gn({prefixKey:s.prefixKey||"",storage:localStorage})},Mo=function(s={}){return Gn({prefixKey:s.prefixKey||"",storage:sessionStorage})},Tt=Fo({prefixKey:Yn});Mo({prefixKey:Yn});const Wn="access_token";function Qs(){return Tt.get(Wn)}function Jn(){Tt.remove(Wn)}const Va=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function zo({children:s}){const t=ns(),a=Jt(),n=Qs();return c.useEffect(()=>{if(!n.value&&!Va.includes(a.pathname)){const l=encodeURIComponent(a.pathname+a.search);t(`/sign-in?redirect=${l}`)}},[n.value,a.pathname,a.search,t]),Va.includes(a.pathname)||n.value?e.jsx(e.Fragment,{children:s}):null}const Oo=()=>e.jsx(zo,{children:e.jsx(Qt,{})}),Lo=gl([{path:"/sign-in",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>lc);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(Oo,{}),children:[{path:"/",lazy:async()=>({Component:(await X(()=>Promise.resolve().then(()=>bc),void 0,import.meta.url)).default}),errorElement:e.jsx(Vs,{}),children:[{index:!0,lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Bd);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Vs,{}),children:[{path:"system",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Wd);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>eu);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>ru);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>du);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>ju);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>bu);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Cu);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Pu);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Fu);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>$u);return{default:s}},void 0,import.meta.url)).default})}]},{path:"payment",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Zu);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>sx);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>ox);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>gx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Vs,{}),children:[{path:"manage",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Ax);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Bx);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Zx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Vs,{}),children:[{path:"plan",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>im);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>bm);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Tm);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Vs,{}),children:[{path:"manage",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Zm);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>jh);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Vs},{path:"/404",Component:Ia},{path:"/503",Component:Po},{path:"*",Component:Ia}]),$o="locale";function Ao(){return Tt.get($o)}function Qn(){Jn();const s=window.location.pathname,t=s&&!["/404","/sign-in"].includes(s),a=new URL(window.location.href),l=`${a.pathname.split("/")[1]?`/${a.pathname.split("/")[1]}`:""}#/sign-in`;window.location.href=l+(t?`?redirect=${s}`:"")}const Ho=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function Ko(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const V=fl.create({baseURL:Ko(),timeout:12e3,headers:{"Content-Type":"application/json"}});V.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const t=Qs();if(!Ho.includes(s.url?.split("?")[0]||"")){if(!t.value)return Qn(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=t.value}return s.headers["Content-Language"]=Ao().value||"zh-CN",s},s=>Promise.reject(s));V.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const t=s.response?.status,a=s.response?.data?.message;return(t===401||t===403)&&Qn(),A.error(a||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[t]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});function qo(){return V.get("/user/info")}const Mt={token:Qs()?.value||"",userInfo:null,isLoggedIn:!!Qs()?.value,loading:!1,error:null},Ws=pl("user/fetchUserInfo",async()=>(await qo()).data,{condition:(s,{getState:t})=>{const{user:a}=t();return!!a.token&&!a.loading}}),Zn=vl({name:"user",initialState:Mt,reducers:{setToken(s,t){s.token=t.payload,s.isLoggedIn=!!t.payload},resetUserState:()=>Mt},extraReducers:s=>{s.addCase(Ws.pending,t=>{t.loading=!0,t.error=null}).addCase(Ws.fulfilled,(t,a)=>{t.loading=!1,t.userInfo=a.payload,t.error=null}).addCase(Ws.rejected,(t,a)=>{if(t.loading=!1,t.error=a.error.message||"Failed to fetch user info",!t.token)return Mt})}}),{setToken:Uo,resetUserState:Bo}=Zn.actions,Go=s=>s.user.userInfo,Yo=Zn.reducer,Xn=bl({reducer:{user:Yo}});Qs()?.value&&Xn.dispatch(Ws());const Wo=new yl;Nl.createRoot(document.getElementById("root")).render(e.jsx(wl.StrictMode,{children:e.jsx(_l,{client:Wo,children:e.jsx(Cl,{store:Xn,children:e.jsxs(So,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(Sl,{router:Lo}),e.jsx(kl,{richColors:!0,position:"top-right"})]})})})}));const Ie=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:y("rounded-xl border bg-card text-card-foreground shadow",s),...t}));Ie.displayName="Card";const ze=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:y("flex flex-col space-y-1.5 p-6",s),...t}));ze.displayName="CardHeader";const Qe=c.forwardRef(({className:s,...t},a)=>e.jsx("h3",{ref:a,className:y("font-semibold leading-none tracking-tight",s),...t}));Qe.displayName="CardTitle";const Zs=c.forwardRef(({className:s,...t},a)=>e.jsx("p",{ref:a,className:y("text-sm text-muted-foreground",s),...t}));Zs.displayName="CardDescription";const Oe=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:y("p-6 pt-0",s),...t}));Oe.displayName="CardContent";const Jo=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:y("flex items-center p-6 pt-0",s),...t}));Jo.displayName="CardFooter";const Qo=_s("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),yt=c.forwardRef(({className:s,...t},a)=>e.jsx(qa,{ref:a,className:y(Qo(),s),...t}));yt.displayName=qa.displayName;const oe=Dl,er=c.createContext({}),g=({...s})=>e.jsx(er.Provider,{value:{name:s.name},children:e.jsx(Tl,{...s})}),Pt=()=>{const s=c.useContext(er),t=c.useContext(sr),{getFieldState:a,formState:n}=Pl(),l=a(s.name,n);if(!s)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:s.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...l}},sr=c.createContext({}),j=c.forwardRef(({className:s,...t},a)=>{const n=c.useId();return e.jsx(sr.Provider,{value:{id:n},children:e.jsx("div",{ref:a,className:y("space-y-2",s),...t})})});j.displayName="FormItem";const p=c.forwardRef(({className:s,...t},a)=>{const{error:n,formItemId:l}=Pt();return e.jsx(yt,{ref:a,className:y(n&&"text-destructive",s),htmlFor:l,...t})});p.displayName="FormLabel";const b=c.forwardRef(({...s},t)=>{const{error:a,formItemId:n,formDescriptionId:l,formMessageId:o}=Pt();return e.jsx(Wt,{ref:t,id:n,"aria-describedby":a?`${l} ${o}`:`${l}`,"aria-invalid":!!a,...s})});b.displayName="FormControl";const F=c.forwardRef(({className:s,...t},a)=>{const{formDescriptionId:n}=Pt();return e.jsx("p",{ref:a,id:n,className:y("text-[0.8rem] text-muted-foreground",s),...t})});F.displayName="FormDescription";const k=c.forwardRef(({className:s,children:t,...a},n)=>{const{error:l,formMessageId:o}=Pt(),d=l?String(l?.message):t;return d?e.jsx("p",{ref:n,id:o,className:y("text-[0.8rem] font-medium text-destructive",s),...a,children:d}):null});k.displayName="FormMessage";const S=c.forwardRef(({className:s,type:t,...a},n)=>e.jsx("input",{type:t,className:y("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:n,...a}));S.displayName="Input";const tr=c.forwardRef(({className:s,...t},a)=>{const[n,l]=c.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:n?"text":"password",className:y("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...t}),e.jsx(D,{type:"button",size:"icon",variant:"ghost",className:"absolute right-1 top-1/2 h-6 w-6 -translate-y-1/2 rounded-md text-muted-foreground",onClick:()=>l(o=>!o),children:n?e.jsx(Il,{size:18}):e.jsx(Vl,{size:18})})]})});tr.displayName="PasswordInput";const Zo=s=>V({url:"/passport/auth/login",method:"post",data:s}),Ut=s=>s;function re(s=void 0,t="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),El(s).format(t))}function Xo(s=void 0,t="YYYY-MM-DD"){return re(s,t)}function Fs(s){const t=typeof s=="string"?parseFloat(s):s;return isNaN(t)?"0.00":t.toFixed(2)}function hs(s,t=!0){if(s==null)return t?"¥0.00":"0.00";const a=typeof s=="string"?parseFloat(s):s;if(isNaN(a))return t?"¥0.00":"0.00";const l=(a/100).toFixed(2).replace(/\.?0+$/,o=>o.includes(".")?".00":o);return t?`¥${l}`:l}function Nt(s){navigator.clipboard?navigator.clipboard.writeText(s).then(()=>{A.success(Ut("复制成功"))}).catch(t=>{console.error("复制到剪贴板时出错:",t),Ra(s)}):Ra(s)}function Ra(s){const t=document.createElement("button"),a=new Rl(t,{text:()=>s});a.on("success",()=>{A.success(Ut("复制成功")),a.destroy()}),a.on("error",()=>{A.error(Ut("复制失败")),a.destroy()}),t.click()}function zs(s){const t=s/1024,a=t/1024,n=a/1024,l=n/1024;return l>=1?Fs(l)+" TB":n>=1?Fs(n)+" GB":a>=1?Fs(a)+" MB":Fs(t)+" KB"}const ec="access_token";function sc(s){Tt.set(ec,s)}const tc=u.object({email:u.string().min(1,{message:"请输入邮箱地址"}).email({message:"邮箱地址格式不正确"}),password:u.string().min(1,{message:"请输入密码"}).min(7,{message:"密码长度至少为7个字符"})});function ac({className:s,onForgotPassword:t,...a}){const n=ns(),l=Ua(),o=ae({resolver:ie(tc),defaultValues:{email:"",password:""}});async function d(x){Zo(x).then(({data:r})=>{sc(r.auth_data),l(Uo(r.auth_data)),l(Ws()).unwrap(),n("/")})}return e.jsx("div",{className:y("grid gap-6",s),...a,children:e.jsx(oe,{...o,children:e.jsx("form",{onSubmit:o.handleSubmit(d),children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(g,{control:o.control,name:"email",render:({field:x})=>e.jsxs(j,{className:"space-y-1",children:[e.jsx(p,{children:"邮箱地址"}),e.jsx(b,{children:e.jsx(S,{placeholder:"name@example.com",...x})}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"password",render:({field:x})=>e.jsxs(j,{className:"space-y-1",children:[e.jsx(p,{children:"密码"}),e.jsx(b,{children:e.jsx(tr,{placeholder:"请输入密码",...x})}),e.jsx(k,{})]})}),e.jsx(D,{className:"mt-2",loading:o.formState.isSubmitting,children:"登录"}),e.jsx(D,{variant:"link",type:"button",className:"mt-1 text-sm text-muted-foreground hover:text-primary",onClick:t,children:"忘记密码?"})]})})})})}const ue=Ba,Re=Ga,nc=Ya,it=Zt,ar=c.forwardRef(({className:s,...t},a)=>e.jsx(_t,{ref:a,className:y("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t}));ar.displayName=_t.displayName;const ce=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(nc,{children:[e.jsx(ar,{}),e.jsxs(Ct,{ref:n,className:y("max-h-[95%] overflow-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...a,children:[t,e.jsxs(Zt,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Me,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ce.displayName=Ct.displayName;const je=({className:s,...t})=>e.jsx("div",{className:y("flex flex-col space-y-1.5 text-center sm:text-left",s),...t});je.displayName="DialogHeader";const Ee=({className:s,...t})=>e.jsx("div",{className:y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Ee.displayName="DialogFooter";const xe=c.forwardRef(({className:s,...t},a)=>e.jsx(St,{ref:a,className:y("text-lg font-semibold leading-none tracking-tight",s),...t}));xe.displayName=St.displayName;const Se=c.forwardRef(({className:s,...t},a)=>e.jsx(kt,{ref:a,className:y("text-sm text-muted-foreground",s),...t}));Se.displayName=kt.displayName;const Ls=_s("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),W=c.forwardRef(({className:s,variant:t,size:a,asChild:n=!1,...l},o)=>{const d=n?Wt:"button";return e.jsx(d,{className:y(Ls({variant:t,size:a,className:s})),ref:o,...l})});W.displayName="Button";function rc(){const[s,t]=c.useState(!1),a="php artisan reset:password 管理员邮箱";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"container grid h-svh flex-col items-center justify-center bg-primary-foreground lg:max-w-none lg:px-0",children:e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-2 sm:w-[480px] lg:p-8",children:[e.jsx("div",{className:"mb-4 flex items-center justify-center",children:e.jsx("h1",{className:"text-3xl font-medium",children:window?.settings?.title})}),e.jsxs(Ie,{className:"p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"登录"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"请输入您的邮箱和密码登录系统"})]}),e.jsx(ac,{onForgotPassword:()=>t(!0)})]})]})}),e.jsx(ue,{open:s,onOpenChange:t,children:e.jsx(ce,{children:e.jsxs(je,{children:[e.jsx(xe,{children:"忘记密码"}),e.jsx(Se,{children:"在站点目录下执行以下命令找回密码"}),e.jsx("div",{className:"mt-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"rounded-md bg-secondary p-4 pr-12",children:a}),e.jsx(W,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>Nt(a),children:e.jsx(Fl,{className:"h-4 w-4"})})]})})]})})})]})}const lc=Object.freeze(Object.defineProperty({__proto__:null,default:rc},Symbol.toStringTag,{value:"Module"})),ye=c.forwardRef(({className:s,fadedBelow:t=!1,fixedHeight:a=!1,...n},l)=>e.jsx("div",{ref:l,className:y("relative flex h-full w-full flex-col",t&&"after:pointer-events-none after:absolute after:bottom-0 after:left-0 after:hidden after:h-32 after:w-full after:bg-[linear-gradient(180deg,_transparent_10%,_hsl(var(--background))_70%)] after:md:block",a&&"md:h-svh",s),...n}));ye.displayName="Layout";const Ne=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:y("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...t}));Ne.displayName="LayoutHeader";const _e=c.forwardRef(({className:s,fixedHeight:t,...a},n)=>e.jsx("div",{ref:n,className:y("flex-1 overflow-hidden px-4 py-6 md:px-8",t&&"h-[calc(100%-var(--header-height))]",s),...a}));_e.displayName="LayoutBody";const nr=Ml,rr=zl,lr=Ol,Ns=Al,ws=Hl,ic=Kl,oc=c.forwardRef(({className:s,inset:t,children:a,...n},l)=>e.jsxs(Wa,{ref:l,className:y("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",s),...n,children:[a,e.jsx(Xt,{className:"ml-auto h-4 w-4"})]}));oc.displayName=Wa.displayName;const cc=c.forwardRef(({className:s,...t},a)=>e.jsx(Ja,{ref:a,className:y("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...t}));cc.displayName=Ja.displayName;const gs=c.forwardRef(({className:s,sideOffset:t=4,...a},n)=>e.jsx(Ll,{children:e.jsx(Qa,{ref:n,sideOffset:t,className:y("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a})}));gs.displayName=Qa.displayName;const he=c.forwardRef(({className:s,inset:t,...a},n)=>e.jsx(Za,{ref:n,className:y("relative flex cursor-default cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",s),...a}));he.displayName=Za.displayName;const dc=c.forwardRef(({className:s,children:t,checked:a,...n},l)=>e.jsxs(Xa,{ref:l,className:y("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:a,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(en,{children:e.jsx(Cs,{className:"h-4 w-4"})})}),t]}));dc.displayName=Xa.displayName;const uc=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(sn,{ref:n,className:y("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(en,{children:e.jsx($l,{className:"h-4 w-4 fill-current"})})}),t]}));uc.displayName=sn.displayName;const na=c.forwardRef(({className:s,inset:t,...a},n)=>e.jsx(tn,{ref:n,className:y("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",s),...a}));na.displayName=tn.displayName;const Xs=c.forwardRef(({className:s,...t},a)=>e.jsx(an,{ref:a,className:y("-mx-1 my-1 h-px bg-muted",s),...t}));Xs.displayName=an.displayName;const Bt=({className:s,...t})=>e.jsx("span",{className:y("ml-auto text-xs tracking-widest opacity-60",s),...t});Bt.displayName="DropdownMenuShortcut";const le=ql,se=Ul,te=Bl,ee=c.forwardRef(({className:s,sideOffset:t=4,...a},n)=>e.jsx(nn,{ref:n,sideOffset:t,className:y("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a}));ee.displayName=nn.displayName;function It(){const{pathname:s}=Jt();return{checkActiveNav:a=>{if(a==="/"&&s==="/")return!0;const n=a.replace(/^\//,""),l=s.replace(/^\//,"");return n?l.startsWith(n):!1}}}function ir({key:s,defaultValue:t}){const[a,n]=c.useState(()=>{const l=localStorage.getItem(s);return l!==null?JSON.parse(l):t});return c.useEffect(()=>{localStorage.setItem(s,JSON.stringify(a))},[a,s]),[a,n]}function xc(){const[s,t]=ir({key:"expanded-sidebar-items",defaultValue:["仪表盘","系统管理","节点管理","订阅管理","用户管理"]});return{expandedItems:s,toggleItem:n=>{t(l=>l.includes(n)?l.filter(o=>o!==n):[...l,n])},isExpanded:n=>s.includes(n)}}function mc({links:s,isCollapsed:t,className:a,closeNav:n}){const l=({sub:o,...d})=>{const x=`${d.title}-${d.href}`;return t&&o?c.createElement(gc,{...d,sub:o,key:x,closeNav:n}):t?c.createElement(jc,{...d,key:x,closeNav:n}):o?c.createElement(hc,{...d,sub:o,key:x,closeNav:n}):c.createElement(or,{...d,key:x,closeNav:n})};return e.jsx("div",{"data-collapsed":t,className:y("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",a),children:e.jsx(le,{delayDuration:0,children:e.jsx("nav",{className:"grid gap-1 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:s.map(l)})})})}function or({title:s,icon:t,label:a,href:n,closeNav:l,subLink:o=!1}){const{checkActiveNav:d}=It();return e.jsxs(Ss,{to:n,onClick:l,className:y($s({variant:d(n)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",o&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":d(n)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:t}),s,a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:a})]})}function hc({title:s,icon:t,label:a,sub:n,closeNav:l}){const{checkActiveNav:o}=It(),{isExpanded:d,toggleItem:x}=xc(),r=!!n?.find(h=>o(h.href)),i=d(s)||r;return e.jsxs(nr,{open:i,onOpenChange:()=>x(s),children:[e.jsxs(rr,{className:y($s({variant:"ghost",size:"sm"}),"group h-12 w-full justify-start rounded-none px-6"),children:[e.jsx("div",{className:"mr-2",children:t}),s,a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:a}),e.jsx("span",{className:y('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(rn,{stroke:1})})]}),e.jsx(lr,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:n.map(h=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(or,{...h,subLink:!0,closeNav:l})},h.title))})})]})}function jc({title:s,icon:t,label:a,href:n}){const{checkActiveNav:l}=It();return e.jsxs(se,{delayDuration:0,children:[e.jsx(te,{asChild:!0,children:e.jsxs(Ss,{to:n,className:y($s({variant:l(n)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[t,e.jsx("span",{className:"sr-only",children:s})]})}),e.jsxs(ee,{side:"right",className:"flex items-center gap-4",children:[s,a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:a})]})]})}function gc({title:s,icon:t,label:a,sub:n}){const{checkActiveNav:l}=It(),o=!!n?.find(d=>l(d.href));return e.jsxs(Ns,{children:[e.jsxs(se,{delayDuration:0,children:[e.jsx(te,{asChild:!0,children:e.jsx(ws,{asChild:!0,children:e.jsx(D,{variant:o?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:t})})}),e.jsxs(ee,{side:"right",className:"flex items-center gap-4",children:[s," ",a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:a}),e.jsx(rn,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(gs,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(na,{children:[s," ",a?`(${a})`:""]}),e.jsx(Xs,{}),n.map(({title:d,icon:x,label:r,href:i})=>e.jsx(he,{asChild:!0,children:e.jsxs(Ss,{to:i,className:`${l(i)?"bg-secondary":""}`,children:[x," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:d}),r&&e.jsx("span",{className:"ml-auto text-xs",children:r})]})},`${d}-${i}`))]})]})}const cr=[{title:"仪表盘",label:"",href:"/",icon:e.jsx(Gl,{size:18})},{title:"系统管理",label:"",href:"",icon:e.jsx(Yl,{size:18}),sub:[{title:"系统配置",label:"",href:"/config/system",icon:e.jsx(ln,{size:18})},{title:"主题配置",label:"",href:"/config/theme",icon:e.jsx(Wl,{size:18})},{title:"公告管理",label:"",href:"/config/notice",icon:e.jsx(Jl,{size:18})},{title:"支付配置",label:"",href:"/config/payment",icon:e.jsx(ya,{size:18})},{title:"知识库管理",label:"",href:"/config/knowledge",icon:e.jsx(Ql,{size:18})}]},{title:"节点管理",label:"",href:"",icon:e.jsx(on,{size:18}),sub:[{title:"节点管理",label:"",href:"/server/manage",icon:e.jsx(Zl,{size:18})},{title:"权限组管理",label:"",href:"/server/group",icon:e.jsx(cn,{size:18})},{title:"路由管理",label:"",href:"/server/route",icon:e.jsx(Xl,{size:18})}]},{title:"订阅管理",label:"",href:"",icon:e.jsx(ei,{size:18}),sub:[{title:"套餐管理",label:"",href:"/finance/plan",icon:e.jsx(si,{size:18})},{title:"订单管理",label:"",href:"/finance/order",icon:e.jsx(ya,{size:18})},{title:"优惠券管理",label:"",href:"/finance/coupon",icon:e.jsx(ti,{size:18})}]},{title:"用户管理",label:"",href:"",icon:e.jsx(ai,{size:18}),sub:[{title:"用户管理",label:"",href:"/user/manage",icon:e.jsx(ni,{size:18})},{title:"工单管理",label:"",href:"/user/ticket",icon:e.jsx(dn,{size:18})}]}];function fc({className:s,isCollapsed:t,setIsCollapsed:a}){const[n,l]=c.useState(!1);return c.useEffect(()=>{n?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[n]),e.jsxs("aside",{className:y(`fixed left-0 right-0 top-0 z-50 w-full border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${t?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>l(!1),className:`absolute inset-0 transition-[opacity] delay-100 duration-700 ${n?"h-svh opacity-50":"h-0 opacity-0"} w-full bg-black md:hidden`}),e.jsxs(ye,{children:[e.jsxs(Ne,{className:"sticky top-0 justify-between px-4 py-3 shadow md:px-4",children:[e.jsxs("div",{className:`flex items-center ${t?"":"gap-2"}`,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:`transition-all ${t?"h-6 w-6":"h-8 w-8"}`,children:[e.jsx("rect",{width:"256",height:"256",fill:"none"}),e.jsx("line",{x1:"208",y1:"128",x2:"128",y2:"208",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("line",{x1:"192",y1:"40",x2:"40",y2:"192",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("span",{className:"sr-only",children:"Website Name"})]}),e.jsx("div",{className:`flex flex-col justify-end truncate ${t?"invisible w-0":"visible w-auto"}`,children:e.jsx("span",{className:"font-medium",children:window?.settings?.title})})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Toggle Navigation","aria-controls":"sidebar-menu","aria-expanded":n,onClick:()=>l(o=>!o),children:n?e.jsx(ri,{}):e.jsx(li,{})})]}),e.jsx(mc,{id:"sidebar-menu",className:`h-full flex-1 overflow-auto ${n?"max-h-screen":"max-h-0 py-0 md:max-h-screen md:py-2"}`,closeNav:()=>l(!1),isCollapsed:t,links:cr}),e.jsx(D,{onClick:()=>a(o=>!o),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex",children:e.jsx(ii,{stroke:1.5,className:`h-5 w-5 ${t?"rotate-180":""}`})})]})]})}function pc(){const[s,t]=ir({key:"collapsed-sidebar",defaultValue:!1});return c.useEffect(()=>{const a=()=>{t(window.innerWidth<768?!1:s)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[s,t]),[s,t]}function vc(){const[s,t]=pc();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(fc,{isCollapsed:s,setIsCollapsed:t}),e.jsx("main",{id:"content",className:`overflow-x-hidden pt-16 transition-[margin] md:overflow-y-hidden md:pt-0 ${s?"md:ml-14":"md:ml-64"} h-full`,children:e.jsx(Qt,{})})]})}const bc=Object.freeze(Object.defineProperty({__proto__:null,default:vc},Symbol.toStringTag,{value:"Module"})),fs=c.forwardRef(({className:s,...t},a)=>e.jsx(we,{ref:a,className:y("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...t}));fs.displayName=we.displayName;const yc=({children:s,...t})=>e.jsx(ue,{...t,children:e.jsx(ce,{className:"overflow-hidden p-0",children:e.jsx(fs,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:s})})}),Ds=c.forwardRef(({className:s,...t},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(oi,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(we.Input,{ref:a,className:y("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",s),...t})]}));Ds.displayName=we.Input.displayName;const ps=c.forwardRef(({className:s,...t},a)=>e.jsx(we.List,{ref:a,className:y("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...t}));ps.displayName=we.List.displayName;const Ts=c.forwardRef((s,t)=>e.jsx(we.Empty,{ref:t,className:"py-6 text-center text-sm",...s}));Ts.displayName=we.Empty.displayName;const Ve=c.forwardRef(({className:s,...t},a)=>e.jsx(we.Group,{ref:a,className:y("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",s),...t}));Ve.displayName=we.Group.displayName;const As=c.forwardRef(({className:s,...t},a)=>e.jsx(we.Separator,{ref:a,className:y("-mx-1 h-px bg-border",s),...t}));As.displayName=we.Separator.displayName;const be=c.forwardRef(({className:s,...t},a)=>e.jsx(we.Item,{ref:a,className:y("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...t}));be.displayName=we.Item.displayName;function Nc(){const s=[];for(const t of cr)if(t.href&&s.push(t),t.sub)for(const a of t.sub)s.push({...a,parent:t.title});return s}function ke(){const[s,t]=c.useState(!1),a=ns(),n=Nc();c.useEffect(()=>{const o=d=>{d.key==="k"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),t(x=>!x))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[]);const l=c.useCallback(o=>{t(!1),a(o)},[a]);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-10 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>t(!0),children:[e.jsx(ci,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:"搜索..."}),e.jsx("span",{className:"sr-only",children:"搜索"}),e.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-2 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsxs(yc,{open:s,onOpenChange:t,children:[e.jsx(Ds,{placeholder:"搜索所有菜单和功能..."}),e.jsxs(ps,{children:[e.jsx(Ts,{children:"未找到相关结果"}),e.jsx(Ve,{heading:"菜单导航",children:n.map(o=>e.jsxs(be,{value:`${o.parent?o.parent+" ":""}${o.title}`,onSelect:()=>l(o.href),children:[e.jsx("div",{className:"mr-2",children:o.icon}),e.jsx("span",{children:o.title}),o.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:o.parent})]},o.href))})]})]})]})}function De(){const{theme:s,setTheme:t}=ko();return c.useEffect(()=>{const a=s==="dark"?"#020817":"#fff",n=document.querySelector("meta[name='theme-color']");n&&n.setAttribute("content",a)},[s]),e.jsx(D,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>t(s==="light"?"dark":"light"),children:s==="light"?e.jsx(di,{size:20}):e.jsx(ui,{size:20})})}const dr=c.forwardRef(({className:s,...t},a)=>e.jsx(un,{ref:a,className:y("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...t}));dr.displayName=un.displayName;const ur=c.forwardRef(({className:s,...t},a)=>e.jsx(xn,{ref:a,className:y("aspect-square h-full w-full",s),...t}));ur.displayName=xn.displayName;const xr=c.forwardRef(({className:s,...t},a)=>e.jsx(mn,{ref:a,className:y("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...t}));xr.displayName=mn.displayName;function Te(){const s=ns(),t=Ua(),a=xi(Go),n=()=>{Jn(),t(Bo()),s("/sign-in")},l=a?.email?.split("@")[0]||"User",o=l.substring(0,2).toUpperCase();return e.jsxs(Ns,{children:[e.jsx(ws,{asChild:!0,children:e.jsx(D,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(dr,{className:"h-8 w-8",children:[e.jsx(ur,{src:a?.avatar_url,alt:l}),e.jsx(xr,{children:o})]})})}),e.jsxs(gs,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(na,{className:"font-normal",children:e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:l}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:a?.email||"user@example.com"})]})}),e.jsx(Xs,{}),e.jsx(he,{asChild:!0,children:e.jsxs(Ss,{to:"/config/system",children:["设置",e.jsx(Bt,{children:"⌘S"})]})}),e.jsx(Xs,{}),e.jsxs(he,{onClick:n,children:["退出登录",e.jsx(Bt,{children:"⇧⌘Q"})]})]})]})}const We=window?.settings?.secure_path,mr=5*60*1e3,Gt=new Map,wc=s=>{const t=Gt.get(s);return t?Date.now()-t.timestamp>mr?(Gt.delete(s),null):t.data:null},_c=(s,t)=>{Gt.set(s,{data:t,timestamp:Date.now()})},Cc=async(s,t=mr)=>{const a=wc(s);if(a)return a;const n=await V.get(s);return _c(s,n),n},Sc={getList:()=>Cc(`${We}/notice/fetch`),save:s=>V.post(`${We}/notice/save`,s),drop:s=>V.post(`${We}/notice/drop`,{id:s}),updateStatus:s=>V.post(`${We}/notice/show`,{id:s}),sort:s=>V.post(`${We}/notice/sort`,{ids:s})},Ea={getSystemStatus:()=>V.get(`${We}/system/getSystemStatus`),getQueueStats:()=>V.get(`${We}/system/getQueueStats`),getQueueWorkload:()=>V.get(`${We}/system/getQueueWorkload`),getQueueMasters:()=>V.get(`${We}/system/getQueueMasters`),getSystemLog:s=>V.get(`${We}/system/getSystemLog`,{params:s})},M=window?.settings?.secure_path,kc=s=>V.get(M+"/stat/getOrder",{params:s}),Dc=()=>V.get(M+"/stat/getStats"),Fa=s=>V.get(M+"/stat/getTrafficRank",{params:s}),Tc=()=>V.get(M+"/theme/getThemes"),Pc=s=>V.post(M+"/theme/getThemeConfig",{name:s}),Ic=(s,t)=>V.post(M+"/theme/saveThemeConfig",{name:s,config:t}),Vc=s=>{const t=new FormData;return t.append("file",s),V.post(M+"/theme/upload",t,{headers:{"Content-Type":"multipart/form-data"}})},Rc=s=>V.post(M+"/theme/delete",{name:s}),Ec=s=>V.post(M+"/config/save",s),hr=()=>V.get(M+"/server/manage/getNodes"),Fc=s=>V.post(M+"/server/manage/save",s),Mc=s=>V.post(M+"/server/manage/drop",s),zc=s=>V.post(M+"/server/manage/copy",s),Oc=s=>V.post(M+"/server/manage/update",s),Lc=s=>V.post(M+"/server/manage/sort",s),Vt=()=>V.get(M+"/server/group/fetch"),$c=s=>V.post(M+"/server/group/save",s),Ac=s=>V.post(M+"/server/group/drop",s),jr=()=>V.get(M+"/server/route/fetch"),Hc=s=>V.post(M+"/server/route/save",s),Kc=s=>V.post(M+"/server/route/drop",s),qc=()=>V.get(M+"/payment/fetch"),Uc=()=>V.get(M+"/payment/getPaymentMethods"),Bc=s=>V.post(M+"/payment/getPaymentForm",s),Gc=s=>V.post(M+"/payment/save",s),Yc=s=>V.post(M+"/payment/drop",s),Wc=s=>V.post(M+"/payment/show",s),Jc=s=>V.post(M+"/payment/sort",s),Qc=()=>V.get(M+"/notice/fetch"),Zc=s=>V.post(M+"/notice/save",s),Xc=s=>V.post(M+"/notice/drop",s),ed=s=>V.post(M+"/notice/show",s),sd=()=>V.get(M+"/knowledge/fetch"),td=s=>V.get(M+"/knowledge/fetch?id="+s),ad=s=>V.post(M+"/knowledge/save",s),nd=s=>V.post(M+"/knowledge/drop",s),rd=s=>V.post(M+"/knowledge/show",s),ld=s=>V.post(M+"/knowledge/sort",s),Ps=()=>V.get(M+"/plan/fetch"),id=s=>V.post(M+"/plan/save",s),zt=s=>V.post(M+"/plan/update",s),od=s=>V.post(M+"/plan/drop",s),cd=s=>V.post(M+"/plan/sort",{ids:s}),gr=async s=>V.post(M+"/order/fetch",s),dd=s=>V.post(M+"/order/detail",s),ud=s=>V.post(M+"/order/paid",s),xd=s=>V.post(M+"/order/cancel",s),Ma=s=>V.post(M+"/order/update",s),md=s=>V.post(M+"/order/assign",s),hd=s=>V.post(M+"/coupon/fetch",s),jd=s=>V.post(M+"/coupon/generate",s),gd=s=>V.post(M+"/coupon/drop",s),fd=s=>V.post(M+"/coupon/update",s),pd=s=>V.post(M+"/user/fetch",s),vd=s=>V.post(M+"/user/update",s),bd=s=>V.post(M+"/user/resetSecret",s),yd=s=>V.post(M+"/user/generate",s),Nd=s=>V.post(M+"/stat/getStatUser",s),fr=s=>V.post(M+"/ticket/fetch",s),wd=s=>V.get(M+"/ticket/fetch?id= "+s),_d=s=>V.post(M+"/ticket/reply",s),pr=s=>V.post(M+"/ticket/close",{id:s}),os=(s="")=>V.get(M+"/config/fetch?key="+s),cs=s=>V.post(M+"/config/save",s),Cd=()=>V.get(M+"/config/getEmailTemplate"),Sd=()=>V.post(M+"/config/testSendMail"),kd=()=>V.post(M+"/config/setTelegramWebhook"),Dd=Sc.sort,vr=mi,ra=c.forwardRef(({className:s,...t},a)=>e.jsx(hn,{ref:a,className:y("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...t}));ra.displayName=hn.displayName;const et=c.forwardRef(({className:s,...t},a)=>e.jsx(jn,{ref:a,className:y("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",s),...t}));et.displayName=jn.displayName;const Td=c.forwardRef(({className:s,...t},a)=>e.jsx(gn,{ref:a,className:y("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...t}));Td.displayName=gn.displayName;const G=hi,xs=Ni,Y=ji,U=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(fn,{ref:n,className:y("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...a,children:[t,e.jsx(gi,{asChild:!0,children:e.jsx(ea,{className:"h-4 w-4 opacity-50"})})]}));U.displayName=fn.displayName;const br=c.forwardRef(({className:s,...t},a)=>e.jsx(pn,{ref:a,className:y("flex cursor-default items-center justify-center py-1",s),...t,children:e.jsx(fi,{className:"h-4 w-4"})}));br.displayName=pn.displayName;const yr=c.forwardRef(({className:s,...t},a)=>e.jsx(vn,{ref:a,className:y("flex cursor-default items-center justify-center py-1",s),...t,children:e.jsx(ea,{className:"h-4 w-4"})}));yr.displayName=vn.displayName;const B=c.forwardRef(({className:s,children:t,position:a="popper",...n},l)=>e.jsx(pi,{children:e.jsxs(bn,{ref:l,className:y("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:a,...n,children:[e.jsx(br,{}),e.jsx(vi,{className:y("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),e.jsx(yr,{})]})}));B.displayName=bn.displayName;const Pd=c.forwardRef(({className:s,...t},a)=>e.jsx(yn,{ref:a,className:y("px-2 py-1.5 text-sm font-semibold",s),...t}));Pd.displayName=yn.displayName;const O=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(Nn,{ref:n,className:y("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(bi,{children:e.jsx(Cs,{className:"h-4 w-4"})})}),e.jsx(yi,{children:t})]}));O.displayName=Nn.displayName;const Id=c.forwardRef(({className:s,...t},a)=>e.jsx(wn,{ref:a,className:y("-mx-1 my-1 h-px bg-muted",s),...t}));Id.displayName=wn.displayName;function Is({className:s,classNames:t,showOutsideDays:a=!0,...n}){return e.jsx(wi,{showOutsideDays:a,className:y("p-3",s),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:y(Ls({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:y("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:y(Ls({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({className:l,...o})=>e.jsx(_n,{className:y("h-4 w-4",l),...o}),IconRight:({className:l,...o})=>e.jsx(Xt,{className:y("h-4 w-4",l),...o})},...n})}Is.displayName="Calendar";const Ze=Ci,Xe=Si,Be=c.forwardRef(({className:s,align:t="center",sideOffset:a=4,...n},l)=>e.jsx(_i,{children:e.jsx(Cn,{ref:l,align:t,sideOffset:a,className:y("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...n})}));Be.displayName=Cn.displayName;const ms={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},Ys=s=>(s/100).toFixed(2),Vd=({active:s,payload:t,label:a})=>s&&t&&t.length?e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-sm",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:a}),t.map((n,l)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:n.color}}),e.jsxs("span",{className:"text-muted-foreground",children:[n.name,":"]}),e.jsx("span",{className:"font-medium",children:n.name.includes("金额")?`¥${Ys(n.value)}`:`${n.value}笔`})]},l))]}):null,Rd=[{value:"7d",label:"最近7天"},{value:"30d",label:"最近30天"},{value:"90d",label:"最近90天"},{value:"180d",label:"最近180天"},{value:"365d",label:"最近一年"},{value:"custom",label:"自定义范围"}],Ed=(s,t)=>{const a=new Date;if(s==="custom"&&t)return{startDate:t.from,endDate:t.to};let n;switch(s){case"7d":n=He(a,7);break;case"30d":n=He(a,30);break;case"90d":n=He(a,90);break;case"180d":n=He(a,180);break;case"365d":n=He(a,365);break;default:n=He(a,30)}return{startDate:n,endDate:a}};function Fd(){const[s,t]=c.useState("amount"),[a,n]=c.useState("30d"),[l,o]=c.useState({from:He(new Date,7),to:new Date}),{startDate:d,endDate:x}=Ed(a,l),{data:r}=Q({queryKey:["orderStat",{start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:i}=await kc({start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")});return i},refetchInterval:3e4});return e.jsxs(Ie,{children:[e.jsxs(ze,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Qe,{children:"收入趋势"}),e.jsx(Zs,{children:`${r?.summary.start_date||""} 至 ${r?.summary.end_date||""}`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsxs(G,{value:a,onValueChange:i=>n(i),children:[e.jsx(U,{className:"w-[120px]",children:e.jsx(Y,{placeholder:"选择时间范围"})}),e.jsx(B,{children:Rd.map(i=>e.jsx(O,{value:i.value,children:i.label},i.value))})]}),a==="custom"&&e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(W,{variant:"outline",className:y("min-w-0 justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(rt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:l?.from?l.to?e.jsxs(e.Fragment,{children:[Pe(l.from,"yyyy-MM-dd")," -"," ",Pe(l.to,"yyyy-MM-dd")]}):Pe(l.from,"yyyy-MM-dd"):e.jsx("span",{children:"选择日期范围"})})]})}),e.jsx(Be,{className:"w-auto p-0",align:"end",children:e.jsx(Is,{mode:"range",defaultMonth:l?.from,selected:{from:l?.from,to:l?.to},onSelect:i=>{i?.from&&i?.to&&o({from:i.from,to:i.to})},numberOfMonths:2})})]})]}),e.jsx(vr,{value:s,onValueChange:i=>t(i),children:e.jsxs(ra,{children:[e.jsx(et,{value:"amount",children:"金额"}),e.jsx(et,{value:"count",children:"笔数"})]})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总收入"}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Ys(r?.summary?.paid_total||0)]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["共 ",r?.summary?.paid_count||0," 笔"]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["平均订单金额 ¥",Ys(r?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总佣金"}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Ys(r?.summary?.commission_total||0)]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["共 ",r?.summary?.commission_count||0," 笔"]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["佣金比率 ",r?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]})]}),e.jsx(Oe,{children:e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(ki,{width:"100%",height:"100%",children:e.jsxs(Di,{data:r?.list||[],margin:{top:20,right:20,left:0,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"incomeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:ms.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:ms.income.gradient.end,stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"commissionGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:ms.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:ms.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(Ti,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>Pe(new Date(i),"MM-dd",{locale:Ri})}),e.jsx(Pi,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>s==="amount"?`¥${Ys(i)}`:`${i}笔`}),e.jsx(Ii,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(Vi,{content:e.jsx(Vd,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(Na,{type:"monotone",dataKey:"paid_total",name:"收款金额",stroke:ms.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(Na,{type:"monotone",dataKey:"commission_total",name:"佣金金额",stroke:ms.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(wa,{dataKey:"paid_count",name:"收款笔数",fill:ms.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(wa,{dataKey:"commission_count",name:"佣金笔数",fill:ms.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})})]})}var me=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.CANCELLED=2]="CANCELLED",s[s.COMPLETED=3]="COMPLETED",s[s.DISCOUNTED=4]="DISCOUNTED",s))(me||{});const Es={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},Bs={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var as=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(as||{});const Nr={1:"新购",2:"续费",3:"升级",4:"流量重置"};var fe=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(fe||{});const ct={0:"待确认",1:"发放中",2:"有效",3:"无效"},dt={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var ne=(s=>(s.MONTH_PRICE="month_price",s.QUARTER_PRICE="quarter_price",s.HALF_YEAR_PRICE="half_year_price",s.YEAR_PRICE="year_price",s.TWO_YEAR_PRICE="two_year_price",s.THREE_YEAR_PRICE="three_year_price",s.ONETIME_PRICE="onetime_price",s.RESET_PRICE="reset_price",s))(ne||{});const st={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var pe=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s))(pe||{});const ys=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"}],ts={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a"};var Rt=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(Rt||{});const la={1:"按金额优惠",2:"按比例优惠"},Md={0:"正常",1:"锁定"};var Ms=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(Ms||{});const zd={0:"开启",1:"已关闭"};var ss=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(ss||{});const Js={0:"低",1:"中",2:"高"};function Od(){const s=ns(),{data:t}=Q({queryKey:["pendingTickets"],queryFn:()=>fr({filter:[{id:"status",value:0}],pageSize:999}),staleTime:1e3*30,refetchInterval:1e3*30}),{data:a}=Q({queryKey:["pendingCommissions"],queryFn:()=>gr({filter:[{id:"commission_status",value:fe.PENDING},{id:"status",value:me.COMPLETED},{id:"commission_balance",value:"gt:0"}]}),staleTime:1e3*30,refetchInterval:1e3*30}),n=t?.data||[],l=a?.data||[],o=()=>{const d=new URLSearchParams;d.set("commission_status",fe.PENDING.toString()),d.set("status",me.COMPLETED.toString()),d.set("commission_balance","gt:0"),d.set("page_size","999"),s(`/finance/order?${d.toString()}`)};return e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(Ie,{className:`cursor-pointer transition-colors hover:bg-muted/50 ${n.length>0?"border-orange-500/50":""}`,onClick:()=>s("/user/ticket"),children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Qe,{className:"text-sm font-medium",children:"待处理工单"}),e.jsx(Ei,{className:`h-4 w-4 ${n.length>0?"text-orange-500":"text-muted-foreground"}`})]}),e.jsxs(Oe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n.length>0?"有待处理的工单需要关注":"暂无待处理工单"})]})]}),e.jsxs(Ie,{className:`cursor-pointer transition-colors hover:bg-muted/50 ${l.length>0?"border-blue-500/50":""}`,onClick:o,children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Qe,{className:"text-sm font-medium",children:"待处理佣金"}),e.jsx(Fi,{className:`h-4 w-4 ${l.length>0?"text-blue-500":"text-muted-foreground"}`})]}),e.jsxs(Oe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.length>0?"有待处理的佣金需要确认":"暂无待处理佣金"})]})]})]})}function Fe({className:s,...t}){return e.jsx("div",{className:y("animate-pulse rounded-md bg-primary/10",s),...t})}function Ld(){return e.jsxs(Ie,{children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Fe,{className:"h-4 w-[100px]"}),e.jsx(Fe,{className:"h-4 w-4"})]}),e.jsxs(Oe,{children:[e.jsx(Fe,{className:"h-8 w-[120px]"}),e.jsx("div",{className:"flex items-center pt-1",children:e.jsx(Fe,{className:"h-4 w-[100px]"})})]})]})}function $d(){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((s,t)=>e.jsx(Ld,{},t))})}function ut({title:s,value:t,icon:a,trend:n,className:l}){return e.jsxs(Ie,{className:y("transition-colors hover:border-primary/50",l),children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Qe,{className:"text-sm font-medium",children:s}),a]}),e.jsxs(Oe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:t}),e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(Li,{className:y("h-4 w-4",n.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:y("ml-1 text-xs",n.isPositive?"text-emerald-500":"text-red-500"),children:[n.isPositive?"+":"-",Math.abs(n.value),"%"]}),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:n.label})]})]})]})}function Ad({className:s}){const{data:t,isLoading:a}=Q({queryKey:["dashboardStats"],queryFn:async()=>(await Dc()).data,refetchInterval:3e5});return a||!t?e.jsx($d,{}):e.jsxs("div",{className:y("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx(ut,{title:"今日收入",value:hs(t.todayIncome),icon:e.jsx(Mi,{className:"h-4 w-4 text-emerald-500"}),trend:{value:t.dayIncomeGrowth,label:"vs 昨日",isPositive:t.dayIncomeGrowth>0}}),e.jsx(ut,{title:"本月收入",value:hs(t.currentMonthIncome),icon:e.jsx(zi,{className:"h-4 w-4 text-blue-500"}),trend:{value:t.monthIncomeGrowth,label:"vs 上月",isPositive:t.monthIncomeGrowth>0}}),e.jsx(ut,{title:"上月佣金支出",value:hs(t.lastMonthCommissionPayout),icon:e.jsx(Oi,{className:"h-4 w-4 text-destructive"}),trend:{value:t.commissionGrowth,label:"vs 上上月",isPositive:t.commissionGrowth>0}}),e.jsx(ut,{title:"本月新增用户",value:t.currentMonthNewUsers,icon:e.jsx(Sn,{className:"h-4 w-4 text-blue-500"}),trend:{value:t.userGrowth,label:"vs 上月",isPositive:t.userGrowth>0}})]})}const tt=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(kn,{ref:n,className:y("relative overflow-hidden",s),...a,children:[e.jsx($i,{className:"h-full w-full rounded-[inherit]",children:t}),e.jsx(wt,{}),e.jsx(Ai,{})]}));tt.displayName=kn.displayName;const wt=c.forwardRef(({className:s,orientation:t="vertical",...a},n)=>e.jsx(Dn,{ref:n,orientation:t,className:y("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s),...a,children:e.jsx(Hi,{className:"relative flex-1 rounded-full bg-border"})}));wt.displayName=Dn.displayName;const Yt={today:{label:"今天",getValue:()=>{const s=qi();return{start:s,end:Ui(s,1)}}},last7days:{label:"最近7天",getValue:()=>{const s=new Date;return{start:He(s,7),end:s}}},last30days:{label:"最近30天",getValue:()=>{const s=new Date;return{start:He(s,30),end:s}}},custom:{label:"自定义范围",getValue:()=>null}};function za({selectedRange:s,customDateRange:t,onRangeChange:a,onCustomRangeChange:n}){return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.jsxs(G,{value:s,onValueChange:a,children:[e.jsx(U,{className:"w-[120px]",children:e.jsx(Y,{placeholder:"选择时间范围"})}),e.jsx(B,{position:"popper",className:"z-50",children:Object.entries(Yt).map(([l,{label:o}])=>e.jsx(O,{value:l,children:o},l))})]}),s==="custom"&&e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(W,{variant:"outline",className:y("min-w-0 justify-start text-left font-normal",!t&&"text-muted-foreground"),children:[e.jsx(rt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:t?.from?t.to?e.jsxs(e.Fragment,{children:[Pe(t.from,"yyyy-MM-dd")," -"," ",Pe(t.to,"yyyy-MM-dd")]}):Pe(t.from,"yyyy-MM-dd"):e.jsx("span",{children:"选择日期范围"})})]})}),e.jsx(Be,{className:"w-auto p-0",align:"end",children:e.jsx(Is,{mode:"range",defaultMonth:t?.from,selected:{from:t?.from,to:t?.to},onSelect:l=>{l?.from&&l?.to&&n({from:l.from,to:l.to})},numberOfMonths:2})})]})]})}const Rs=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Hd({className:s}){const[t,a]=c.useState("today"),[n,l]=c.useState({from:He(new Date,7),to:new Date}),[o,d]=c.useState("today"),[x,r]=c.useState({from:He(new Date,7),to:new Date}),i=c.useMemo(()=>t==="custom"?{start:n.from,end:n.to}:Yt[t].getValue(),[t,n]),h=c.useMemo(()=>o==="custom"?{start:x.from,end:x.to}:Yt[o].getValue(),[o,x]),{data:T}=Q({queryKey:["nodeTrafficRank",i.start,i.end],queryFn:()=>Fa({type:"node",start_time:de.round(i.start.getTime()/1e3),end_time:de.round(i.end.getTime()/1e3)}),refetchInterval:3e4}),{data:C}=Q({queryKey:["userTrafficRank",h.start,h.end],queryFn:()=>Fa({type:"user",start_time:de.round(h.start.getTime()/1e3),end_time:de.round(h.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:y("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(Ie,{children:[e.jsx(ze,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Qe,{className:"flex items-center text-base font-medium",children:[e.jsx(Ki,{className:"mr-2 h-4 w-4"}),"节点流量排行"]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(za,{selectedRange:t,customDateRange:n,onRangeChange:a,onCustomRangeChange:l}),e.jsx(_a,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Oe,{className:"flex-1",children:T?.data?e.jsxs(tt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:T.data.map(m=>e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:m.name}),e.jsxs("span",{className:y("ml-2 flex items-center text-xs font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?e.jsx(At,{className:"mr-1 h-3 w-3"}):e.jsx(Ht,{className:"mr-1 h-3 w-3"}),Math.abs(m.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${m.value/T.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Rs(m.value)})]})]})})}),e.jsx(ee,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"当前流量:"}),e.jsx("span",{className:"font-medium",children:Rs(m.value)}),e.jsx("span",{className:"text-muted-foreground",children:"上期流量:"}),e.jsx("span",{className:"font-medium",children:Rs(m.previousValue)}),e.jsx("span",{className:"text-muted-foreground",children:"变化率:"}),e.jsxs("span",{className:y("font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?"+":"",m.change,"%"]}),e.jsx("span",{className:"text-muted-foreground",children:"记录时间:"}),e.jsx("span",{className:"font-medium",children:Pe(new Date(m.timestamp),"yyyy-MM-dd HH:mm")})]})})]})},m.id))}),e.jsx(wt,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:"Loading..."})})})]}),e.jsxs(Ie,{children:[e.jsx(ze,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Qe,{className:"flex items-center text-base font-medium",children:[e.jsx(Sn,{className:"mr-2 h-4 w-4"}),"用户流量排行"]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(za,{selectedRange:o,customDateRange:x,onRangeChange:d,onCustomRangeChange:r}),e.jsx(_a,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Oe,{className:"flex-1",children:C?.data?e.jsxs(tt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:C.data.map(m=>e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:m.name}),e.jsxs("span",{className:y("ml-2 flex items-center text-xs font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?e.jsx(At,{className:"mr-1 h-3 w-3"}):e.jsx(Ht,{className:"mr-1 h-3 w-3"}),Math.abs(m.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${m.value/C.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Rs(m.value)})]})]})})}),e.jsx(ee,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"当前流量:"}),e.jsx("span",{className:"font-medium",children:Rs(m.value)}),e.jsx("span",{className:"text-muted-foreground",children:"上期流量:"}),e.jsx("span",{className:"font-medium",children:Rs(m.previousValue)}),e.jsx("span",{className:"text-muted-foreground",children:"变化率:"}),e.jsxs("span",{className:y("font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?"+":"",m.change,"%"]}),e.jsx("span",{className:"text-muted-foreground",children:"记录时间:"}),e.jsx("span",{className:"font-medium",children:Pe(new Date(m.timestamp),"yyyy-MM-dd HH:mm")})]})})]})},m.id))}),e.jsx(wt,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:"Loading..."})})})]})]})}const Kd=_s("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/10",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function L({className:s,variant:t,...a}){return e.jsx("div",{className:y(Kd({variant:t}),s),...a})}const pt=c.forwardRef(({className:s,value:t,...a},n)=>e.jsx(Tn,{ref:n,className:y("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...a,children:e.jsx(Bi,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));pt.displayName=Tn.displayName;function qd(){const[s,t]=c.useState(null),[a,n]=c.useState(null),[l,o]=c.useState(!0),[d,x]=c.useState(!1),r=async()=>{try{x(!0);const[T,C]=await Promise.all([Ea.getSystemStatus(),Ea.getQueueStats()]);t(T.data),n(C.data)}catch(T){console.error("Error fetching system data:",T)}finally{o(!1),x(!1)}};c.useEffect(()=>{r();const T=setInterval(r,3e4);return()=>clearInterval(T)},[]);const i=()=>{r()};if(l)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(sa,{className:"h-6 w-6 animate-spin"})});const h=T=>T?e.jsx(Pn,{className:"h-5 w-5 text-green-500"}):e.jsx(In,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ie,{children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Qe,{className:"flex items-center gap-2",children:[e.jsx(Gi,{className:"h-5 w-5"}),"队列状态"]}),e.jsx(Zs,{children:"当前队列运行状态"})]}),e.jsx(W,{variant:"outline",size:"icon",onClick:i,disabled:d,children:e.jsx(Yi,{className:y("h-4 w-4",d&&"animate-spin")})})]}),e.jsx(Oe,{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:[h(a?.status||!1),e.jsx("span",{className:"font-medium",children:"运行状态"})]}),e.jsx(L,{variant:a?.status?"secondary":"destructive",children:a?.status?"正常":"异常"})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前等待时间:",a?.wait?.default||0," 秒"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{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:"近期任务数"}),e.jsx("p",{className:"text-2xl font-bold",children:a?.recentJobs||0}),e.jsx(pt,{value:(a?.recentJobs||0)/(a?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ee,{children:e.jsxs("p",{children:["统计时间范围: ",a?.periods?.recentJobs||0," 小时"]})})]})}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{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:"每分钟处理量"}),e.jsx("p",{className:"text-2xl font-bold",children:a?.jobsPerMinute||0}),e.jsx(pt,{value:(a?.jobsPerMinute||0)/(a?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ee,{children:e.jsxs("p",{children:["最高吞吐量:"," ",a?.queueWithMaxThroughput?.throughput||0]})})]})})]})]})})]}),e.jsxs(Ie,{children:[e.jsxs(ze,{children:[e.jsxs(Qe,{className:"flex items-center gap-2",children:[e.jsx(Wi,{className:"h-5 w-5"}),"作业详情"]}),e.jsx(Zs,{children:"队列处理详细信息"})]}),e.jsx(Oe,{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:"7日报错数量"}),e.jsx("p",{className:"text-2xl font-bold text-destructive",children:a?.failedJobs||0}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["保留 ",a?.periods?.failedJobs||0," 小时"]})]}),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:"最长运行队列"}),e.jsxs("p",{className:"text-2xl font-bold",children:[a?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a?.queueWithMaxRuntime?.name||"N/A"})]})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"活跃进程"}),e.jsxs("span",{className:"font-medium",children:[a?.processes||0," /"," ",(a?.processes||0)+(a?.pausedMasters||0)]})]}),e.jsx(pt,{value:(a?.processes||0)/((a?.processes||0)+(a?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]})}function Ud(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:"仪表盘"})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ke,{}),e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsx(_e,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"border-b pb-6",children:e.jsx(Od,{})}),e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Ad,{}),e.jsx(Fd,{}),e.jsx(Hd,{}),e.jsx(qd,{})]})]})})]})}const Bd=Object.freeze(Object.defineProperty({__proto__:null,default:Ud},Symbol.toStringTag,{value:"Module"})),ge=c.forwardRef(({className:s,orientation:t="horizontal",decorative:a=!0,...n},l)=>e.jsx(Vn,{ref:l,decorative:a,orientation:t,className:y("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...n}));ge.displayName=Vn.displayName;function Gd({className:s,items:t,...a}){const{pathname:n}=Jt(),l=ns(),[o,d]=c.useState(n??"/settings"),x=r=>{d(r),l(r)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(G,{value:o,onValueChange:x,children:[e.jsx(U,{className:"h-12 sm:w-48",children:e.jsx(Y,{placeholder:"Theme"})}),e.jsx(B,{children:t.map(r=>e.jsx(O,{value:r.href,children:e.jsxs("div",{className:"flex gap-x-4 px-2 py-1",children:[e.jsx("span",{className:"scale-125",children:r.icon}),e.jsx("span",{className:"text-md",children:r.title})]})},r.href))})]})}),e.jsx("div",{className:"hidden w-full overflow-x-auto bg-background px-1 py-2 md:block",children:e.jsx("nav",{className:y("flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",s),...a,children:t.map(r=>e.jsxs(Ss,{to:r.href,className:y($s({variant:"ghost"}),n===r.href?"bg-muted hover:bg-muted":"hover:bg-transparent hover:underline","justify-start"),children:[e.jsx("span",{className:"mr-2",children:r.icon}),r.title]},r.href))})})]})}const wr=[{title:"站点设置",key:"site",icon:e.jsx(Ji,{size:18}),href:"/config/system",description:"配置站点基本信息,包括站点名称、描述、货币单位等核心设置。"},{title:"安全设置",key:"safe",icon:e.jsx(cn,{size:18}),href:"/config/system/safe",description:"配置系统安全相关选项,包括登录验证、密码策略、API访问等安全设置。"},{title:"订阅设置",key:"subscribe",icon:e.jsx(dn,{size:18}),href:"/config/system/subscribe",description:"管理用户订阅相关配置,包括订阅链接格式、更新频率、流量统计等设置。"},{title:"邀请&佣金",key:"invite",icon:e.jsx(Qi,{size:18}),href:"/config/system/invite",description:"管理用户邀请和佣金系统,配置邀请奖励、分销规则等。"},{title:"节点配置",key:"server",icon:e.jsx(on,{size:18}),href:"/config/system/server",description:"配置节点通信和同步设置,包括通信密钥、轮询间隔、负载均衡等高级选项。"},{title:"邮件设置",key:"email",icon:e.jsx(Zi,{size:18}),href:"/config/system/email",description:"配置系统邮件服务,用于发送验证码、密码重置、通知等邮件,支持多种SMTP服务商。"},{title:"Telegram设置",key:"telegram",icon:e.jsx(Xi,{size:18}),href:"/config/system/telegram",description:"配置Telegram机器人功能,实现用户通知、账户绑定、指令交互等自动化服务。"},{title:"APP设置",key:"app",icon:e.jsx(ln,{size:18}),href:"/config/system/app",description:"管理移动应用程序相关配置,包括API接口、版本控制、推送通知等功能设置。"}];function Yd(){return e.jsxs(ye,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:"系统设置"}),e.jsx("div",{className:"text-muted-foreground",children:"管理系统核心配置,包括站点、安全、订阅、邀请佣金、节点、邮件和通知等设置"})]}),e.jsx(ge,{className:"my-6"}),e.jsxs("div",{className:"flex flex-1 flex-col space-y-8 overflow-auto lg:flex-row lg:space-x-12 lg:space-y-0",children:[e.jsx("aside",{className:"sticky top-0 lg:w-1/5",children:e.jsx(Gd,{items:wr})}),e.jsx("div",{className:"w-full p-1 pr-4 lg:max-w-xl",children:e.jsx("div",{className:"pb-16",children:e.jsx(Qt,{})})})]})]})]})}const Wd=Object.freeze(Object.defineProperty({__proto__:null,default:Yd},Symbol.toStringTag,{value:"Module"}));function Jd({title:s,description:t,children:a}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t})]}),e.jsx(ge,{}),a]})}const H=c.forwardRef(({className:s,...t},a)=>e.jsx(Rn,{className:y("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...t,ref:a,children:e.jsx(eo,{className:y("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));H.displayName=Rn.displayName;const vs=c.forwardRef(({className:s,...t},a)=>e.jsx("textarea",{className:y("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...t}));vs.displayName="Textarea";const Qd=u.object({logo:u.string().nullable().default(""),force_https:u.number().nullable().default(0),stop_register:u.number().nullable().default(0),app_name:u.string().nullable().default(""),app_description:u.string().nullable().default(""),app_url:u.string().nullable().default(""),subscribe_url:u.string().nullable().default(""),try_out_plan_id:u.number().nullable().default(0),try_out_hour:u.coerce.number().nullable().default(0),tos_url:u.string().nullable().default(""),currency:u.string().nullable().default(""),currency_symbol:u.string().nullable().default("")});function Zd(){const[s,t]=c.useState(!1),a=c.useRef(null),{data:n}=Q({queryKey:["settings","site"],queryFn:()=>os("site")}),{data:l}=Q({queryKey:["plans"],queryFn:()=>Ps()}),o=ae({resolver:ie(Qd),defaultValues:{},mode:"onBlur"}),{mutateAsync:d}=Je({mutationFn:cs,onSuccess:i=>{i.data&&A.success("已自动保存")}});c.useEffect(()=>{if(n?.data?.site){const i=n?.data?.site;Object.entries(i).forEach(([h,T])=>{o.setValue(h,T)}),a.current=i}},[n]);const x=c.useCallback(de.debounce(async i=>{if(!de.isEqual(i,a.current)){t(!0);try{const h=Object.entries(i).reduce((T,[C,m])=>(T[C]=m===null?"":m,T),{});await d(h),a.current=i}finally{t(!1)}}},1e3),[d]),r=c.useCallback(i=>{x(i)},[x]);return c.useEffect(()=>{const i=o.watch(h=>{r(h)});return()=>i.unsubscribe()},[o.watch,r]),e.jsx(oe,{...o,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:o.control,name:"app_name",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"站点名称"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入站点名称",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于显示需要站点名称的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"app_description",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"站点描述"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入站点描述",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于显示需要站点描述的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"app_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"站点网址"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入站点URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"当前网站最新网址,将会在邮件等需要用于网址处体现。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"force_https",render:({field:i})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"强制HTTPS"}),e.jsx(F,{children:"当站点没有使用HTTPS,CDN或反代开启强制HTTPS时需要开启。"})]}),e.jsx(b,{children:e.jsx(H,{checked:!!i.value,onCheckedChange:h=>{i.onChange(Number(h)),r(o.getValues())}})})]})}),e.jsx(g,{control:o.control,name:"logo",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"LOGO"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入LOGO URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于显示需要LOGO的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"subscribe_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"订阅URL"}),e.jsx(b,{children:e.jsx(vs,{placeholder:"用于订阅所使用,多个订阅地址用','隔开.留空则为站点URL。",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于订阅所使用,留空则为站点URL。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"tos_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"用户条款(TOS)URL"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入用户条款URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于跳转到用户条款(TOS)"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"stop_register",render:({field:i})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"停止新用户注册"}),e.jsx(F,{children:"开启后任何人都将无法进行注册。"})]}),e.jsx(b,{children:e.jsx(H,{checked:!!i.value,onCheckedChange:h=>{i.onChange(Number(h)),r(o.getValues())}})})]})}),e.jsx(g,{control:o.control,name:"try_out_plan_id",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"注册试用"}),e.jsx(b,{children:e.jsxs(G,{value:i.value?.toString(),onValueChange:h=>{i.onChange(Number(h)),r(o.getValues())},children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"关闭"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"关闭"}),l?.data?.map(h=>e.jsx(O,{value:h.id.toString(),children:h.name},h.id.toString()))]})]})}),e.jsx(F,{children:"选择需要试用的订阅,如果没有选项请先前往订阅管理添加。"}),e.jsx(k,{})]})}),!!o.watch("try_out_plan_id")&&e.jsx(g,{control:o.control,name:"try_out_hour",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"",children:"注册试用时长"}),e.jsx(b,{children:e.jsx(S,{placeholder:"0",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"注册试用时长,单位为小时。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"currency",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"货币单位"}),e.jsx(b,{children:e.jsx(S,{placeholder:"CNY",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"仅用于展示使用,更改后系统中所有的货币单位都将发生变更。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"currency_symbol",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"货币符号"}),e.jsx(b,{children:e.jsx(S,{placeholder:"¥",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"仅用于展示使用,更改后系统中所有的货币单位都将发生变更。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Xd(){const s=wr.find(t=>t.key==="site");return e.jsx(Jd,{title:s.title,description:s.description,children:e.jsx(Zd,{})})}const eu=Object.freeze(Object.defineProperty({__proto__:null,default:Xd},Symbol.toStringTag,{value:"Module"})),su=u.object({email_verify:u.boolean().nullable(),safe_mode_enable:u.boolean().nullable(),secure_path:u.string().nullable(),email_whitelist_enable:u.boolean().nullable(),email_whitelist_suffix:u.array(u.string().nullable()).nullable(),email_gmail_limit_enable:u.boolean().nullable(),recaptcha_enable:u.boolean().nullable(),recaptcha_key:u.string().nullable(),recaptcha_site_key:u.string().nullable(),register_limit_by_ip_enable:u.boolean().nullable(),register_limit_count:u.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:u.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:u.boolean().nullable(),password_limit_count:u.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:u.coerce.string().transform(s=>s===""?null:s).nullable()}),tu={email_verify:!1,safe_mode_enable:!1,secure_path:"",email_whitelist_enable:!1,email_whitelist_suffix:[],email_gmail_limit_enable:!1,recaptcha_enable:!1,recaptcha_key:"",recaptcha_site_key:"",register_limit_by_ip_enable:!1,register_limit_count:"",register_limit_expire:"",password_limit_enable:!1,password_limit_count:"",password_limit_expire:""};function au(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(su),defaultValues:tu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","safe"],queryFn:()=>os("safe")}),{mutateAsync:o}=Je({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data.safe){const r=l.data.safe;Object.entries(r).forEach(([i,h])=>{typeof h=="number"?n.setValue(i,String(h)):n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"email_verify",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"邮箱验证"}),e.jsx(F,{children:"开启后将会强制要求用户进行邮箱验证。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"email_gmail_limit_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"禁止使用Gmail多别名"}),e.jsx(F,{children:"开启后Gmail多别名将无法注册。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"safe_mode_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"安全模式"}),e.jsx(F,{children:"开启后除了站点URL以外的绑定本站点的域名访问都将会被403。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"secure_path",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"后台路径"}),e.jsx(b,{children:e.jsx(S,{placeholder:"admin",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(F,{children:"后台管理路径,修改后将会改变原有的admin路径"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"email_whitelist_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"邮箱后缀白名单"}),e.jsx(F,{children:"开启后在名单中的邮箱后缀才允许进行注册。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("email_whitelist_enable")&&e.jsx(g,{control:n.control,name:"email_whitelist_suffix",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"白名单后缀"}),e.jsx(b,{children:e.jsx(vs,{placeholder:"请输入后缀域名,逗号分割 如:qq.com,gmail.com",value:r.value?.length?r.value.join(","):"",onChange:i=>{const h=i.target.value?i.target.value.split(","):[];r.onChange(h),x(n.getValues())}})}),e.jsx(F,{children:"请使用逗号进行分割,如:qq.com,gmail.com。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"recaptcha_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"防机器人"}),e.jsx(F,{children:"开启后将会使用Google reCAPTCHA防止机器人。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"recaptcha_key",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"密钥"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入密钥",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"recaptcha_site_key",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"站点密钥"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入站点密钥",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:n.control,name:"register_limit_by_ip_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"IP注册限制"}),e.jsx(F,{children:"开启后同一IP将会被限制注册次数。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"register_limit_count",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限制次数"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入限制次数",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"register_limit_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限制时长(分钟)"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入限制时长",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:n.control,name:"password_limit_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"密码错误限制"}),e.jsx(F,{children:"开启后密码错误将会被限制登录。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"password_limit_count",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限制次数"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入限制次数",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"password_limit_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限制时长(分钟)"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入限制时长",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function nu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"安全设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置系统安全相关选项,包括登录验证、密码策略、API访问等安全设置。"})]}),e.jsx(ge,{}),e.jsx(au,{})]})}const ru=Object.freeze(Object.defineProperty({__proto__:null,default:nu},Symbol.toStringTag,{value:"Module"})),lu=u.object({plan_change_enable:u.boolean().nullable().default(!1),reset_traffic_method:u.coerce.number().nullable().default(0),surplus_enable:u.boolean().nullable().default(!1),new_order_event_id:u.coerce.number().nullable().default(0),renew_order_event_id:u.coerce.number().nullable().default(0),change_order_event_id:u.coerce.number().nullable().default(0),show_info_to_server_enable:u.boolean().nullable().default(!1),show_protocol_to_server_enable:u.boolean().nullable().default(!1),default_remind_expire:u.boolean().nullable().default(!1),default_remind_traffic:u.boolean().nullable().default(!1),remind_mail_enable:u.boolean().nullable().default(!1),subscribe_path:u.string().nullable().default("s")}),iu={plan_change_enable:!1,reset_traffic_method:0,surplus_enable:!1,new_order_event_id:0,renew_order_event_id:0,change_order_event_id:0,show_info_to_server_enable:!1,show_protocol_to_server_enable:!1,default_remind_expire:!1,default_remind_traffic:!1,remind_mail_enable:!1,subscribe_path:"s"};function ou(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(lu),defaultValues:iu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","subscribe"],queryFn:()=>os("subscribe")}),{mutateAsync:o}=Je({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data?.subscribe){const r=l?.data?.subscribe;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"plan_change_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"允许用户更改订阅"}),e.jsx(F,{children:"开启后用户将会可以对订阅计划进行变更。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"reset_traffic_method",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"月流量重置方式"}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"每月1号"}),e.jsx(O,{value:"1",children:"按月重置"}),e.jsx(O,{value:"2",children:"不重置"}),e.jsx(O,{value:"3",children:"每年1月1号"}),e.jsx(O,{value:"4",children:"按年重置"})]})]})})}),e.jsx(F,{children:"全局流量重置方式,默认每月1号。可以在订阅管理为订阅单独设置。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"surplus_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"开启折抵方案"}),e.jsx(F,{children:"开启后用户更换订阅将会由系统对原有订阅进行折抵,方案参考文档。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"new_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"当订阅新购时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"不执行任何动作"}),e.jsx(O,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(F,{children:"新购订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"renew_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"当订阅续费时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"不执行任何动作"}),e.jsx(O,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(F,{children:"续费订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"change_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"当订阅变更时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"不执行任何动作"}),e.jsx(O,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(F,{children:"变更订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"subscribe_path",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"订阅路径"}),e.jsx(b,{children:e.jsx(S,{placeholder:"subscribe",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["订阅路径,修改后将会改变原有的subscribe路径",e.jsx("br",{}),"当前订阅路径格式:",r.value?`${r.value}/xxxxxxxxxx`:"s/xxxxxxxxxx"]}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"show_info_to_server_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"在订阅中展示订阅信息"}),e.jsx(F,{children:"开启后将会在用户订阅节点时输出订阅信息。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"show_protocol_to_server_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"在订阅中线路名称中显示协议名称"}),e.jsx(F,{children:"开启后订阅线路会附带协议名称(例如: [Hy2]香港)"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"remind_mail_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"邮件提醒"}),e.jsx(F,{children:"开启后用户订阅即将到期时和流量告急时时将发送邮件通知。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function cu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"订阅设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"管理用户订阅相关配置,包括订阅链接格式、更新频率、流量统计等设置。"})]}),e.jsx(ge,{}),e.jsx(ou,{})]})}const du=Object.freeze(Object.defineProperty({__proto__:null,default:cu},Symbol.toStringTag,{value:"Module"})),uu=u.object({invite_force:u.boolean().default(!1),invite_commission:u.coerce.string().default("0"),invite_gen_limit:u.coerce.string().default("0"),invite_never_expire:u.boolean().default(!1),commission_first_time_enable:u.boolean().default(!1),commission_auto_check_enable:u.boolean().default(!1),commission_withdraw_limit:u.coerce.string().default("0"),commission_withdraw_method:u.array(u.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:u.boolean().default(!1),commission_distribution_enable:u.boolean().default(!1),commission_distribution_l1:u.coerce.number().default(0),commission_distribution_l2:u.coerce.number().default(0),commission_distribution_l3:u.coerce.number().default(0)}),xu={invite_force:!1,invite_commission:"0",invite_gen_limit:"0",invite_never_expire:!1,commission_first_time_enable:!1,commission_auto_check_enable:!1,commission_withdraw_limit:"0",commission_withdraw_method:["支付宝","USDT","Paypal"],withdraw_close_enable:!1,commission_distribution_enable:!1,commission_distribution_l1:0,commission_distribution_l2:0,commission_distribution_l3:0};function mu(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(uu),defaultValues:xu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","invite"],queryFn:()=>os("invite")}),{mutateAsync:o}=Je({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data?.invite){const r=l?.data?.invite;Object.entries(r).forEach(([i,h])=>{typeof h=="number"?n.setValue(i,String(h)):n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"invite_force",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"开启强制邀请"}),e.jsx(F,{children:"开启后只有被邀请的用户才可以进行注册。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"invite_commission",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:" 邀请佣金百分比"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(F,{children:"默认全局的佣金分配比例,你可以在用户管理单独配置单个比例。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"invite_gen_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"用户可创建邀请码上限"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(F,{children:"用户可创建邀请码上限"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"invite_never_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"邀请码永不失效"}),e.jsx(F,{children:"开启后邀请码被使用后将不会失效,否则使用过后即失效。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_first_time_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"佣金仅首次发放"}),e.jsx(F,{children:"开启后被邀请人首次支付时才会产生佣金,可以在用户管理对用户进行单独配置。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_auto_check_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"佣金自动确认"}),e.jsx(F,{children:"开启后佣金将会在订单完成3日后自动进行确认。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_withdraw_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"提现单申请门槛(元)"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(F,{children:"小于门槛金额的提现单将不会被提交。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_withdraw_method",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"提现方式"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",...r,value:Array.isArray(r.value)?r.value.join(","):"",onChange:i=>{const h=i.target.value.split(",").filter(Boolean);r.onChange(h),x(n.getValues())}})}),e.jsx(F,{children:"可以支持的提现方式,多个用逗号分隔。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"withdraw_close_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"关闭提现"}),e.jsx(F,{children:"关闭后将禁止用户申请提现,且邀请佣金将会直接进入用户余额。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"三级分销"}),e.jsx(F,{children:"开启后将佣金将按照设置的3成比例进行分成,三成比例合计请不要大于100%。"})]}),e.jsx(b,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"commission_distribution_l1",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"一级邀请人比例"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_l2",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"二级邀请人比例"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_l3",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"三级邀请人比例"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function hu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"邀请&佣金设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"邀请注册、佣金相关设置。"})]}),e.jsx(ge,{}),e.jsx(mu,{})]})}const ju=Object.freeze(Object.defineProperty({__proto__:null,default:hu},Symbol.toStringTag,{value:"Module"})),gu=u.object({frontend_theme:u.string().nullable(),frontend_theme_sidebar:u.string().nullable(),frontend_theme_header:u.string().nullable(),frontend_theme_color:u.string().nullable(),frontend_background_url:u.string().url().nullable()}),fu={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function pu(){const{data:s}=Q({queryKey:["settings","frontend"],queryFn:()=>os("frontend")}),t=ae({resolver:ie(gu),defaultValues:fu,mode:"onChange"});c.useEffect(()=>{if(s?.data?.frontend){const n=s?.data?.frontend;Object.entries(n).forEach(([l,o])=>{t.setValue(l,o)})}},[s]);function a(n){cs(n).then(({data:l})=>{l&&A.success("更新成功")})}return e.jsx(oe,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(a),className:"space-y-8",children:[e.jsx(g,{control:t.control,name:"frontend_theme_sidebar",render:({field:n})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"边栏风格"}),e.jsx(F,{children:"边栏风格"})]}),e.jsx(b,{children:e.jsx(H,{checked:n.value,onCheckedChange:n.onChange})})]})}),e.jsx(g,{control:t.control,name:"frontend_theme_header",render:({field:n})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"头部风格"}),e.jsx(F,{children:"边栏风格"})]}),e.jsx(b,{children:e.jsx(H,{checked:n.value,onCheckedChange:n.onChange})})]})}),e.jsx(g,{control:t.control,name:"frontend_theme_color",render:({field:n})=>e.jsxs(j,{children:[e.jsx(p,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(b,{children:e.jsxs("select",{className:y($s({variant:"outline"}),"w-[200px] appearance-none font-normal"),...n,children:[e.jsx("option",{value:"default",children:"默认"}),e.jsx("option",{value:"black",children:"黑色"}),e.jsx("option",{value:"blackblue",children:"暗蓝色"}),e.jsx("option",{value:"green",children:"奶绿色"})]})}),e.jsx(ea,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(F,{children:"主题色"}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"frontend_background_url",render:({field:n})=>e.jsxs(j,{children:[e.jsx(p,{children:"背景"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入图片地址",...n})}),e.jsx(F,{children:"将会在后台登录页面进行展示。"}),e.jsx(k,{})]})}),e.jsx(D,{type:"submit",children:"保存设置"})]})})}function vu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"个性化设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自定义系统界面外观,包括主题风格、布局、颜色方案、背景图等个性化选项。"})]}),e.jsx(ge,{}),e.jsx(pu,{})]})}const bu=Object.freeze(Object.defineProperty({__proto__:null,default:vu},Symbol.toStringTag,{value:"Module"})),yu=u.object({server_pull_interval:u.coerce.number().nullable(),server_push_interval:u.coerce.number().nullable(),server_token:u.string().nullable(),device_limit_mode:u.coerce.number().nullable()}),Nu={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function wu(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(yu),defaultValues:Nu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","server"],queryFn:()=>os("server")}),{mutateAsync:o}=Je({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data.server){const r=l.data.server;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"server_token",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"通讯密钥"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(F,{children:"Xboard与节点通讯的密钥,以便数据不会被他人获取。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"server_pull_interval",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"节点拉取动作轮询间隔"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):null;r.onChange(h)}})}),e.jsx(F,{children:"节点从面板获取数据的间隔频率。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"server_push_interval",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"节点推送动作轮询间隔"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):null;r.onChange(h)}})}),e.jsx(F,{children:"节点推送数据到面板的间隔频率。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"device_limit_mode",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"设备限制模式"}),e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择设备限制模式"})})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"严格模式"}),e.jsx(O,{value:"1",children:"宽松模式"})]})]}),e.jsx(F,{children:"宽松模式下,同一IP地址使用多个节点只统计为一个设备。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function _u(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"节点配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置节点通信和同步设置,包括通信密钥、轮询间隔、负载均衡等高级选项。"})]}),e.jsx(ge,{}),e.jsx(wu,{})]})}const Cu=Object.freeze(Object.defineProperty({__proto__:null,default:_u},Symbol.toStringTag,{value:"Module"}));function Su({open:s,onOpenChange:t,result:a}){const n=!a.error;return e.jsx(ue,{open:s,onOpenChange:t,children:e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n?e.jsx(Pn,{className:"h-5 w-5 text-green-500"}):e.jsx(In,{className:"h-5 w-5 text-destructive"}),e.jsx(xe,{children:n?"邮件发送成功":"邮件发送失败"})]}),e.jsx(Se,{children:n?"测试邮件已成功发送,请检查收件箱":"发送测试邮件时遇到错误"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"发送详情"}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2 text-sm",children:[e.jsx("div",{className:"text-muted-foreground",children:"收件地址"}),e.jsx("div",{children:a.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:a.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:a.template_name})]})]}),a.error&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium text-destructive",children:"错误信息"}),e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive break-all",children:a.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(tt,{className:"h-[200px] rounded-md border p-4",children:e.jsx("div",{className:"grid gap-2 text-sm",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2",children:[e.jsx("div",{className:"text-muted-foreground",children:"驱动"}),e.jsx("div",{children:a.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:a.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:a.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:a.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:a.config.from.address?`${a.config.from.address}${a.config.from.name?` (${a.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:a.config.username||"未设置"})]})})})]})]})]})})}const ku=u.object({email_template:u.string().nullable().default("classic"),email_host:u.string().nullable().default(""),email_port:u.string().regex(/^\d+$/).nullable().default("465"),email_username:u.string().nullable().default(""),email_password:u.string().nullable().default(""),email_encryption:u.string().nullable().default(""),email_from_address:u.string().email().nullable().default("")});function Du(){const[s,t]=c.useState(null),[a,n]=c.useState(!1),l=c.useRef(null),[o,d]=c.useState(!1),x=ae({resolver:ie(ku),defaultValues:{},mode:"onBlur"}),{data:r}=Q({queryKey:["settings","email"],queryFn:()=>os("email")}),{data:i}=Q({queryKey:["emailTemplate"],queryFn:()=>Cd()}),{mutateAsync:h}=Je({mutationFn:cs,onSuccess:_=>{_.data&&A.success("已自动保存")}}),{mutate:T,isPending:C}=Je({mutationFn:Sd,onMutate:()=>{t(null),n(!1)},onSuccess:_=>{t(_.data),n(!0),_.data.error||A.success("发送成功")}});c.useEffect(()=>{if(r?.data.email){const _=r.data.email;Object.entries(_).forEach(([v,N])=>{x.setValue(v,N)}),l.current=_}},[r]);const m=c.useCallback(de.debounce(async _=>{if(!de.isEqual(_,l.current)){d(!0);try{await h(_),l.current=_}finally{d(!1)}}},1e3),[h]),w=c.useCallback(_=>{m(_)},[m]);return c.useEffect(()=>{const _=x.watch(v=>{w(v)});return()=>_.unsubscribe()},[x.watch,w]),e.jsxs(e.Fragment,{children:[e.jsx(oe,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:x.control,name:"email_host",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP服务器地址"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"由邮件服务商提供的服务地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_port",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP服务端口"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"常见的端口有25, 465, 587"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_encryption",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP加密方式"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"465端口加密方式一般为SSL,587端口加密方式一般为TLS"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_username",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP账号"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"由邮件服务商提供的账号"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_password",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP密码"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||"",type:"password"})}),e.jsx(F,{children:"由邮件服务商提供的密码"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_from_address",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"发件地址"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"由邮件服务商提供的发件地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_template",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"邮件模板"}),e.jsxs(G,{onValueChange:v=>{_.onChange(v),w(x.getValues())},value:_.value||void 0,children:[e.jsx(b,{children:e.jsx(U,{className:"w-[200px]",children:e.jsx(Y,{placeholder:"选择邮件模板"})})}),e.jsx(B,{children:i?.data?.map(v=>e.jsx(O,{value:v,children:v},v))})]}),e.jsx(F,{children:"你可以在文档查看如何自定义邮件模板"}),e.jsx(k,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(D,{onClick:()=>T(),loading:C,disabled:C,children:C?"发送中...":"发送测试邮件"})})]})}),o&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."}),s&&e.jsx(Su,{open:a,onOpenChange:n,result:s})]})}function Tu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"邮件设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置系统邮件服务,用于发送验证码、密码重置、通知等邮件,支持多种SMTP服务商。"})]}),e.jsx(ge,{}),e.jsx(Du,{})]})}const Pu=Object.freeze(Object.defineProperty({__proto__:null,default:Tu},Symbol.toStringTag,{value:"Module"})),Iu=u.object({telegram_bot_enable:u.boolean().nullable(),telegram_bot_token:u.string().nullable(),telegram_discuss_link:u.string().nullable()}),Vu={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function Ru(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(Iu),defaultValues:Vu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","telegram"],queryFn:()=>os("telegram")}),{mutateAsync:o}=Je({mutationFn:cs,onSuccess:h=>{h.data&&A.success("已自动保存")}}),{mutate:d,isPending:x}=Je({mutationFn:kd,onSuccess:h=>{h.data&&A.success("Webhook设置成功")}});c.useEffect(()=>{if(l?.data.telegram){const h=l.data.telegram;Object.entries(h).forEach(([T,C])=>{n.setValue(T,C)}),a.current=h}},[l]);const r=c.useCallback(de.debounce(async h=>{if(!de.isEqual(h,a.current)){t(!0);try{await o(h),a.current=h}finally{t(!1)}}},1e3),[o]),i=c.useCallback(h=>{r(h)},[r]);return c.useEffect(()=>{const h=n.watch(T=>{i(T)});return()=>h.unsubscribe()},[n.watch,i]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"telegram_bot_token",render:({field:h})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"机器人Token"}),e.jsx(b,{children:e.jsx(S,{placeholder:"0000000000:xxxxxxxxx_xxxxxxxxxxxxxxx",...h,value:h.value||""})}),e.jsx(F,{children:"请输入由Botfather提供的token。"}),e.jsx(k,{})]})}),n.watch("telegram_bot_token")&&e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"设置Webhook"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(D,{loading:x,disabled:x,onClick:()=>d(),children:x?"Webhook设置中...":"一键设置"}),s&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"保存中..."})]}),e.jsx(F,{children:"对机器人进行Webhook设置,不设置将无法收到Telegram通知。"}),e.jsx(k,{})]}),e.jsx(g,{control:n.control,name:"telegram_bot_enable",render:({field:h})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"开启机器人通知"}),e.jsx(F,{children:"开启后bot将会对绑定了telegram的管理员和用户进行基础通知。"}),e.jsx(b,{children:e.jsx(H,{checked:h.value||!1,onCheckedChange:T=>{h.onChange(T),i(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"telegram_discuss_link",render:({field:h})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"群组地址"}),e.jsx(b,{children:e.jsx(S,{placeholder:"https://t.me/xxxxxx",...h,value:h.value||""})}),e.jsx(F,{children:"填写后将会在用户端展示,或者被用于需要的地方。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Eu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Telegram设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置Telegram机器人功能,实现用户通知、账户绑定、指令交互等自动化服务。"})]}),e.jsx(ge,{}),e.jsx(Ru,{})]})}const Fu=Object.freeze(Object.defineProperty({__proto__:null,default:Eu},Symbol.toStringTag,{value:"Module"})),Mu=u.object({windows_version:u.string().nullable(),windows_download_url:u.string().nullable(),macos_version:u.string().nullable(),macos_download_url:u.string().nullable(),android_version:u.string().nullable(),android_download_url:u.string().nullable()}),zu={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function Ou(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(Mu),defaultValues:zu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","app"],queryFn:()=>os("app")}),{mutateAsync:o}=Je({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data.app){const r=l.data.app;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Windows"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"Windows端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"windows_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(b,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"windows_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(b,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.exe",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"macOS"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"macOS端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"macos_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(b,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"macos_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(b,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.dmg",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Android"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"Android端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"android_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(b,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"android_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(b,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.apk",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Lu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"APP设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"管理移动应用程序相关配置,包括API接口、版本控制、推送通知等功能设置。"})]}),e.jsx(ge,{}),e.jsx(Ou,{})]})}const $u=Object.freeze(Object.defineProperty({__proto__:null,default:Lu},Symbol.toStringTag,{value:"Module"})),ia=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:y("w-full caption-bottom text-sm",s),...t})}));ia.displayName="Table";const oa=c.forwardRef(({className:s,...t},a)=>e.jsx("thead",{ref:a,className:y("[&_tr]:border-b",s),...t}));oa.displayName="TableHeader";const ca=c.forwardRef(({className:s,...t},a)=>e.jsx("tbody",{ref:a,className:y("[&_tr:last-child]:border-0",s),...t}));ca.displayName="TableBody";const Au=c.forwardRef(({className:s,...t},a)=>e.jsx("tfoot",{ref:a,className:y("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...t}));Au.displayName="TableFooter";const js=c.forwardRef(({className:s,...t},a)=>e.jsx("tr",{ref:a,className:y("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...t}));js.displayName="TableRow";const da=c.forwardRef(({className:s,...t},a)=>e.jsx("th",{ref:a,className:y("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t}));da.displayName="TableHead";const Os=c.forwardRef(({className:s,...t},a)=>e.jsx("td",{ref:a,className:y("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t}));Os.displayName="TableCell";const Hu=c.forwardRef(({className:s,...t},a)=>e.jsx("caption",{ref:a,className:y("mt-4 text-sm text-muted-foreground",s),...t}));Hu.displayName="TableCaption";function Ku({table:s}){const[t,a]=c.useState("");c.useEffect(()=>{a((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const n=l=>{const o=parseInt(l);!isNaN(o)&&o>=1&&o<=s.getPageCount()?s.setPageIndex(o-1):a((s.getState().pagination.pageIndex+1).toString())};return e.jsxs("div",{className:"flex flex-col-reverse gap-4 px-2 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex-1 text-sm text-muted-foreground",children:["已选择 ",s.getFilteredSelectedRowModel().rows.length," 项, 共"," ",s.getFilteredRowModel().rows.length," 项"]}),e.jsxs("div",{className:"flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"每页显示"}),e.jsxs(G,{value:`${s.getState().pagination.pageSize}`,onValueChange:l=>{s.setPageSize(Number(l))},children:[e.jsx(U,{className:"h-8 w-[70px]",children:e.jsx(Y,{placeholder:s.getState().pagination.pageSize})}),e.jsx(B,{side:"top",children:[10,20,30,40,50,100,500].map(l=>e.jsx(O,{value:`${l}`,children:l},l))})]})]}),e.jsxs("div",{className:"flex items-center justify-center space-x-2 text-sm font-medium",children:[e.jsx("span",{children:"第"}),e.jsx(S,{type:"text",value:t,onChange:l=>a(l.target.value),onBlur:l=>n(l.target.value),onKeyDown:l=>{l.key==="Enter"&&n(l.currentTarget.value)},className:"h-8 w-[50px] text-center"}),e.jsxs("span",{children:["页,共 ",s.getPageCount()," 页"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(D,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(0),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:"跳转到第一页"}),e.jsx(so,{className:"h-4 w-4"})]}),e.jsxs(D,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.previousPage(),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:"上一页"}),e.jsx(_n,{className:"h-4 w-4"})]}),e.jsxs(D,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.nextPage(),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:"下一页"}),e.jsx(Xt,{className:"h-4 w-4"})]}),e.jsxs(D,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(s.getPageCount()-1),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:"跳转到最后一页"}),e.jsx(to,{className:"h-4 w-4"})]})]})]})]})}function Ge({table:s,toolbar:t,draggable:a=!1,onDragStart:n,onDragEnd:l,onDragOver:o,onDragLeave:d,onDrop:x,showPagination:r=!0,isLoading:i=!1}){const h=c.useRef(null),T=s.getAllColumns().filter(_=>_.getIsPinned()==="left"),C=s.getAllColumns().filter(_=>_.getIsPinned()==="right"),m=_=>T.slice(0,_).reduce((v,N)=>v+(N.getSize()??0),0),w=_=>C.slice(_+1).reduce((v,N)=>v+(N.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof t=="function"?t(s):t,e.jsx("div",{ref:h,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs(ia,{children:[e.jsx(oa,{children:s.getHeaderGroups().map(_=>e.jsx(js,{className:"hover:bg-transparent",children:_.headers.map((v,N)=>{const P=v.column.getIsPinned()==="left",f=v.column.getIsPinned()==="right",R=P?m(T.indexOf(v.column)):void 0,z=f?w(C.indexOf(v.column)):void 0;return e.jsx(da,{colSpan:v.colSpan,style:{width:v.getSize(),...P&&{left:R},...f&&{right:z}},className:y("h-11 bg-card px-4 text-muted-foreground",(P||f)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",P&&"before:right-0",f&&"before:left-0"]),children:v.isPlaceholder?null:vt(v.column.columnDef.header,v.getContext())},v.id)})},_.id))}),e.jsx(ca,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((_,v)=>e.jsx(js,{"data-state":_.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:a,onDragStart:N=>n?.(N,v),onDragEnd:l,onDragOver:o,onDragLeave:d,onDrop:N=>x?.(N,v),children:_.getVisibleCells().map((N,P)=>{const f=N.column.getIsPinned()==="left",R=N.column.getIsPinned()==="right",z=f?m(T.indexOf(N.column)):void 0,$=R?w(C.indexOf(N.column)):void 0;return e.jsx(Os,{style:{width:N.column.getSize(),...f&&{left:z},...R&&{right:$}},className:y("bg-card",(f||R)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",f&&"before:right-0",R&&"before:left-0"]),children:vt(N.column.columnDef.cell,N.getContext())},N.id)})},_.id)):e.jsx(js,{children:e.jsx(Os,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:"暂无数据"})})})]})})}),r&&e.jsx(Ku,{table:s})]})}const _r=(s,t)=>{let a=null;switch(s.field_type){case"input":a=e.jsx(S,{placeholder:s.placeholder,...t});break;case"textarea":a=e.jsx(vs,{placeholder:s.placeholder,...t});break;case"select":a=e.jsx("select",{className:y(Ls({variant:"outline"}),"w-full appearance-none font-normal"),...t,children:s.select_options&&Object.keys(s.select_options).map(n=>e.jsx("option",{value:n,children:s.select_options?.[n]},n))});break;default:a=null;break}return a},qu=u.object({id:u.number().nullable(),name:u.string().min(2,"名称至少需要2个字符").max(30,"名称不能超过30个字符"),icon:u.string().optional().nullable(),notify_domain:u.string().refine(s=>!s||/^https?:\/\/\S+/.test(s),"请输入有效的URL").optional().nullable(),handling_fee_fixed:u.coerce.number().min(0).optional().nullable(),handling_fee_percent:u.coerce.number().min(0).max(100).optional().nullable(),payment:u.string().min(1,"请选择支付接口"),config:u.record(u.string(),u.string())}),Oa={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function Cr({refetch:s,dialogTrigger:t,type:a="add",defaultFormValues:n=Oa}){const[l,o]=c.useState(!1),[d,x]=c.useState(!1),[r,i]=c.useState([]),[h,T]=c.useState([]),C=ae({resolver:ie(qu),defaultValues:n,mode:"onChange"}),m=C.watch("payment");c.useEffect(()=>{l&&(async()=>{const{data:v}=await Uc();i(v)})()},[l]),c.useEffect(()=>{if(!m||!l)return;(async()=>{const v={payment:m,...a==="edit"&&{id:Number(C.getValues("id"))}};Bc(v).then(({data:N})=>{T(N);const P=N.reduce((f,R)=>(R.field_name&&(f[R.field_name]=R.value??""),f),{});C.setValue("config",P)})})()},[m,l,C,a]);const w=async _=>{x(!0),(await Gc(_)).data&&(A.success("保存成功"),C.reset(Oa),s(),o(!1)),x(!1)};return e.jsxs(ue,{open:l,onOpenChange:o,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"})," ",e.jsx("div",{children:"添加支付方式"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(je,{children:e.jsx(xe,{children:a==="add"?"添加支付方式":"编辑支付方式"})}),e.jsx(oe,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(w),className:"space-y-4",children:[e.jsx(g,{control:C.control,name:"name",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"显示名称"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入支付名称",..._})}),e.jsx(F,{children:"用于前端显示"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"icon",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"图标URL"}),e.jsx(b,{children:e.jsx(S,{placeholder:"https://example.com/icon.svg",..._})}),e.jsx(F,{children:"用于前端显示的图标地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"notify_domain",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"通知域名"}),e.jsx(b,{children:e.jsx(S,{placeholder:"https://example.com",..._})}),e.jsx(F,{children:"网关通知将发送到该域名"}),e.jsx(k,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(g,{control:C.control,name:"handling_fee_percent",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"百分比手续费(%)"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"0-100",..._})}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"handling_fee_fixed",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"固定手续费"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"0",..._})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:C.control,name:"payment",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"支付接口"}),e.jsxs(G,{value:_.value,onValueChange:_.onChange,children:[e.jsx(b,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择支付接口"})})}),e.jsx(B,{children:r.map(v=>e.jsx(O,{value:v,children:v},v))})]}),e.jsx(k,{})]})}),h.map(_=>e.jsx(g,{control:C.control,name:`config.${_.field_name}`,render:({field:v})=>e.jsxs(j,{children:[e.jsx(p,{children:_.label}),e.jsx(b,{children:_r(_,v)}),e.jsx(k,{})]})},_.field_name)),e.jsxs(Ee,{className:"gap-2",children:[e.jsx(it,{asChild:!0,children:e.jsx(D,{type:"button",variant:"outline",children:"取消"})}),e.jsx(D,{type:"submit",disabled:d,className:y(d&&"cursor-not-allowed opacity-50"),children:d?"保存中...":"提交"})]})]})})]})]})}function I({column:s,title:t,tooltip:a,className:n}){return s.getCanSort()?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(D,{variant:"ghost",size:"default",className:y("-ml-3 flex h-8 items-center gap-2 text-nowrap font-medium hover:bg-muted/60",n),onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:[e.jsx("span",{children:t}),a&&e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(Ca,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(ee,{children:a})]})}),s.getIsSorted()==="asc"?e.jsx(At,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(Ht,{className:"h-4 w-4 text-foreground/70"}):e.jsx(ao,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-foreground/70"})]})})}):e.jsxs("div",{className:y("flex items-center space-x-1 text-nowrap py-2 font-medium text-muted-foreground",n),children:[e.jsx("span",{children:t}),a&&e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx(Ca,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(ee,{children:a})]})})]})}const Uu=no,Bu=ro,Gu=lo,Sr=c.forwardRef(({className:s,...t},a)=>e.jsx(En,{className:y("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t,ref:a}));Sr.displayName=En.displayName;const kr=c.forwardRef(({className:s,...t},a)=>e.jsxs(Gu,{children:[e.jsx(Sr,{}),e.jsx(Fn,{ref:a,className:y("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...t})]}));kr.displayName=Fn.displayName;const Dr=({className:s,...t})=>e.jsx("div",{className:y("flex flex-col space-y-2 text-center sm:text-left",s),...t});Dr.displayName="AlertDialogHeader";const Tr=({className:s,...t})=>e.jsx("div",{className:y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Tr.displayName="AlertDialogFooter";const Pr=c.forwardRef(({className:s,...t},a)=>e.jsx(Mn,{ref:a,className:y("text-lg font-semibold",s),...t}));Pr.displayName=Mn.displayName;const Ir=c.forwardRef(({className:s,...t},a)=>e.jsx(zn,{ref:a,className:y("text-sm text-muted-foreground",s),...t}));Ir.displayName=zn.displayName;const Vr=c.forwardRef(({className:s,...t},a)=>e.jsx(On,{ref:a,className:y(Ls(),s),...t}));Vr.displayName=On.displayName;const Rr=c.forwardRef(({className:s,...t},a)=>e.jsx(Ln,{ref:a,className:y(Ls({variant:"outline"}),"mt-2 sm:mt-0",s),...t}));Rr.displayName=Ln.displayName;function Ye({onConfirm:s,children:t,title:a="确认操作",description:n="确定要执行此操作吗?",cancelText:l="取消",confirmText:o="确认",variant:d="default",className:x}){return e.jsxs(Uu,{children:[e.jsx(Bu,{asChild:!0,children:t}),e.jsxs(kr,{className:y("sm:max-w-[425px]",x),children:[e.jsxs(Dr,{children:[e.jsx(Pr,{children:a}),e.jsx(Ir,{children:n})]}),e.jsxs(Tr,{children:[e.jsx(Rr,{asChild:!0,children:e.jsx(D,{variant:"outline",children:l})}),e.jsx(Vr,{asChild:!0,children:e.jsx(D,{variant:d,onClick:s,children:o})})]})]})]})}const Er=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M11.29 15.29a2 2 0 0 0-.12.15a.8.8 0 0 0-.09.18a.6.6 0 0 0-.06.18a1.4 1.4 0 0 0 0 .2a.84.84 0 0 0 .08.38a.9.9 0 0 0 .54.54a.94.94 0 0 0 .76 0a.9.9 0 0 0 .54-.54A1 1 0 0 0 13 16a1 1 0 0 0-.29-.71a1 1 0 0 0-1.42 0M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8 8 0 0 1-8 8m0-13a3 3 0 0 0-2.6 1.5a1 1 0 1 0 1.73 1A1 1 0 0 1 12 9a1 1 0 0 1 0 2a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-.18A3 3 0 0 0 12 7"})}),Yu=({refetch:s,isSortMode:t=!1})=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:t?"cursor-move":"opacity-0",children:e.jsx(Dt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(I,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(L,{variant:"outline",children:a.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:a})=>e.jsx(I,{column:a,title:"启用"}),cell:({row:a})=>e.jsx(H,{defaultChecked:a.getValue("enable"),onCheckedChange:async()=>{const{data:n}=await Wc({id:a.original.id});n||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:a})=>e.jsx(I,{column:a,title:"显示名称"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:a.getValue("name")})}),enableSorting:!1,size:200},{accessorKey:"payment",header:({column:a})=>e.jsx(I,{column:a,title:"支付接口"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:a.getValue("payment")})}),enableSorting:!1,size:200},{accessorKey:"notify_url",header:({column:a})=>e.jsxs("div",{className:"flex items-center",children:[e.jsx(I,{column:a,title:"通知地址"}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{className:"ml-1",children:e.jsx(Er,{className:"h-4 w-4"})}),e.jsx(ee,{children:"支付网关将会把数据通知到本地址,请通过防火墙放行本地址。"})]})})]}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[300px] truncate font-medium",children:a.getValue("notify_url")})}),enableSorting:!1,size:3e3},{id:"actions",header:({column:a})=>e.jsx(I,{className:"justify-end",column:a,title:"操作"}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Cr,{refetch:s,dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(ks,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:a.original}),e.jsx(Ye,{title:"删除确认",description:"确定要删除该支付方式吗?此操作无法撤销。",onConfirm:async()=>{const{data:n}=await Yc({id:a.original.id});n&&s()},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function Wu({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽支付方式进行排序,完成后点击保存"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Cr,{refetch:t}),e.jsx(S,{placeholder:"搜索支付方式...",value:s.getColumn("name")?.getFilterValue()??"",onChange:o=>s.getColumn("name")?.setFilterValue(o.target.value),className:"h-8 w-[250px]"}),l&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(D,{variant:n?"default":"outline",onClick:a,size:"sm",children:n?"保存排序":"编辑排序"})})]})}function Ju(){const[s,t]=c.useState([]),[a,n]=c.useState([]),[l,o]=c.useState(!1),[d,x]=c.useState([]),[r,i]=c.useState({"drag-handle":!1}),[h,T]=c.useState({pageSize:20,pageIndex:0}),{refetch:C}=Q({queryKey:["paymentList"],queryFn:async()=>{const{data:N}=await qc();return x(N?.map(P=>({...P,enable:!!P.enable}))||[]),N}});c.useEffect(()=>{i({"drag-handle":l}),T({pageSize:l?99999:10,pageIndex:0})},[l]);const m=(N,P)=>{l&&(N.dataTransfer.setData("text/plain",P.toString()),N.currentTarget.classList.add("opacity-50"))},w=(N,P)=>{if(!l)return;N.preventDefault(),N.currentTarget.classList.remove("bg-muted");const f=parseInt(N.dataTransfer.getData("text/plain"));if(f===P)return;const R=[...d],[z]=R.splice(f,1);R.splice(P,0,z),x(R)},_=async()=>{l?Jc({ids:d.map(N=>N.id)}).then(()=>{C(),o(!1),A.success("排序保存成功")}):o(!0)},v=Le({data:d,columns:Yu({refetch:C,isSortMode:l}),state:{sorting:a,columnFilters:s,columnVisibility:r,pagination:h},onSortingChange:n,onColumnFiltersChange:t,onColumnVisibilityChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),initialState:{columnPinning:{right:["actions"]}},pageCount:l?1:void 0});return e.jsx(Ge,{table:v,toolbar:N=>e.jsx(Wu,{table:N,refetch:C,saveOrder:_,isSortMode:l}),draggable:l,onDragStart:m,onDragEnd:N=>N.currentTarget.classList.remove("opacity-50"),onDragOver:N=>{N.preventDefault(),N.currentTarget.classList.add("bg-muted")},onDragLeave:N=>N.currentTarget.classList.remove("bg-muted"),onDrop:w,showPagination:!l})}function Qu(){return e.jsxs(ye,{children:[e.jsxs(Ne,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{children:[e.jsx("header",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"支付配置"})}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置支付方式,包括支付宝、微信等。"})]})}),e.jsx("section",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Ju,{})})]})]})}const Zu=Object.freeze(Object.defineProperty({__proto__:null,default:Qu},Symbol.toStringTag,{value:"Module"}));function Xu({themeKey:s,themeInfo:t}){const[a,n]=c.useState(!1),[l,o]=c.useState(!1),[d,x]=c.useState(!1),r=ae({defaultValues:t.configs.reduce((T,C)=>(T[C.field_name]="",T),{})}),i=async()=>{o(!0),Pc(s).then(({data:T})=>{Object.entries(T).forEach(([C,m])=>{r.setValue(C,m)})}).finally(()=>{o(!1)})},h=async T=>{x(!0),Ic(s,T).then(()=>{A.success("保存成功"),n(!1)}).finally(()=>{x(!1)})};return e.jsxs(ue,{open:a,onOpenChange:T=>{n(T),T?i():r.reset()},children:[e.jsx(Re,{asChild:!0,children:e.jsx(D,{variant:"outline",children:"主题设置"})}),e.jsxs(ce,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsxs(xe,{children:["配置",t.name,"主题"]}),e.jsx(Se,{children:"修改主题的样式、布局和其他显示选项。"})]}),l?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(sa,{className:"h-6 w-6 animate-spin"})}):e.jsx(oe,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(h),className:"space-y-4",children:[t.configs.map(T=>e.jsx(g,{control:r.control,name:T.field_name,render:({field:C})=>e.jsxs(j,{children:[e.jsx(p,{children:T.label}),e.jsx(b,{children:_r(T,C)}),e.jsx(k,{})]})},T.field_name)),e.jsxs(Ee,{className:"mt-6 gap-2",children:[e.jsx(D,{type:"button",variant:"secondary",onClick:()=>n(!1),children:"取消"}),e.jsx(D,{type:"submit",loading:d,children:"保存"})]})]})})]})]})}function ex(){const[s,t]=c.useState(null),[a,n]=c.useState(!1),[l,o]=c.useState(!1),[d,x]=c.useState(!1),[r,i]=c.useState(null),h=c.useRef(null),[T,C]=c.useState(0),{data:m,isLoading:w,refetch:_}=Q({queryKey:["themeList"],queryFn:async()=>{const{data:E}=await Tc();return E}}),v=async E=>{t(E),Ec({frontend_theme:E}).then(()=>{A.success("主题切换成功"),_()}).finally(()=>{t(null)})},N=async E=>{if(!E.name.endsWith(".zip")){A.error("只支持上传 ZIP 格式的主题文件");return}n(!0),Vc(E).then(()=>{A.success("主题上传成功"),o(!1),_()}).finally(()=>{n(!1),h.current&&(h.current.value="")})},P=E=>{E.preventDefault(),E.stopPropagation(),E.type==="dragenter"||E.type==="dragover"?x(!0):E.type==="dragleave"&&x(!1)},f=E=>{E.preventDefault(),E.stopPropagation(),x(!1),E.dataTransfer.files&&E.dataTransfer.files[0]&&N(E.dataTransfer.files[0])},R=()=>{r&&C(E=>E===0?r.images.length-1:E-1)},z=()=>{r&&C(E=>E===r.images.length-1?0:E+1)},$=(E,K)=>{C(0),i({name:E,images:K})};return e.jsxs(ye,{children:[e.jsxs(Ne,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"主题配置"})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-muted-foreground",children:"主题配置,包括主题色、字体大小等。如果你采用前后分离的方式部署V2board,那么主题配置将不会生效。"}),e.jsxs(D,{onClick:()=>o(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(Sa,{className:"mr-2 h-4 w-4"}),"上传主题"]})]})]}),e.jsx("section",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3",children:w?e.jsxs(e.Fragment,{children:[e.jsx(La,{}),e.jsx(La,{})]}):m?.themes&&Object.entries(m.themes).map(([E,K])=>e.jsx(Ie,{className:"group relative overflow-hidden transition-all hover:shadow-md",style:{backgroundImage:K.background_url?`url(${K.background_url})`:"none",backgroundSize:"cover",backgroundPosition:"center"},children:e.jsxs("div",{className:y("relative z-10 h-full transition-colors",K.background_url?"group-hover:from-background/98 bg-gradient-to-t from-background/95 via-background/80 to-background/60 backdrop-blur-[1px] group-hover:via-background/90 group-hover:to-background/70":"bg-background"),children:[!!K.can_delete&&e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(Ye,{title:"删除主题",description:"确定要删除该主题吗?删除后无法恢复。",confirmText:"删除",variant:"destructive",onConfirm:async()=>{if(E===m?.active){A.error("不能删除当前使用的主题");return}t(E),Rc(E).then(()=>{A.success("主题删除成功"),_()}).finally(()=>{t(null)})},children:e.jsx(D,{disabled:s===E,loading:s===E,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(rs,{className:"h-4 w-4"})})})}),e.jsxs(ze,{children:[e.jsx(Qe,{children:K.name}),e.jsx(Zs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{children:K.description}),K.version&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:["版本: ",K.version]})]})})]}),e.jsxs(Oe,{className:"flex items-center justify-end space-x-3",children:[K.images&&Array.isArray(K.images)&&K.images.length>0&&e.jsx(D,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>$(K.name,K.images),children:e.jsx(io,{className:"h-4 w-4"})}),e.jsx(Xu,{themeKey:E,themeInfo:K}),e.jsx(D,{onClick:()=>v(E),disabled:s===E||E===m.active,loading:s===E,variant:E===m.active?"secondary":"default",children:E===m.active?"当前主题":"激活主题"})]})]})},E))}),e.jsx(ue,{open:l,onOpenChange:o,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(je,{children:[e.jsx(xe,{children:"上传主题"}),e.jsx(Se,{children:"请上传一个有效的主题压缩包(.zip 格式)。主题包应包含完整的主题文件结构。"})]}),e.jsxs("div",{className:y("relative mt-4 flex h-64 flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-10 text-center transition-colors",d&&"border-primary/50 bg-muted/50"),onDragEnter:P,onDragLeave:P,onDragOver:P,onDrop:f,children:[e.jsx("input",{type:"file",ref:h,className:"hidden",accept:".zip",onChange:E=>{const K=E.target.files?.[0];K&&N(K)}}),a?e.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-b-2 border-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"正在上传..."})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"rounded-full border-2 border-muted-foreground/25 p-3",children:e.jsx(Sa,{className:"h-6 w-6 text-muted-foreground/50"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:["将主题文件拖放到此处,或者",e.jsx("button",{type:"button",onClick:()=>h.current?.click(),className:"mx-1 text-primary hover:underline",children:"点击选择"})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"支持 .zip 格式的主题包"})]})]})})]})]})}),e.jsx(ue,{open:!!r,onOpenChange:E=>{E||(i(null),C(0))},children:e.jsxs(ce,{className:"max-w-4xl",children:[e.jsxs(je,{children:[e.jsxs(xe,{children:[r?.name," 主题预览"]}),e.jsx(Se,{className:"text-center",children:r&&`${T+1} / ${r.images.length}`})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"aspect-[16/9] overflow-hidden rounded-lg border bg-muted",children:r?.images[T]&&e.jsx("img",{src:r.images[T],alt:`${r.name} 预览图 ${T+1}`,className:"h-full w-full object-contain"})}),r&&r.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(D,{variant:"outline",size:"icon",className:"absolute left-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:R,children:e.jsx(oo,{className:"h-4 w-4"})}),e.jsx(D,{variant:"outline",size:"icon",className:"absolute right-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:z,children:e.jsx(co,{className:"h-4 w-4"})})]})]}),r&&r.images.length>1&&e.jsx("div",{className:"mt-4 flex gap-2 overflow-x-auto pb-2",children:r.images.map((E,K)=>e.jsx("button",{onClick:()=>C(K),className:y("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",T===K?"border-primary":"border-transparent"),children:e.jsx("img",{src:E,alt:`缩略图 ${K+1}`,className:"h-full w-full object-cover"})},K))})]})})]})]})}function La(){return e.jsxs(Ie,{children:[e.jsxs(ze,{children:[e.jsx(Fe,{className:"h-6 w-[200px]"}),e.jsx(Fe,{className:"h-4 w-[300px]"})]}),e.jsxs(Oe,{className:"flex items-center justify-end space-x-3",children:[e.jsx(Fe,{className:"h-10 w-[100px]"}),e.jsx(Fe,{className:"h-10 w-[100px]"})]})]})}const sx=Object.freeze(Object.defineProperty({__proto__:null,default:ex},Symbol.toStringTag,{value:"Module"})),ua=c.forwardRef(({className:s,value:t,onChange:a,...n},l)=>{const[o,d]=c.useState("");c.useEffect(()=>{if(o.includes(",")){const r=new Set([...t,...o.split(",").map(i=>i.trim())]);a(Array.from(r)),d("")}},[o,a,t]);const x=()=>{if(o){const r=new Set([...t,o]);a(Array.from(r)),d("")}};return e.jsxs("div",{className:y(" has-[:focus-visible]:outline-none has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-neutral-950 dark:has-[:focus-visible]:ring-neutral-300 flex w-full flex-wrap gap-2 rounded-md border border-input shadow-sm px-3 py-2 text-sm ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",s),children:[t.map(r=>e.jsxs(L,{variant:"secondary",children:[r,e.jsx(W,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{a(t.filter(i=>i!==r))},children:e.jsx(Kt,{className:"w-3"})})]},r)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:o,onChange:r=>d(r.target.value),onKeyDown:r=>{r.key==="Enter"||r.key===","?(r.preventDefault(),x()):r.key==="Backspace"&&o.length===0&&t.length>0&&(r.preventDefault(),a(t.slice(0,-1)))},...n,ref:l})]})});ua.displayName="InputTags";const tx=u.object({id:u.number().nullable(),title:u.string().min(1).max(250),content:u.string().min(1),show:u.boolean(),tags:u.array(u.string()),img_url:u.string().nullable()}),ax={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function Fr({refetch:s,dialogTrigger:t,type:a="add",defaultFormValues:n=ax}){const[l,o]=c.useState(!1),d=ae({resolver:ie(tx),defaultValues:n,mode:"onChange",shouldFocusError:!0}),x=new ta({html:!0});return e.jsx(oe,{...d,children:e.jsxs(ue,{onOpenChange:o,open:l,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"})," ",e.jsx("div",{children:"添加公告"})]})}),e.jsxs(ce,{className:"sm:max-w-[1025px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:a==="add"?"添加公告":"编辑公告"}),e.jsx(Se,{})]}),e.jsx(g,{control:d.control,name:"title",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"标题"}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(S,{placeholder:"请输入公告标题",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"content",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"公告内容"}),e.jsx(b,{children:e.jsx(aa,{style:{height:"500px"},value:r.value,renderHTML:i=>x.render(i),onChange:({text:i})=>{r.onChange(i)}})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"img_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"公告背景"}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(S,{type:"text",placeholder:"请输入公告背景图片URL",...r,value:r.value||""})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"show",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"显示"}),e.jsx("div",{className:"relative py-2",children:e.jsx(b,{children:e.jsx(H,{checked:r.value,onCheckedChange:r.onChange})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"tags",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"节点标签"}),e.jsx(b,{children:e.jsx(ua,{value:r.value,onChange:r.onChange,placeholder:"输入后回车添加标签",className:"w-full"})}),e.jsx(k,{})]})}),e.jsxs(Ee,{children:[e.jsx(it,{asChild:!0,children:e.jsx(D,{type:"button",variant:"outline",children:"取消"})}),e.jsx(D,{type:"submit",onClick:r=>{r.preventDefault(),d.handleSubmit(async i=>{Zc(i).then(({data:h})=>{h&&(A.success("提交成功"),s(),o(!1))})})()},children:"提交"})]})]})]})})}function nx({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between space-x-2 ",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[!n&&e.jsx(Fr,{refetch:t}),!n&&e.jsx(S,{placeholder:"搜索公告标题...",value:s.getColumn("title")?.getFilterValue()??"",onChange:o=>s.getColumn("title")?.setFilterValue(o.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),l&&!n&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(D,{variant:n?"default":"outline",onClick:a,className:"h-8",size:"sm",children:n?"保存排序":"编辑排序"})})]})}const rx=s=>[{id:"drag-handle",header:"",cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(uo,{className:"h-4 w-4 text-muted-foreground cursor-move"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"ID"}),cell:({row:t})=>e.jsx(L,{variant:"outline",className:"font-mono",children:t.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"显示状态"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(H,{defaultChecked:t.getValue("show"),onCheckedChange:async()=>{const{data:a}=await ed({id:t.original.id});a||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:t})=>e.jsx(I,{column:t,title:"标题"}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[500px] items-center",children:e.jsx("span",{className:"truncate font-medium",children:t.getValue("title")})}),enableSorting:!1,size:6e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Fr,{refetch:s,dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(ks,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:t.original}),e.jsx(Ye,{title:"删除确认",description:"确定要删除该条公告吗?此操作无法撤销。",onConfirm:async()=>{Xc({id:t.original.id}).then(()=>{A.success("删除成功"),s()})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function lx(){const[s,t]=c.useState({}),[a,n]=c.useState({}),[l,o]=c.useState([]),[d,x]=c.useState([]),[r,i]=c.useState(!1),[h,T]=c.useState({}),[C,m]=c.useState({pageSize:50,pageIndex:0}),[w,_]=c.useState([]),{refetch:v}=Q({queryKey:["notices"],queryFn:async()=>{const{data:z}=await Qc();return _(z),z}});c.useEffect(()=>{n({"drag-handle":r,content:!r,created_at:!r,actions:!r}),m({pageSize:r?99999:50,pageIndex:0})},[r]);const N=(z,$)=>{r&&(z.dataTransfer.setData("text/plain",$.toString()),z.currentTarget.classList.add("opacity-50"))},P=(z,$)=>{if(!r)return;z.preventDefault(),z.currentTarget.classList.remove("bg-muted");const E=parseInt(z.dataTransfer.getData("text/plain"));if(E===$)return;const K=[...w],[ds]=K.splice(E,1);K.splice($,0,ds),_(K)},f=async()=>{if(!r){i(!0);return}Dd(w.map(z=>z.id)).then(()=>{A.success("排序保存成功"),i(!1),v()}).finally(()=>{i(!1)})},R=Le({data:w??[],columns:rx(v),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,columnSizing:h,pagination:C},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,onColumnSizingChange:T,onPaginationChange:m,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(Ge,{table:R,toolbar:z=>e.jsx(nx,{table:z,refetch:v,saveOrder:f,isSortMode:r}),draggable:r,onDragStart:N,onDragEnd:z=>z.currentTarget.classList.remove("opacity-50"),onDragOver:z=>{z.preventDefault(),z.currentTarget.classList.add("bg-muted")},onDragLeave:z=>z.currentTarget.classList.remove("bg-muted"),onDrop:P,showPagination:!r})})}function ix(){return e.jsxs(ye,{children:[e.jsxs(Ne,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"公告管理"})}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置公告,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(lx,{})})]})]})}const ox=Object.freeze(Object.defineProperty({__proto__:null,default:ix},Symbol.toStringTag,{value:"Module"})),cx=u.object({id:u.number().nullable(),language:u.string().max(250),category:u.string().max(250),title:u.string().min(1).max(250),body:u.string().min(1),show:u.boolean()}),dx={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function Mr({refreshData:s,dialogTrigger:t,type:a="add",defaultFormValues:n=dx}){const[l,o]=c.useState(!1),d=ae({resolver:ie(cx),defaultValues:n,mode:"onChange",shouldFocusError:!0}),x=new ta({html:!0});return c.useEffect(()=>{l&&n.id&&td(n.id).then(({data:r})=>{d.reset(r)})},[n.id,d,l]),e.jsxs(ue,{onOpenChange:o,open:l,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"})," ",e.jsx("div",{children:"添加知识"})]})}),e.jsxs(ce,{className:"sm:max-w-[1025px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:a==="add"?"添加知识":"编辑知识"}),e.jsx(Se,{})]}),e.jsxs(oe,{...d,children:[e.jsx(g,{control:d.control,name:"title",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"标题"}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(S,{placeholder:"请输入知识标题",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"category",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"分类"}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(S,{placeholder:"请输入分类,分类将会自动归类",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"language",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"语言"}),e.jsx(b,{children:e.jsxs(G,{value:r.value,onValueChange:r.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择语言"})}),e.jsx(B,{children:[{field:"English",value:"en-US"},{field:"日本語",value:"ja-JP"},{field:"한국어",value:"ko-KR"},{field:"Tiếng Việt",value:"vi-VN"},{field:"简体中文",value:"zh-CN"},{field:"繁體中文",value:"zh-TW"}].map(i=>e.jsx(O,{value:i.value,className:"cursor-pointer",children:i.field},i.value))})]})})]})}),e.jsx(g,{control:d.control,name:"body",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"内容"}),e.jsx(b,{children:e.jsx(aa,{style:{height:"500px"},value:r.value,renderHTML:i=>x.render(i),onChange:({text:i})=>{r.onChange(i)}})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"show",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"显示"}),e.jsx("div",{className:"relative py-2",children:e.jsx(b,{children:e.jsx(H,{checked:r.value,onCheckedChange:r.onChange})})}),e.jsx(k,{})]})}),e.jsxs(Ee,{children:[e.jsx(it,{asChild:!0,children:e.jsx(D,{type:"button",variant:"outline",children:"取消"})}),e.jsx(D,{type:"submit",onClick:()=>{d.handleSubmit(r=>{ad(r).then(({data:i})=>{i&&(d.reset(),A.success("操作成功"),o(!1),s())})})()},children:"提交"})]})]})]})]})}function ux({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(o=>l.has(o.value)).map(o=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(fs,{children:[e.jsx(Ds,{placeholder:t}),e.jsxs(ps,{children:[e.jsx(Ts,{children:"No results found."}),e.jsx(Ve,{children:a.map(o=>{const d=l.has(o.value);return e.jsxs(be,{onSelect:()=>{d?l.delete(o.value):l.add(o.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Cs,{className:y("h-4 w-4")})}),o.icon&&e.jsx(o.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:o.label}),n?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(o.value)})]},o.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(As,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function xx({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽知识条目进行排序,完成后点击保存"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mr,{refreshData:t}),e.jsx(S,{placeholder:"搜索知识...",value:s.getColumn("title")?.getFilterValue()??"",onChange:o=>s.getColumn("title")?.setFilterValue(o.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(ux,{column:s.getColumn("category"),title:"分类",options:Array.from(new Set(s.getCoreRowModel().rows.map(o=>o.getValue("category")))).map(o=>({label:o,value:o}))}),l&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(D,{variant:n?"default":"outline",onClick:a,size:"sm",children:n?"保存排序":"编辑排序"})})]})}const mx=({refetch:s,isSortMode:t=!1})=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:t?"cursor-move":"opacity-0",children:e.jsx(Dt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(I,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(L,{variant:"outline",className:"justify-center",children:a.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:a})=>e.jsx(I,{column:a,title:"状态"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(H,{defaultChecked:a.getValue("show"),onCheckedChange:async()=>{rd({id:a.original.id}).then(({data:n})=>{n||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:a})=>e.jsx(I,{column:a,title:"标题"}),cell:({row:a})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"line-clamp-2 font-medium",children:a.getValue("title")})}),enableSorting:!0,size:600},{accessorKey:"category",header:({column:a})=>e.jsx(I,{column:a,title:"分类"}),cell:({row:a})=>e.jsx(L,{variant:"secondary",className:"max-w-[180px] truncate",children:a.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:a})=>e.jsx(I,{className:"justify-end",column:a,title:"操作"}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx(Mr,{refreshData:s,dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(ks,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:a.original}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该知识库记录,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{nd({id:a.original.id}).then(({data:n})=>{n&&(A.success("删除成功"),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function hx(){const[s,t]=c.useState([]),[a,n]=c.useState([]),[l,o]=c.useState(!1),[d,x]=c.useState([]),[r,i]=c.useState({"drag-handle":!1}),[h,T]=c.useState({pageSize:20,pageIndex:0}),{refetch:C,isLoading:m,data:w}=Q({queryKey:["knowledge"],queryFn:async()=>{const{data:f}=await sd();return x(f||[]),f}});c.useEffect(()=>{i({"drag-handle":l}),T({pageSize:l?99999:10,pageIndex:0})},[l]);const _=(f,R)=>{l&&(f.dataTransfer.setData("text/plain",R.toString()),f.currentTarget.classList.add("opacity-50"))},v=(f,R)=>{if(!l)return;f.preventDefault(),f.currentTarget.classList.remove("bg-muted");const z=parseInt(f.dataTransfer.getData("text/plain"));if(z===R)return;const $=[...d],[E]=$.splice(z,1);$.splice(R,0,E),x($)},N=async()=>{l?ld({ids:d.map(f=>f.id)}).then(()=>{C(),o(!1),A.success("排序保存成功")}):o(!0)},P=Le({data:d,columns:mx({refetch:C,isSortMode:l}),state:{sorting:a,columnFilters:s,columnVisibility:r,pagination:h},onSortingChange:n,onColumnFiltersChange:t,onColumnVisibilityChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:P,toolbar:f=>e.jsx(xx,{table:f,refetch:C,saveOrder:N,isSortMode:l}),draggable:l,onDragStart:_,onDragEnd:f=>f.currentTarget.classList.remove("opacity-50"),onDragOver:f=>{f.preventDefault(),f.currentTarget.classList.add("bg-muted")},onDragLeave:f=>f.currentTarget.classList.remove("bg-muted"),onDrop:v,showPagination:!l})}function jx(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight mb-2",children:"知识库管理"}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置知识库,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(hx,{})})]})]})}const gx=Object.freeze(Object.defineProperty({__proto__:null,default:jx},Symbol.toStringTag,{value:"Module"}));function fx(s,t){const[a,n]=c.useState(s);return c.useEffect(()=>{const l=setTimeout(()=>n(s),t);return()=>{clearTimeout(l)}},[s,t]),a}function Ot(s,t){if(s.length===0)return{};if(!t)return{"":s};const a={};return s.forEach(n=>{const l=n[t]||"";a[l]||(a[l]=[]),a[l].push(n)}),a}function px(s,t){const a=JSON.parse(JSON.stringify(s));for(const[n,l]of Object.entries(a))a[n]=l.filter(o=>!t.find(d=>d.value===o.value));return a}function vx(s,t){for(const[,a]of Object.entries(s))if(a.some(n=>t.find(l=>l.value===n.value)))return!0;return!1}const zr=c.forwardRef(({className:s,...t},a)=>xo(l=>l.filtered.count===0)?e.jsx("div",{ref:a,className:y("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...t}):null);zr.displayName="CommandEmpty";const at=c.forwardRef(({value:s,onChange:t,placeholder:a,defaultOptions:n=[],options:l,delay:o,onSearch:d,loadingIndicator:x,emptyIndicator:r,maxSelected:i=Number.MAX_SAFE_INTEGER,onMaxSelected:h,hidePlaceholderWhenSelected:T,disabled:C,groupBy:m,className:w,badgeClassName:_,selectFirstItem:v=!0,creatable:N=!1,triggerSearchOnFocus:P=!1,commandProps:f,inputProps:R,hideClearAllButton:z=!1},$)=>{const E=c.useRef(null),[K,ds]=c.useState(!1),Hs=c.useRef(!1),[fa,pa]=c.useState(!1),[J,Ks]=c.useState(s||[]),[bs,va]=c.useState(Ot(n,m)),[us,Ft]=c.useState(""),qs=fx(us,o||500);c.useImperativeHandle($,()=>({selectedValue:[...J],input:E.current,focus:()=>E.current?.focus()}),[J]);const ot=c.useCallback(q=>{const Z=J.filter(Ce=>Ce.value!==q.value);Ks(Z),t?.(Z)},[t,J]),ol=c.useCallback(q=>{const Z=E.current;Z&&((q.key==="Delete"||q.key==="Backspace")&&Z.value===""&&J.length>0&&(J[J.length-1].fixed||ot(J[J.length-1])),q.key==="Escape"&&Z.blur())},[ot,J]);c.useEffect(()=>{s&&Ks(s)},[s]),c.useEffect(()=>{if(!l||d)return;const q=Ot(l||[],m);JSON.stringify(q)!==JSON.stringify(bs)&&va(q)},[n,l,m,d,bs]),c.useEffect(()=>{const q=async()=>{pa(!0);const Ce=await d?.(qs);va(Ot(Ce||[],m)),pa(!1)};(async()=>{!d||!K||(P&&await q(),qs&&await q())})()},[qs,m,K,P]);const cl=()=>{if(!N||vx(bs,[{value:us,label:us}])||J.find(Z=>Z.value===us))return;const q=e.jsx(be,{value:us,className:"cursor-pointer",onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation()},onSelect:Z=>{if(J.length>=i){h?.(J.length);return}Ft("");const Ce=[...J,{value:Z,label:Z}];Ks(Ce),t?.(Ce)},children:`Create "${us}"`});if(!d&&us.length>0||d&&qs.length>0&&!fa)return q},dl=c.useCallback(()=>{if(r)return d&&!N&&Object.keys(bs).length===0?e.jsx(be,{value:"-",disabled:!0,children:r}):e.jsx(zr,{children:r})},[N,r,d,bs]),ul=c.useMemo(()=>px(bs,J),[bs,J]),xl=c.useCallback(()=>{if(f?.filter)return f.filter;if(N)return(q,Z)=>q.toLowerCase().includes(Z.toLowerCase())?1:-1},[N,f?.filter]),ml=c.useCallback(()=>{const q=J.filter(Z=>Z.fixed);Ks(q),t?.(q)},[t,J]);return e.jsxs(fs,{...f,onKeyDown:q=>{ol(q),f?.onKeyDown?.(q)},className:y("h-auto overflow-visible bg-transparent",f?.className),shouldFilter:f?.shouldFilter!==void 0?f.shouldFilter:!d,filter:xl(),children:[e.jsx("div",{className:y("rounded-md border border-input text-sm ring-offset-background focus-within:ring-1 focus-within:ring-ring ",{"px-3 py-2":J.length!==0,"cursor-text":!C&&J.length!==0},w),onClick:()=>{C||E.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[J.map(q=>e.jsxs(L,{className:y("data-[disabled]:bg-muted-foreground data-[disabled]:text-muted data-[disabled]:hover:bg-muted-foreground","data-[fixed]:bg-muted-foreground data-[fixed]:text-muted data-[fixed]:hover:bg-muted-foreground",_),"data-fixed":q.fixed,"data-disabled":C||void 0,children:[q.label,e.jsx("button",{className:y("ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",(C||q.fixed)&&"hidden"),onKeyDown:Z=>{Z.key==="Enter"&&ot(q)},onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation()},onClick:()=>ot(q),children:e.jsx(Kt,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},q.value)),e.jsx(we.Input,{...R,ref:E,value:us,disabled:C,onValueChange:q=>{Ft(q),R?.onValueChange?.(q)},onBlur:q=>{Hs.current===!1&&ds(!1),R?.onBlur?.(q)},onFocus:q=>{ds(!0),P&&d?.(qs),R?.onFocus?.(q)},placeholder:T&&J.length!==0?"":a,className:y("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":T,"px-3 py-2":J.length===0,"ml-1":J.length!==0},R?.className)}),e.jsx("button",{type:"button",onClick:ml,className:y((z||C||J.length<1||J.filter(q=>q.fixed).length===J.length)&&"hidden"),children:e.jsx(Kt,{})})]})}),e.jsx("div",{className:"relative",children:K&&e.jsx(ps,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{Hs.current=!1},onMouseEnter:()=>{Hs.current=!0},onMouseUp:()=>{E.current?.focus()},children:fa?e.jsx(e.Fragment,{children:x}):e.jsxs(e.Fragment,{children:[dl(),cl(),!v&&e.jsx(be,{value:"-",className:"hidden"}),Object.entries(ul).map(([q,Z])=>e.jsx(Ve,{heading:q,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:Z.map(Ce=>e.jsx(be,{value:Ce.value,disabled:Ce.disable,onMouseDown:Us=>{Us.preventDefault(),Us.stopPropagation()},onSelect:()=>{if(J.length>=i){h?.(J.length);return}Ft("");const Us=[...J,Ce];Ks(Us),t?.(Us)},className:y("cursor-pointer",Ce.disable&&"cursor-default text-muted-foreground"),children:Ce.label},Ce.value))})},q))]})})})]})});at.displayName="MultipleSelector";const bx=u.object({id:u.number().optional(),name:u.string().min(2,"组名至少需要2个字符").max(50,"组名不能超过50个字符").regex(/^[a-zA-Z0-9\u4e00-\u9fa5_-]+$/,"组名只能包含字母、数字、中文、下划线和连字符")});function Et({refetch:s,dialogTrigger:t,defaultValues:a={name:""},type:n="add"}){const l=ae({resolver:ie(bx),defaultValues:a,mode:"onChange"}),[o,d]=c.useState(!1),[x,r]=c.useState(!1),i=async h=>{r(!0),$c(h).then(()=>{A.success(n==="edit"?"更新成功":"创建成功"),s&&s(),l.reset(),d(!1)}).finally(()=>{r(!1)})};return e.jsxs(ue,{open:o,onOpenChange:d,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("span",{children:"添加权限组"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:n==="edit"?"编辑权限组":"创建权限组"}),e.jsx(Se,{children:n==="edit"?"修改权限组信息,更新后会立即生效。":"创建新的权限组,可以为不同的用户分配不同的权限。"})]}),e.jsx(oe,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[e.jsx(g,{control:l.control,name:"name",render:({field:h})=>e.jsxs(j,{children:[e.jsx(p,{children:"组名称"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入权限组名称",...h,className:"w-full"})}),e.jsx(F,{children:"权限组名称用于标识不同的用户组,建议使用有意义的名称。"}),e.jsx(k,{})]})}),e.jsxs(Ee,{className:"gap-2",children:[e.jsx(it,{asChild:!0,children:e.jsx(D,{type:"button",variant:"outline",children:"取消"})}),e.jsxs(D,{type:"submit",disabled:x||!l.formState.isValid,children:[x&&e.jsx(sa,{className:"mr-2 h-4 w-4 animate-spin"}),n==="edit"?"更新":"创建"]})]})]})})]})]})}const Or=c.createContext(void 0);function yx({children:s,refetch:t}){const[a,n]=c.useState(!1),[l,o]=c.useState(null),[d,x]=c.useState(pe.Shadowsocks);return e.jsx(Or.Provider,{value:{isOpen:a,setIsOpen:n,editingServer:l,setEditingServer:o,serverType:d,setServerType:x,refetch:t},children:s})}function Lr(){const s=c.useContext(Or);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function Lt({dialogTrigger:s,value:t,setValue:a,templateType:n}){c.useEffect(()=>{console.log(t)},[t]);const[l,o]=c.useState(!1),[d,x]=c.useState(()=>{if(!t||Object.keys(t).length===0)return"";try{return JSON.stringify(t,null,2)}catch{return""}}),[r,i]=c.useState(null),h=v=>{if(!v)return null;try{const N=JSON.parse(v);return typeof N!="object"||N===null?"配置必须是一个JSON对象":null}catch{return"无效的JSON格式"}},T={tcp:{label:"TCP",content:{acceptProxyProtocol:!1,header:{type:"none"}}},"tcp-http":{label:"TCP + HTTP",content:{acceptProxyProtocol:!1,header:{type:"http",request:{version:"1.1",method:"GET",path:["/"],headers:{Host:["www.example.com"]}},response:{version:"1.1",status:"200",reason:"OK"}}}},grpc:{label:"gRPC",content:{serviceName:"GunService"}},ws:{label:"WebSocket",content:{path:"/",headers:{Host:"v2ray.com"}}}},C=()=>{switch(n){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];default:return[]}},m=()=>{const v=h(d||"");if(v){A.error(v);return}try{if(!d){a(null),o(!1);return}a(JSON.parse(d)),o(!1)}catch{A.error("保存时发生错误")}},w=v=>{x(v),i(h(v))},_=v=>{const N=T[v];if(N){const P=JSON.stringify(N.content,null,2);x(P),i(null)}};return c.useEffect(()=>{l&&console.log(t)},[l,t]),c.useEffect(()=>{l&&t&&Object.keys(t).length>0&&x(JSON.stringify(t,null,2))},[l,t]),e.jsxs(ue,{open:l,onOpenChange:v=>{!v&&l&&m(),o(v)},children:[e.jsx(Re,{asChild:!0,children:s??e.jsx(W,{variant:"link",children:"编辑协议"})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(je,{children:e.jsx(xe,{children:"编辑协议配置"})}),e.jsxs("div",{className:"space-y-4",children:[C().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:C().map(v=>e.jsxs(W,{variant:"outline",size:"sm",onClick:()=>_(v),children:["使用",T[v].label,"模板"]},v))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(vs,{className:`min-h-[200px] font-mono text-sm ${r?"border-red-500 focus-visible:ring-red-500":""}`,value:d,placeholder:`请输入JSON配置${C().length>0?"或选择上方模板":""}`,onChange:v=>w(v.target.value)}),r&&e.jsx("p",{className:"text-sm text-red-500",children:r})]})]}),e.jsxs(Ee,{className:"gap-2",children:[e.jsx(W,{variant:"outline",onClick:()=>o(!1),children:"取消"}),e.jsx(W,{onClick:m,disabled:!!r,children:"确定"})]})]})]})}function bh(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const Nx={},wx=Object.freeze(Object.defineProperty({__proto__:null,default:Nx},Symbol.toStringTag,{value:"Module"})),yh=_o(wx),$a=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),_x=()=>{try{const s=mo.box.keyPair(),t=$a(ka.encodeBase64(s.secretKey)),a=$a(ka.encodeBase64(s.publicKey));return{privateKey:t,publicKey:a}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},Cx=()=>{try{return _x()}catch(s){throw console.error("Error generating key pair:",s),s}},Sx=s=>{const t=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(t),Array.from(t).map(a=>a.toString(16).padStart(2,"0")).join("").substring(0,s)},kx=()=>{const s=Math.floor(Math.random()*8)*2+2;return Sx(s)},Dx=u.object({cipher:u.string().default("aes-128-gcm"),obfs:u.string().default("0"),obfs_settings:u.object({path:u.string().default(""),host:u.string().default("")}).default({})}),Tx=u.object({tls:u.coerce.number().default(0),tls_settings:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({})}),Px=u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({})}),Ix=u.object({version:u.coerce.number().default(2),alpn:u.string().default("h2"),obfs:u.object({open:u.coerce.boolean().default(!1),type:u.string().default("salamander"),password:u.string().default("")}).default({}),tls:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),bandwidth:u.object({up:u.string().default(""),down:u.string().default("")}).default({})}),Vx=u.object({tls:u.coerce.number().default(0),tls_settings:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),reality_settings:u.object({server_port:u.coerce.number().default(443),server_name:u.string().default(""),allow_insecure:u.boolean().default(!1),public_key:u.string().default(""),private_key:u.string().default(""),short_id:u.string().default("")}).default({}),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({}),flow:u.string().default("")}),es={shadowsocks:{schema:Dx,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"]},vmess:{schema:Tx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:Px,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Ix,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:Vx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"},{value:"kcp",label:"mKCP"},{value:"httpupgrade",label:"HttpUpgrade"},{value:"xhttp",label:"XHTTP"}],flowOptions:["none","xtls-rprx-direct","xtls-rprx-splice","xtls-rprx-vision"]}},Rx=({serverType:s,value:t,onChange:a})=>{const n=s?es[s]:null,l=n?.schema||u.record(u.any()),o=s?l.parse({}):{},d=ae({resolver:ie(l),defaultValues:o,mode:"onChange"});return c.useEffect(()=>{if(!t||Object.keys(t).length===0){if(s){const m=l.parse({});d.reset(m)}}else d.reset(t)},[s,t,a,d,l]),c.useEffect(()=>{const m=d.watch(w=>{a(w)});return()=>m.unsubscribe()},[d,a]),!s||!n?null:{shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"cipher",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"加密算法"}),e.jsx(b,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择加密算法"})}),e.jsx(B,{children:e.jsx(xs,{children:es.shadowsocks.ciphers.map(w=>e.jsx(O,{value:w,children:w},w))})})]})})]})}),e.jsx(g,{control:d.control,name:"obfs",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"混淆"}),e.jsx(b,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择混淆方式"})}),e.jsx(B,{children:e.jsxs(xs,{children:[e.jsx(O,{value:"0",children:"无"}),e.jsx(O,{value:"http",children:"HTTP"})]})})]})})]})}),d.watch("obfs")==="http"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"obfs_settings.path",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:e.jsx(S,{type:"text",placeholder:"路径",...m})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"obfs_settings.host",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:e.jsx(S,{type:"text",placeholder:"Host",...m})}),e.jsx(k,{})]})})]})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"tls",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"TLS"}),e.jsx(b,{children:e.jsxs(G,{value:m.value?.toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择安全性"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"不支持"}),e.jsx(O,{value:"1",children:"支持"})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"服务器名称指示(SNI)"}),e.jsx(b,{children:e.jsx(S,{placeholder:"不使用请留空",...m})})]})}),e.jsx(g,{control:d.control,name:"tls_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(p,{children:["传输协议",e.jsx(Lt,{value:d.watch("network_settings"),setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")})]}),e.jsx(b,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择传输协议"})}),e.jsx(B,{children:e.jsx(xs,{children:es.vmess.networkOptions.map(w=>e.jsx(O,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"服务器名称指示(SNI)"}),e.jsx(b,{children:e.jsx(S,{placeholder:"当节点地址于证书不一致时用于证书验证",...m,value:m.value||""})})]})}),e.jsx(g,{control:d.control,name:"allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(p,{children:["传输协议",e.jsx(Lt,{value:d.watch("network_settings")||{},setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")||"tcp"})]}),e.jsx(b,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value||"tcp",children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择传输协议"})}),e.jsx(B,{children:e.jsx(xs,{children:es.trojan.networkOptions.map(w=>e.jsx(O,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"version",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"协议版本"}),e.jsx(b,{children:e.jsxs(G,{value:(m.value||2).toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"协议版本"})}),e.jsx(B,{children:e.jsx(xs,{children:es.hysteria.versions.map(w=>e.jsxs(O,{value:w,className:"cursor-pointer",children:["V",w]},w))})})]})})]})}),d.watch("version")==1&&e.jsx(g,{control:d.control,name:"alpn",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"ALPN"}),e.jsx(b,{children:e.jsxs(G,{value:m.value||"h2",onValueChange:m.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"ALPN"})}),e.jsx(B,{children:e.jsx(xs,{children:es.hysteria.alpnOptions.map(w=>e.jsx(O,{value:w,children:w},w))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"obfs.open",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"混淆"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})}),!!d.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[d.watch("version")=="2"&&e.jsx(g,{control:d.control,name:"obfs.type",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"混淆实现"}),e.jsx(b,{children:e.jsxs(G,{value:m.value||"salamander",onValueChange:m.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择混淆实现"})}),e.jsx(B,{children:e.jsx(xs,{children:e.jsx(O,{value:"salamander",children:"Salamander"})})})]})})]})}),e.jsx(g,{control:d.control,name:"obfs.password",render:({field:m})=>e.jsxs(j,{className:d.watch("version")==2?"w-full":"flex-[2]",children:[e.jsx(p,{children:"混淆密码"}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(S,{placeholder:"请输入混淆密码",...m,value:m.value||"",className:"pr-9"})}),e.jsx(W,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",_=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(v=>w[v%w.length]).join("");d.setValue("obfs.password",_),A.success("混淆密码生成成功")},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(ve,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})]})]})})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"服务器名称指示(SNI)"}),e.jsx(b,{children:e.jsx(S,{placeholder:"当节点地址于证书不一致时用于证书验证",...m,value:m.value||""})})]})}),e.jsx(g,{control:d.control,name:"tls.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"bandwidth.up",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"上行宽带"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入上行宽带"+(d.watch("version")==2?",留空则使用BBR":""),className:"rounded-br-none rounded-tr-none",...m,value:m.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:"Mbps"})})]})]})}),e.jsx(g,{control:d.control,name:"bandwidth.down",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"下行宽带"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入下行宽带"+(d.watch("version")==2?",留空则使用BBR":""),className:"rounded-br-none rounded-tr-none",...m,value:m.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:"Mbps"})})]})]})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"tls",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"安全性"}),e.jsx(b,{children:e.jsxs(G,{value:m.value?.toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择安全性"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"无"}),e.jsx(O,{value:"1",children:"TLS"}),e.jsx(O,{value:"2",children:"Reality"})]})]})})]})}),d.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"服务器名称指示(SNI)"}),e.jsx(b,{children:e.jsx(S,{placeholder:"不使用请留空",...m})})]})}),e.jsx(g,{control:d.control,name:"tls_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),d.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"reality_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"伪装站点(dest)"}),e.jsx(b,{children:e.jsx(S,{placeholder:"例如:example.com",...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.server_port",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"端口(port)"}),e.jsx(b,{children:e.jsx(S,{placeholder:"例如:443",...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(g,{control:d.control,name:"reality_settings.private_key",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"私钥(Private key)"}),e.jsx(b,{children:e.jsx(S,{...m})})]})}),e.jsxs(W,{variant:"outline",className:"",onClick:()=>{try{const m=Cx();d.setValue("reality_settings.private_key",m.privateKey),d.setValue("reality_settings.public_key",m.publicKey),A.success("密钥对生成成功")}catch{A.error("生成密钥对失败")}},children:[e.jsx(ve,{icon:"ion:key-outline",className:"mr-2 h-4 w-4"}),"生成密钥对"]})]}),e.jsx(g,{control:d.control,name:"reality_settings.public_key",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"公钥(Public key)"}),e.jsx(b,{children:e.jsx(S,{...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.short_id",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"Short ID"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{children:e.jsx(S,{...m,placeholder:"可留空,长度为2的倍数,最长16位"})}),e.jsxs(W,{variant:"outline",onClick:()=>{const w=kx();d.setValue("reality_settings.short_id",w),A.success("Short ID 生成成功")},children:[e.jsx(ve,{icon:"ion:refresh-outline",className:"mr-2 h-4 w-4"}),"生成"]})]}),e.jsx(F,{className:"text-xs text-muted-foreground",children:"客户端可用的 shortId 列表,可用于区分不同的客户端,使用0-f的十六进制字符"})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(p,{children:["传输协议",e.jsx(Lt,{value:d.watch("network_settings"),setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")})]}),e.jsx(b,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择传输协议"})}),e.jsx(B,{children:e.jsx(xs,{children:es.vless.networkOptions.map(w=>e.jsx(O,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})}),e.jsx(g,{control:d.control,name:"flow",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"流控"}),e.jsx(b,{children:e.jsxs(G,{onValueChange:w=>m.onChange(w==="none"?null:w),value:m.value||"none",children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择流控"})}),e.jsx(B,{children:es.vless.flowOptions.map(w=>e.jsx(O,{value:w,children:w},w))})]})})]})})]})}[s]?.()},Ex=u.object({id:u.number().optional().nullable(),code:u.string().optional(),name:u.string().min(1,"Please enter a valid name."),rate:u.string().min(1,"Please enter a valid rate."),tags:u.array(u.string()).default([]),excludes:u.array(u.string()).default([]),ips:u.array(u.string()).default([]),group_ids:u.array(u.string()).default([]),host:u.string().min(1,"Please enter a valid host."),port:u.string().min(1,"Please enter a valid port."),server_port:u.string().min(1,"Please enter a valid server port."),parent_id:u.string().default("0").nullable(),route_ids:u.array(u.string()).default([]),protocol_settings:u.record(u.any()).default({}).nullable()}),xt={id:null,code:"",name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null};function Fx(){const{isOpen:s,setIsOpen:t,editingServer:a,setEditingServer:n,serverType:l,setServerType:o,refetch:d}=Lr(),[x,r]=c.useState([]),[i,h]=c.useState([]),[T,C]=c.useState([]),m=ae({resolver:ie(Ex),defaultValues:xt,mode:"onChange"});c.useEffect(()=>{w()},[s]),c.useEffect(()=>{a?.type&&a.type!==l&&o(a.type)},[a,l,o]),c.useEffect(()=>{a?a.type===l&&m.reset({...xt,...a}):m.reset({...xt,protocol_settings:es[l].schema.parse({})})},[a,m,l]);const w=async()=>{if(!s)return;const[f,R,z]=await Promise.all([Vt(),jr(),hr()]);r(f.data?.map($=>({label:$.name,value:$.id.toString()}))||[]),h(R.data?.map($=>({label:$.remarks,value:$.id.toString()}))||[]),C(z.data||[])},_=c.useMemo(()=>T?.filter(f=>(f.parent_id===0||f.parent_id===null)&&f.type===l&&f.id!==m.watch("id")),[l,T,m]),v=()=>e.jsxs(Ns,{children:[e.jsx(ws,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"添加节点"})]})}),e.jsx(gs,{align:"start",children:e.jsx(ic,{children:ys.map(({type:f,label:R})=>e.jsx(he,{onClick:()=>{o(f),t(!0)},className:"cursor-pointer",children:e.jsx(L,{variant:"outline",className:"text-white",style:{background:ts[f]},children:R})},f))})})]}),N=()=>{t(!1),n(null),m.reset(xt)},P=async()=>{const f=m.getValues();(await Fc({...f,type:l})).data&&(N(),A.success("提交成功"),d())};return e.jsxs(ue,{open:s,onOpenChange:N,children:[v(),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:a?"编辑节点":"新建节点"}),e.jsx(Se,{})]}),e.jsxs(oe,{...m,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:m.control,name:"name",render:({field:f})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"节点名称"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入节点名称",...f})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"rate",render:({field:f})=>e.jsxs(j,{className:"flex-[1]",children:[e.jsx(p,{children:"倍率"}),e.jsx("div",{className:"relative flex",children:e.jsx(b,{children:e.jsx(S,{type:"number",min:"0",step:"0.1",...f})})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:m.control,name:"code",render:({field:f})=>e.jsxs(j,{children:[e.jsxs(p,{children:["自定义节点ID",e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(选填)"})]}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入自定义节点ID",...f,value:f.value||""})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"tags",render:({field:f})=>e.jsxs(j,{children:[e.jsx(p,{children:"节点标签"}),e.jsx(b,{children:e.jsx(ua,{value:f.value,onChange:f.onChange,placeholder:"输入后回车添加标签",className:"w-full"})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"group_ids",render:({field:f})=>e.jsxs(j,{children:[e.jsxs(p,{className:"flex items-center justify-between",children:["权限组",e.jsx(Et,{dialogTrigger:e.jsx(D,{variant:"link",children:"添加权限组"}),refetch:w})]}),e.jsx(b,{children:e.jsx(at,{options:x,onChange:R=>f.onChange(R.map(z=>z.value)),value:x?.filter(R=>f.value.includes(R.value)),placeholder:"请选择权限组",emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:"no results found."})})}),e.jsx(k,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:m.control,name:"host",render:({field:f})=>e.jsxs(j,{children:[e.jsx(p,{children:"节点地址"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入节点域名或者IP",...f})}),e.jsx(k,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(g,{control:m.control,name:"port",render:({field:f})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(p,{className:"flex items-center gap-1.5",children:["连接端口",e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(ve,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Da,{children:e.jsx(ee,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:"用户实际连接使用的端口,这是客户端配置中需要填写的端口号。如果使用了中转或隧道,这个端口可能与服务器实际监听的端口不同。"})})})]})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(b,{children:e.jsx(S,{placeholder:"用户连接端口",...f})}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(D,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const R=f.value;R&&m.setValue("server_port",R)},children:e.jsx(ve,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"同步到服务端口"})})]})})]}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"server_port",render:({field:f})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(p,{className:"flex items-center gap-1.5",children:["服务端口",e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(ve,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Da,{children:e.jsx(ee,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:"服务器实际监听的端口,这是在服务器上开放的真实端口。如果使用了中转或隧道,这个端口可能与用户连接端口不同。"})})})]})})]}),e.jsx(b,{children:e.jsx(S,{placeholder:"服务端开放端口",...f})}),e.jsx(k,{})]})})]})]}),s&&e.jsx(Rx,{serverType:l,value:m.watch("protocol_settings"),onChange:f=>m.setValue("protocol_settings",f,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(g,{control:m.control,name:"parent_id",render:({field:f})=>e.jsxs(j,{children:[e.jsx(p,{children:"父节点"}),e.jsxs(G,{onValueChange:f.onChange,value:f.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"选择父节点"})})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"无"}),_?.map(R=>e.jsx(O,{value:R.id.toString(),className:"cursor-pointer",children:R.name},R.id))]})]}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"route_ids",render:({field:f})=>e.jsxs(j,{children:[e.jsx(p,{children:"路由组"}),e.jsx(b,{children:e.jsx(at,{options:i,onChange:R=>f.onChange(R.map(z=>z.value)),value:i?.filter(R=>f.value.includes(R.value)),placeholder:"选择路由组",emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:"no results found."})})}),e.jsx(k,{})]})})]}),e.jsxs(Ee,{className:"mt-6",children:[e.jsx(D,{type:"button",variant:"outline",onClick:N,children:"取消"}),e.jsx(D,{type:"submit",onClick:P,children:"提交"})]})]})]})]})}function Aa({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(o=>l.has(o.value)).map(o=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(fs,{children:[e.jsx(Ds,{placeholder:t}),e.jsxs(ps,{children:[e.jsx(Ts,{children:"No results found."}),e.jsx(Ve,{children:a.map(o=>{const d=l.has(o.value);return e.jsxs(be,{onSelect:()=>{d?l.delete(o.value):l.add(o.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},className:"cursor-pointer",children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Cs,{className:y("h-4 w-4")})}),o.icon&&e.jsx(o.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${o.color}`}),e.jsx("span",{children:o.label}),n?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(o.value)})]},o.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(As,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Mx=[{value:pe.Shadowsocks,label:ys.find(s=>s.type===pe.Shadowsocks)?.label,color:ts[pe.Shadowsocks]},{value:pe.Vmess,label:ys.find(s=>s.type===pe.Vmess)?.label,color:ts[pe.Vmess]},{value:pe.Trojan,label:ys.find(s=>s.type===pe.Trojan)?.label,color:ts[pe.Trojan]},{value:pe.Hysteria,label:ys.find(s=>s.type===pe.Hysteria)?.label,color:ts[pe.Hysteria]},{value:pe.Vless,label:ys.find(s=>s.type===pe.Vless)?.label,color:ts[pe.Vless]}];function zx({table:s,saveOrder:t,isSortMode:a,groups:n}){const l=s.getState().columnFilters.length>0,o=n.map(d=>({label:d,value:d}));return e.jsxs("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:[!a&&e.jsxs(e.Fragment,{children:[e.jsx(Fx,{}),e.jsx(S,{placeholder:"搜索节点...",value:s.getColumn("name")?.getFilterValue()??"",onChange:d=>s.getColumn("name")?.setFilterValue(d.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(Aa,{column:s.getColumn("type"),title:"类型",options:Mx}),s.getColumn("groups")&&e.jsx(Aa,{column:s.getColumn("groups"),title:"权限组",options:o})]}),l&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),a&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽节点进行排序,完成后点击保存"})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(D,{variant:a?"default":"outline",onClick:t,size:"sm",children:a?"保存排序":"编辑排序"})})]})}const nt=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.71 12.71a6 6 0 1 0-7.42 0a10 10 0 0 0-6.22 8.18a1 1 0 0 0 2 .22a8 8 0 0 1 15.9 0a1 1 0 0 0 1 .89h.11a1 1 0 0 0 .88-1.1a10 10 0 0 0-6.25-8.19M12 12a4 4 0 1 1 4-4a4 4 0 0 1-4 4"})}),mt={0:"bg-destructive/80 shadow-sm shadow-destructive/50",1:"bg-yellow-500/80 shadow-sm shadow-yellow-500/50",2:"bg-emerald-500/80 shadow-sm shadow-emerald-500/50"},ht={0:"未运行",1:"无人使用或异常",2:"运行正常"},Ox=s=>[{id:"drag-handle",header:({column:t})=>e.jsx(I,{column:t,title:"排序"}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Dt,{className:"size-4 cursor-move text-muted-foreground transition-colors hover:text-primary","aria-hidden":"true"})}),size:50},{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"节点ID"}),cell:({row:t})=>{const a=t.getValue("id"),n=t.original.code;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(L,{variant:"outline",className:y("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:ts[t.original.type]},children:[e.jsx($n,{className:"size-3"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"flex items-center gap-0.5",children:n??a}),t.original.parent?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground/30",children:"→"}),e.jsx("span",{children:t.original.parent?.code||t.original.parent?.id})]}):""]})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:text-muted-foreground group-hover/id:opacity-100",onClick:l=>{l.stopPropagation(),Nt(n||a.toString())},children:e.jsx(Ta,{className:"size-3"})})]})}),e.jsxs(ee,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[ys.find(l=>l.type===t.original.type)?.label,t.original.parent_id?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:200,enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"显隐"}),cell:({row:t})=>{const[a,n]=c.useState(!!t.getValue("show"));return e.jsx(H,{checked:a,onCheckedChange:async l=>{n(l),Oc({id:t.original.id,type:t.original.type,show:l?1:0}).catch(()=>{n(!l),s()})},style:{backgroundColor:a?ts[t.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(I,{column:t,title:"节点",tooltip:e.jsxs("div",{className:"grid grid-cols-1 gap-3 p-2",children:[e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:y("h-2.5 w-2.5 rounded-full",mt[0])}),e.jsx("span",{className:"text-sm font-medium",children:ht[0]})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:y("h-2.5 w-2.5 rounded-full",mt[1])}),e.jsx("span",{className:"text-sm font-medium",children:ht[1]})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:y("h-2.5 w-2.5 rounded-full",mt[2])}),e.jsx("span",{className:"text-sm font-medium",children:ht[2]})]})]})})}),cell:({row:t})=>e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:y("size-2.5 flex-shrink-0 rounded-full transition-all duration-200",mt[t.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:t.getValue("name")})]})}),e.jsx(ee,{children:e.jsx("p",{className:"font-medium",children:ht[t.original.available_status]})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:t})=>e.jsx(I,{column:t,title:"地址"}),cell:({row:t})=>{const a=`${t.original.host}:${t.original.port}`,n=t.original.port!==t.original.server_port;return e.jsxs("div",{className:"group relative flex min-w-0 items-start",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-1 gap-y-0.5 pr-7",children:[e.jsx("div",{className:"flex items-center ",children:e.jsxs("span",{className:"font-mono text-sm font-medium text-foreground/90",children:[t.original.host,":",t.original.port]})}),n&&e.jsxs("span",{className:"whitespace-nowrap text-[0.7rem] tracking-tight text-muted-foreground/40",children:["(内部端口 ",t.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(le,{delayDuration:0,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(D,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:bg-muted/50 hover:text-muted-foreground group-hover:opacity-100",onClick:l=>{l.stopPropagation(),Nt(a)},children:e.jsx(Ta,{className:"size-3"})})}),e.jsx(ee,{side:"top",sideOffset:10,children:"复制连接地址"})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:t})=>e.jsx(I,{column:t,title:"在线人数",tooltip:"在线人数根据服务端上报频率而定"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(nt,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("online")})]}),size:80,enableSorting:!0,enableHiding:!0},{accessorKey:"rate",header:({column:t})=>e.jsx(I,{column:t,title:"倍率",tooltip:"流量扣费倍率"}),cell:({row:t})=>e.jsxs(L,{variant:"secondary",className:"font-medium",children:[t.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"groups",header:({column:t})=>e.jsx(I,{column:t,title:"权限组",tooltip:"可订阅到该节点的权限组"}),cell:({row:t})=>{const a=t.getValue("groups")||[];return e.jsx("div",{className:"flex min-w-[300px] max-w-[600px] flex-wrap items-center gap-1.5",children:a.length>0?a.map((n,l)=>e.jsx(L,{variant:"secondary",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"),children:n.name},l)):e.jsx("span",{className:"text-sm text-muted-foreground",children:"--"})})},enableSorting:!1,size:600,filterFn:(t,a,n)=>{const l=t.getValue(a);return l?n.some(o=>l.includes(o)):!1}},{accessorKey:"type",header:({column:t})=>e.jsx(I,{column:t,title:"类型"}),cell:({row:t})=>{const a=t.getValue("type");return e.jsx(L,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:ts[a]},children:a})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{setIsOpen:a,setEditingServer:n,setServerType:l}=Lr();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(Ns,{modal:!1,children:[e.jsx(ws,{asChild:!0,children:e.jsx(D,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":"打开操作菜单",children:e.jsx(bt,{className:"size-4"})})}),e.jsxs(gs,{align:"end",className:"w-40",children:[e.jsx(he,{className:"cursor-pointer",onClick:()=>{l(t.original.type),n(t.original),a(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(ho,{className:"mr-2 size-4"}),"编辑"]})}),e.jsxs(he,{className:"cursor-pointer",onClick:async()=>{zc({id:t.original.id}).then(({data:o})=>{o&&(A.success("复制成功"),s())})},children:[e.jsx(jo,{className:"mr-2 size-4"}),"复制"]}),e.jsx(Xs,{}),e.jsx(he,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:o=>o.preventDefault(),children:e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该节点,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Mc({id:t.original.id}).then(({data:o})=>{o&&(A.success("删除成功"),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(rs,{className:"mr-2 size-4"}),"删除"]})})})]})]})})},size:50}];function Lx(){const[s,t]=c.useState({}),[a,n]=c.useState({"drag-handle":!1}),[l,o]=c.useState([]),[d,x]=c.useState({pageSize:500,pageIndex:0}),[r,i]=c.useState([]),[h,T]=c.useState(!1),[C,m]=c.useState({}),[w,_]=c.useState([]),{refetch:v}=Q({queryKey:["nodeList"],queryFn:async()=>{const{data:$}=await hr();return _($),$}}),N=c.useMemo(()=>{const $=new Set;return w.forEach(E=>{E.groups&&E.groups.forEach(K=>$.add(K.name))}),Array.from($).sort()},[w]);c.useEffect(()=>{n({"drag-handle":h,show:!h,host:!h,online:!h,rate:!h,groups:!h,type:!1,actions:!h}),m({name:h?2e3:200}),x({pageSize:h?99999:500,pageIndex:0})},[h]);const P=($,E)=>{h&&($.dataTransfer.setData("text/plain",E.toString()),$.currentTarget.classList.add("opacity-50"))},f=($,E)=>{if(!h)return;$.preventDefault(),$.currentTarget.classList.remove("bg-muted");const K=parseInt($.dataTransfer.getData("text/plain"));if(K===E)return;const ds=[...w],[Hs]=ds.splice(K,1);ds.splice(E,0,Hs),_(ds)},R=async()=>{if(!h){T(!0);return}const $=w?.map((E,K)=>({id:E.id,order:K+1}));Lc($).then(()=>{A.success("排序保存成功"),T(!1),v()}).finally(()=>{T(!1)})},z=Le({data:w||[],columns:Ox(v),state:{sorting:r,columnVisibility:a,rowSelection:s,columnFilters:l,columnSizing:C,pagination:d},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:i,onColumnFiltersChange:o,onColumnVisibilityChange:n,onColumnSizingChange:m,onPaginationChange:x,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(yx,{refetch:v,children:e.jsx("div",{className:"space-y-4",children:e.jsx(Ge,{table:z,toolbar:$=>e.jsx(zx,{table:$,refetch:v,saveOrder:R,isSortMode:h,groups:N}),draggable:h,onDragStart:P,onDragEnd:$=>$.currentTarget.classList.remove("opacity-50"),onDragOver:$=>{$.preventDefault(),$.currentTarget.classList.add("bg-muted")},onDragLeave:$=>$.currentTarget.classList.remove("bg-muted"),onDrop:f,showPagination:!h})})})}function $x(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"节点管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"管理所有节点,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Lx,{})})]})]})}const Ax=Object.freeze(Object.defineProperty({__proto__:null,default:$x},Symbol.toStringTag,{value:"Module"}));function Hx({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsx("div",{className:"flex items-center justify-between space-x-4",children:e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(Et,{refetch:t}),e.jsx(S,{placeholder:"搜索权限组...",value:s.getColumn("name")?.getFilterValue()??"",onChange:n=>s.getColumn("name")?.setFilterValue(n.target.value),className:y("h-8 w-[150px] lg:w-[250px]",a&&"border-primary/50 ring-primary/20")}),a&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})})}const Kx=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"组ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(L,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:t})=>e.jsx(I,{column:t,title:"组名称"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium",children:t.getValue("name")})})},{accessorKey:"users_count",header:({column:t})=>e.jsx(I,{column:t,title:"用户数量"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"server_count",header:({column:t})=>e.jsx(I,{column:t,title:"节点数量"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx($n,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("server_count")})]}),enableSorting:!0,size:8e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Et,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(ks,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]})}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该权限组,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Ac({id:t.original.id}).then(({data:a})=>{a&&(A.success("删除成功"),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}];function qx(){const[s,t]=c.useState({}),[a,n]=c.useState({}),[l,o]=c.useState([]),[d,x]=c.useState([]),{data:r,refetch:i,isLoading:h}=Q({queryKey:["serverGroupList"],queryFn:async()=>{const{data:C}=await Vt();return C}}),T=Le({data:r||[],columns:Kx(i),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:T,toolbar:C=>e.jsx(Hx,{table:C,refetch:i}),isLoading:h})}function Ux(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"权限组管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"管理所有权限组,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(qx,{})})]})]})}const Bx=Object.freeze(Object.defineProperty({__proto__:null,default:Ux},Symbol.toStringTag,{value:"Module"})),Gx=u.object({remarks:u.string().min(1,"Please enter a valid remarks."),match:u.array(u.string()),action:u.enum(["block","dns"]),action_value:u.string().optional()});function $r({refetch:s,dialogTrigger:t,defaultValues:a={remarks:"",match:[],action:"block",action_value:""},type:n="add"}){const l=ae({resolver:ie(Gx),defaultValues:a,mode:"onChange"}),[o,d]=c.useState(!1);return e.jsxs(ue,{open:o,onOpenChange:d,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"})," ",e.jsx("div",{children:"添加路由"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:n==="edit"?"编辑路由":"创建路由"}),e.jsx(Se,{})]}),e.jsxs(oe,{...l,children:[e.jsx(g,{control:l.control,name:"remarks",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"备注"}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(S,{type:"text",placeholder:"请输入备注",...x})})}),e.jsx(k,{})]})}),e.jsx(g,{control:l.control,name:"match",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"备注"}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(vs,{className:"min-h-[120px]",placeholder:`example.com +import{r as c,j as e,t as xl,c as ml,I as Na,a as Ss,S as Qt,u as ns,b as Zt,d as hl,O as Xt,e as jl,f as A,g as gl,h as fl,i as pl,Q as vl,k as bl,R as yl,l as Nl,P as wl,m as _l,B as Cl,n as Ua,F as Sl,C as kl,o as Tl,p as Dl,q as Pl,s as Vl,v as Il,z as u,w as Ba,x as ae,y as ie,A as Ga,D as _t,E as Ct,G as ea,H as Fe,T as St,J as kt,K as Ya,L as Wa,M as Rl,N as El,U as Fl,V as Ml,W as Ja,X as sa,Y as Qa,Z as zl,_ as Za,$ as Xa,a0 as en,a1 as sn,a2 as ks,a3 as tn,a4 as Ol,a5 as an,a6 as nn,a7 as Ll,a8 as $l,a9 as Al,aa as Hl,ab as rn,ac as Kl,ad as ql,ae as Ts,af as ln,ag as Ul,ah as Bl,ai as on,aj as Gl,ak as Yl,al as wa,am as Wl,an as cn,ao as Jl,ap as dn,aq as Ql,ar as Zl,as as Xl,at as ei,au as si,av as ti,aw as un,ax as ai,ay as ni,az as ri,aA as we,aB as li,aC as ii,aD as oi,aE as ci,aF as xn,aG as mn,aH as hn,aI as di,aJ as jn,aK as gn,aL as fn,aM as ui,aN as xi,aO as mi,aP as pn,aQ as hi,aR as ta,aS as vn,aT as ji,aU as bn,aV as gi,aW as yn,aX as fi,aY as Nn,aZ as wn,a_ as pi,a$ as vi,b0 as _n,b1 as bi,b2 as yi,b3 as Cn,b4 as Ni,b5 as Sn,b6 as wi,b7 as _i,b8 as Le,b9 as Q,ba as Pe,bb as lt,bc as Ci,bd as Si,be as ki,bf as Ti,bg as Di,bh as Pi,bi as _a,bj as Ca,bk as Vi,bl as Ii,bm as Ri,bn as Ei,bo as Fi,bp as At,bq as Ht,br as Mi,bs as zi,bt as kn,bu as Oi,bv as Li,bw as Tn,bx as $i,by as de,bz as Ai,bA as Sa,bB as Kt,bC as qt,bD as Hi,bE as Ki,bF as Dn,bG as qi,bH as aa,bI as Ui,bJ as Bi,bK as Gi,bL as Pn,bM as Vn,bN as In,bO as Yi,bP as Wi,bQ as Ji,bR as Qi,bS as Rn,bT as Zi,bU as We,bV as Xi,bW as eo,bX as vt,bY as ve,bZ as ka,b_ as so,b$ as En,c0 as Fn,c1 as Mn,c2 as zn,c3 as On,c4 as Ln,c5 as to,c6 as ao,c7 as no,c8 as Tt,c9 as Ds,ca as rs,cb as Me,cc as ze,cd as Ae,ce as He,cf as Ke,cg as ro,ch as lo,ci as io,cj as Ut,ck as na,cl as ra,cm as oo,cn as ls,co as is,cp as it,cq as co,cr as uo,cs as Ta,ct as Da,cu as $n,cv as Pa,cw as bt,cx as xo,cy as mo,cz as An,cA as ho,cB as jo,cC as Hn,cD as Bt,cE as Kn,cF as go,cG as qn,cH as Un,cI as fo,cJ as po,cK as vo,cL as bo,cM as yo}from"./vendor.js";import"./index.js";var fh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ph(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function No(s){if(s.__esModule)return s;var t=s.default;if(typeof t=="function"){var a=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};a.prototype=t.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(s).forEach(function(n){var l=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(a,n,l.get?l:{enumerable:!0,get:function(){return s[n]}})}),a}const wo={theme:"system",setTheme:()=>null},Bn=c.createContext(wo);function _o({children:s,defaultTheme:t="system",storageKey:a="vite-ui-theme",...n}){const[l,o]=c.useState(()=>localStorage.getItem(a)||t);c.useEffect(()=>{const x=window.document.documentElement;if(x.classList.remove("light","dark"),l==="system"){const r=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";x.classList.add(r);return}x.classList.add(l)},[l]);const d={theme:l,setTheme:x=>{localStorage.setItem(a,x),o(x)}};return e.jsx(Bn.Provider,{...n,value:d,children:s})}const Co=()=>{const s=c.useContext(Bn);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},So=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),ko=function(s,t){return new URL(s,t).href},Va={},X=function(t,a,n){let l=Promise.resolve();if(a&&a.length>0){const d=document.getElementsByTagName("link"),x=document.querySelector("meta[property=csp-nonce]"),r=x?.nonce||x?.getAttribute("nonce");l=Promise.allSettled(a.map(i=>{if(i=ko(i,n),i in Va)return;Va[i]=!0;const h=i.endsWith(".css"),D=h?'[rel="stylesheet"]':"";if(!!n)for(let w=d.length-1;w>=0;w--){const _=d[w];if(_.href===i&&(!h||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${D}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":So,h||(m.as="script"),m.crossOrigin="",m.href=i,r&&m.setAttribute("nonce",r),document.head.appendChild(m),h)return new Promise((w,_)=>{m.addEventListener("load",w),m.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${i}`)))})}))}function o(d){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=d,window.dispatchEvent(x),!x.defaultPrevented)throw d}return l.then(d=>{for(const x of d||[])x.status==="rejected"&&o(x.reason);return t().catch(o)})};function v(...s){return xl(ml(s))}const As=Ss("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),T=c.forwardRef(({className:s,variant:t,size:a,asChild:n=!1,children:l,disabled:o,loading:d=!1,leftSection:x,rightSection:r,...i},h)=>{const D=n?Qt:"button";return e.jsxs(D,{className:v(As({variant:t,size:a,className:s})),disabled:d||o,ref:h,...i,children:[(x&&d||!x&&!r&&d)&&e.jsx(Na,{className:"mr-2 h-4 w-4 animate-spin"}),!d&&x&&e.jsx("div",{className:"mr-2",children:x}),l,!d&&r&&e.jsx("div",{className:"ml-2",children:r}),r&&d&&e.jsx(Na,{className:"ml-2 h-4 w-4 animate-spin"})]})});T.displayName="Button";function Es({className:s,minimal:t=!1}){const a=ns();return e.jsx("div",{className:v("h-svh w-full",s),children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[!t&&e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"500"}),e.jsxs("span",{className:"font-medium",children:["Oops! Something went wrong ",":')"]}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["We apologize for the inconvenience. ",e.jsx("br",{})," Please try again later."]}),!t&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(T,{variant:"outline",onClick:()=>a(-1),children:"Go Back"}),e.jsx(T,{onClick:()=>a("/"),children:"Back to Home"})]})]})})}function Ia(){const s=ns();return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"404"}),e.jsx("span",{className:"font-medium",children:"Oops! Page Not Found!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["It seems like the page you're looking for ",e.jsx("br",{}),"does not exist or might have been removed."]}),e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(T,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(T,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function To(){return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"503"}),e.jsx("span",{className:"font-medium",children:"Website is under maintenance!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["The site is not available at the moment. ",e.jsx("br",{}),"We'll be back online shortly."]}),e.jsx("div",{className:"mt-6 flex gap-4",children:e.jsx(T,{variant:"outline",children:"Learn more"})})]})})}function Do(s){return typeof s>"u"}function Po(s){return s===null}function Vo(s){return Po(s)||Do(s)}class Io{storage;prefixKey;constructor(t){this.storage=t.storage,this.prefixKey=t.prefixKey}getKey(t){return`${this.prefixKey}${t}`.toUpperCase()}set(t,a,n=null){const l=JSON.stringify({value:a,time:Date.now(),expire:n!==null?new Date().getTime()+n*1e3:null});this.storage.setItem(this.getKey(t),l)}get(t,a=null){const n=this.storage.getItem(this.getKey(t));if(!n)return{value:a,time:0};try{const l=JSON.parse(n),{value:o,time:d,expire:x}=l;return Vo(x)||x>new Date().getTime()?{value:o,time:d}:(this.remove(t),{value:a,time:0})}catch{return this.remove(t),{value:a,time:0}}}remove(t){this.storage.removeItem(this.getKey(t))}clear(){this.storage.clear()}}function Gn({prefixKey:s="",storage:t=sessionStorage}){return new Io({prefixKey:s,storage:t})}const Yn="Xboard_",Ro=function(s={}){return Gn({prefixKey:s.prefixKey||"",storage:localStorage})},Eo=function(s={}){return Gn({prefixKey:s.prefixKey||"",storage:sessionStorage})},Dt=Ro({prefixKey:Yn});Eo({prefixKey:Yn});const Wn="access_token";function Zs(){return Dt.get(Wn)}function Jn(){Dt.remove(Wn)}const Ra=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Fo({children:s}){const t=ns(),a=Zt(),n=Zs();return c.useEffect(()=>{if(!n.value&&!Ra.includes(a.pathname)){const l=encodeURIComponent(a.pathname+a.search);t(`/sign-in?redirect=${l}`)}},[n.value,a.pathname,a.search,t]),Ra.includes(a.pathname)||n.value?e.jsx(e.Fragment,{children:s}):null}const Mo=()=>e.jsx(Fo,{children:e.jsx(Xt,{})}),zo=hl([{path:"/sign-in",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>nc);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(Mo,{}),children:[{path:"/",lazy:async()=>({Component:(await X(()=>Promise.resolve().then(()=>pc),void 0,import.meta.url)).default}),errorElement:e.jsx(Es,{}),children:[{index:!0,lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Ud);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Es,{}),children:[{path:"system",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Yd);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Xd);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>nu);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>cu);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>hu);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>vu);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>_u);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Du);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Eu);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Lu);return{default:s}},void 0,import.meta.url)).default})}]},{path:"payment",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Qu);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>ex);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>ix);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>jx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Es,{}),children:[{path:"manage",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>$x);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Ux);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Qx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Es,{}),children:[{path:"plan",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>lm);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>vm);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Tm);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Es,{}),children:[{path:"manage",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Qm);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>hh);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Es},{path:"/404",Component:Ia},{path:"/503",Component:To},{path:"*",Component:Ia}]),Oo="locale";function Lo(){return Dt.get(Oo)}function Qn(){Jn();const s=window.location.pathname,t=s&&!["/404","/sign-in"].includes(s),a=new URL(window.location.href),l=`${a.pathname.split("/")[1]?`/${a.pathname.split("/")[1]}`:""}#/sign-in`;window.location.href=l+(t?`?redirect=${s}`:"")}const $o=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function Ao(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const I=jl.create({baseURL:Ao(),timeout:12e3,headers:{"Content-Type":"application/json"}});I.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const t=Zs();if(!$o.includes(s.url?.split("?")[0]||"")){if(!t.value)return Qn(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=t.value}return s.headers["Content-Language"]=Lo().value||"zh-CN",s},s=>Promise.reject(s));I.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const t=s.response?.status,a=s.response?.data?.message;return(t===401||t===403)&&Qn(),A.error(a||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[t]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});function Ho(){return I.get("/user/info")}const Mt={token:Zs()?.value||"",userInfo:null,isLoggedIn:!!Zs()?.value,loading:!1,error:null},Js=gl("user/fetchUserInfo",async()=>(await Ho()).data,{condition:(s,{getState:t})=>{const{user:a}=t();return!!a.token&&!a.loading}}),Zn=fl({name:"user",initialState:Mt,reducers:{setToken(s,t){s.token=t.payload,s.isLoggedIn=!!t.payload},resetUserState:()=>Mt},extraReducers:s=>{s.addCase(Js.pending,t=>{t.loading=!0,t.error=null}).addCase(Js.fulfilled,(t,a)=>{t.loading=!1,t.userInfo=a.payload,t.error=null}).addCase(Js.rejected,(t,a)=>{if(t.loading=!1,t.error=a.error.message||"Failed to fetch user info",!t.token)return Mt})}}),{setToken:Ko,resetUserState:qo}=Zn.actions,Uo=s=>s.user.userInfo,Bo=Zn.reducer,Xn=pl({reducer:{user:Bo}});Zs()?.value&&Xn.dispatch(Js());const Go=new vl;bl.createRoot(document.getElementById("root")).render(e.jsx(yl.StrictMode,{children:e.jsx(Nl,{client:Go,children:e.jsx(wl,{store:Xn,children:e.jsxs(_o,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(_l,{router:zo}),e.jsx(Cl,{richColors:!0,position:"top-right"})]})})})}));const $e=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:v("rounded-xl border bg-card text-card-foreground shadow",s),...t}));$e.displayName="Card";const Je=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:v("flex flex-col space-y-1.5 p-6",s),...t}));Je.displayName="CardHeader";const gs=c.forwardRef(({className:s,...t},a)=>e.jsx("h3",{ref:a,className:v("font-semibold leading-none tracking-tight",s),...t}));gs.displayName="CardTitle";const Xs=c.forwardRef(({className:s,...t},a)=>e.jsx("p",{ref:a,className:v("text-sm text-muted-foreground",s),...t}));Xs.displayName="CardDescription";const Qe=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:v("p-6 pt-0",s),...t}));Qe.displayName="CardContent";const Yo=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:v("flex items-center p-6 pt-0",s),...t}));Yo.displayName="CardFooter";const Wo=Ss("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),yt=c.forwardRef(({className:s,...t},a)=>e.jsx(Ua,{ref:a,className:v(Wo(),s),...t}));yt.displayName=Ua.displayName;const oe=Sl,er=c.createContext({}),g=({...s})=>e.jsx(er.Provider,{value:{name:s.name},children:e.jsx(kl,{...s})}),Pt=()=>{const s=c.useContext(er),t=c.useContext(sr),{getFieldState:a,formState:n}=Tl(),l=a(s.name,n);if(!s)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:s.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...l}},sr=c.createContext({}),j=c.forwardRef(({className:s,...t},a)=>{const n=c.useId();return e.jsx(sr.Provider,{value:{id:n},children:e.jsx("div",{ref:a,className:v("space-y-2",s),...t})})});j.displayName="FormItem";const p=c.forwardRef(({className:s,...t},a)=>{const{error:n,formItemId:l}=Pt();return e.jsx(yt,{ref:a,className:v(n&&"text-destructive",s),htmlFor:l,...t})});p.displayName="FormLabel";const y=c.forwardRef(({...s},t)=>{const{error:a,formItemId:n,formDescriptionId:l,formMessageId:o}=Pt();return e.jsx(Qt,{ref:t,id:n,"aria-describedby":a?`${l} ${o}`:`${l}`,"aria-invalid":!!a,...s})});y.displayName="FormControl";const F=c.forwardRef(({className:s,...t},a)=>{const{formDescriptionId:n}=Pt();return e.jsx("p",{ref:a,id:n,className:v("text-[0.8rem] text-muted-foreground",s),...t})});F.displayName="FormDescription";const k=c.forwardRef(({className:s,children:t,...a},n)=>{const{error:l,formMessageId:o}=Pt(),d=l?String(l?.message):t;return d?e.jsx("p",{ref:n,id:o,className:v("text-[0.8rem] font-medium text-destructive",s),...a,children:d}):null});k.displayName="FormMessage";const S=c.forwardRef(({className:s,type:t,...a},n)=>e.jsx("input",{type:t,className:v("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:n,...a}));S.displayName="Input";const tr=c.forwardRef(({className:s,...t},a)=>{const[n,l]=c.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:n?"text":"password",className:v("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...t}),e.jsx(T,{type:"button",size:"icon",variant:"ghost",className:"absolute right-1 top-1/2 h-6 w-6 -translate-y-1/2 rounded-md text-muted-foreground",onClick:()=>l(o=>!o),children:n?e.jsx(Dl,{size:18}):e.jsx(Pl,{size:18})})]})});tr.displayName="PasswordInput";const Jo=s=>I({url:"/passport/auth/login",method:"post",data:s}),Gt=s=>s;function re(s=void 0,t="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),Il(s).format(t))}function Qo(s=void 0,t="YYYY-MM-DD"){return re(s,t)}function zs(s){const t=typeof s=="string"?parseFloat(s):s;return isNaN(t)?"0.00":t.toFixed(2)}function Ns(s,t=!0){if(s==null)return t?"¥0.00":"0.00";const a=typeof s=="string"?parseFloat(s):s;if(isNaN(a))return t?"¥0.00":"0.00";const l=(a/100).toFixed(2).replace(/\.?0+$/,o=>o.includes(".")?".00":o);return t?`¥${l}`:l}function Nt(s){navigator.clipboard?navigator.clipboard.writeText(s).then(()=>{A.success(Gt("复制成功"))}).catch(t=>{console.error("复制到剪贴板时出错:",t),Ea(s)}):Ea(s)}function Ea(s){const t=document.createElement("button"),a=new Vl(t,{text:()=>s});a.on("success",()=>{A.success(Gt("复制成功")),a.destroy()}),a.on("error",()=>{A.error(Gt("复制失败")),a.destroy()}),t.click()}function Ye(s){const t=s/1024,a=t/1024,n=a/1024,l=n/1024;return l>=1?zs(l)+" TB":n>=1?zs(n)+" GB":a>=1?zs(a)+" MB":zs(t)+" KB"}const Zo="access_token";function Xo(s){Dt.set(Zo,s)}const ec=u.object({email:u.string().min(1,{message:"请输入邮箱地址"}).email({message:"邮箱地址格式不正确"}),password:u.string().min(1,{message:"请输入密码"}).min(7,{message:"密码长度至少为7个字符"})});function sc({className:s,onForgotPassword:t,...a}){const n=ns(),l=Ba(),o=ae({resolver:ie(ec),defaultValues:{email:"",password:""}});async function d(x){Jo(x).then(({data:r})=>{Xo(r.auth_data),l(Ko(r.auth_data)),l(Js()).unwrap(),n("/")})}return e.jsx("div",{className:v("grid gap-6",s),...a,children:e.jsx(oe,{...o,children:e.jsx("form",{onSubmit:o.handleSubmit(d),children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(g,{control:o.control,name:"email",render:({field:x})=>e.jsxs(j,{className:"space-y-1",children:[e.jsx(p,{children:"邮箱地址"}),e.jsx(y,{children:e.jsx(S,{placeholder:"name@example.com",...x})}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"password",render:({field:x})=>e.jsxs(j,{className:"space-y-1",children:[e.jsx(p,{children:"密码"}),e.jsx(y,{children:e.jsx(tr,{placeholder:"请输入密码",...x})}),e.jsx(k,{})]})}),e.jsx(T,{className:"mt-2",loading:o.formState.isSubmitting,children:"登录"}),e.jsx(T,{variant:"link",type:"button",className:"mt-1 text-sm text-muted-foreground hover:text-primary",onClick:t,children:"忘记密码?"})]})})})})}const ue=Ga,Ie=Ya,tc=Wa,ot=ea,ar=c.forwardRef(({className:s,...t},a)=>e.jsx(_t,{ref:a,className:v("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t}));ar.displayName=_t.displayName;const ce=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(tc,{children:[e.jsx(ar,{}),e.jsxs(Ct,{ref:n,className:v("max-h-[95%] overflow-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...a,children:[t,e.jsxs(ea,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Fe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ce.displayName=Ct.displayName;const he=({className:s,...t})=>e.jsx("div",{className:v("flex flex-col space-y-1.5 text-center sm:text-left",s),...t});he.displayName="DialogHeader";const Re=({className:s,...t})=>e.jsx("div",{className:v("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Re.displayName="DialogFooter";const xe=c.forwardRef(({className:s,...t},a)=>e.jsx(St,{ref:a,className:v("text-lg font-semibold leading-none tracking-tight",s),...t}));xe.displayName=St.displayName;const Se=c.forwardRef(({className:s,...t},a)=>e.jsx(kt,{ref:a,className:v("text-sm text-muted-foreground",s),...t}));Se.displayName=kt.displayName;const $s=Ss("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),W=c.forwardRef(({className:s,variant:t,size:a,asChild:n=!1,...l},o)=>{const d=n?Qt:"button";return e.jsx(d,{className:v($s({variant:t,size:a,className:s})),ref:o,...l})});W.displayName="Button";function ac(){const[s,t]=c.useState(!1),a="php artisan reset:password 管理员邮箱";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"container grid h-svh flex-col items-center justify-center bg-primary-foreground lg:max-w-none lg:px-0",children:e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-2 sm:w-[480px] lg:p-8",children:[e.jsx("div",{className:"mb-4 flex items-center justify-center",children:e.jsx("h1",{className:"text-3xl font-medium",children:window?.settings?.title})}),e.jsxs($e,{className:"p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"登录"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"请输入您的邮箱和密码登录系统"})]}),e.jsx(sc,{onForgotPassword:()=>t(!0)})]})]})}),e.jsx(ue,{open:s,onOpenChange:t,children:e.jsx(ce,{children:e.jsxs(he,{children:[e.jsx(xe,{children:"忘记密码"}),e.jsx(Se,{children:"在站点目录下执行以下命令找回密码"}),e.jsx("div",{className:"mt-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"rounded-md bg-secondary p-4 pr-12",children:a}),e.jsx(W,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>Nt(a),children:e.jsx(Rl,{className:"h-4 w-4"})})]})})]})})})]})}const nc=Object.freeze(Object.defineProperty({__proto__:null,default:ac},Symbol.toStringTag,{value:"Module"})),ye=c.forwardRef(({className:s,fadedBelow:t=!1,fixedHeight:a=!1,...n},l)=>e.jsx("div",{ref:l,className:v("relative flex h-full w-full flex-col",t&&"after:pointer-events-none after:absolute after:bottom-0 after:left-0 after:hidden after:h-32 after:w-full after:bg-[linear-gradient(180deg,_transparent_10%,_hsl(var(--background))_70%)] after:md:block",a&&"md:h-svh",s),...n}));ye.displayName="Layout";const Ne=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:v("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...t}));Ne.displayName="LayoutHeader";const _e=c.forwardRef(({className:s,fixedHeight:t,...a},n)=>e.jsx("div",{ref:n,className:v("flex-1 overflow-hidden px-4 py-6 md:px-8",t&&"h-[calc(100%-var(--header-height))]",s),...a}));_e.displayName="LayoutBody";const nr=El,rr=Fl,lr=Ml,_s=Ll,Cs=$l,rc=Al,lc=c.forwardRef(({className:s,inset:t,children:a,...n},l)=>e.jsxs(Ja,{ref:l,className:v("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",s),...n,children:[a,e.jsx(sa,{className:"ml-auto h-4 w-4"})]}));lc.displayName=Ja.displayName;const ic=c.forwardRef(({className:s,...t},a)=>e.jsx(Qa,{ref:a,className:v("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...t}));ic.displayName=Qa.displayName;const fs=c.forwardRef(({className:s,sideOffset:t=4,...a},n)=>e.jsx(zl,{children:e.jsx(Za,{ref:n,sideOffset:t,className:v("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a})}));fs.displayName=Za.displayName;const me=c.forwardRef(({className:s,inset:t,...a},n)=>e.jsx(Xa,{ref:n,className:v("relative flex cursor-default cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",s),...a}));me.displayName=Xa.displayName;const oc=c.forwardRef(({className:s,children:t,checked:a,...n},l)=>e.jsxs(en,{ref:l,className:v("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:a,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(sn,{children:e.jsx(ks,{className:"h-4 w-4"})})}),t]}));oc.displayName=en.displayName;const cc=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(tn,{ref:n,className:v("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(sn,{children:e.jsx(Ol,{className:"h-4 w-4 fill-current"})})}),t]}));cc.displayName=tn.displayName;const la=c.forwardRef(({className:s,inset:t,...a},n)=>e.jsx(an,{ref:n,className:v("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",s),...a}));la.displayName=an.displayName;const et=c.forwardRef(({className:s,...t},a)=>e.jsx(nn,{ref:a,className:v("-mx-1 my-1 h-px bg-muted",s),...t}));et.displayName=nn.displayName;const Yt=({className:s,...t})=>e.jsx("span",{className:v("ml-auto text-xs tracking-widest opacity-60",s),...t});Yt.displayName="DropdownMenuShortcut";const le=Hl,se=Kl,te=ql,ee=c.forwardRef(({className:s,sideOffset:t=4,...a},n)=>e.jsx(rn,{ref:n,sideOffset:t,className:v("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a}));ee.displayName=rn.displayName;function Vt(){const{pathname:s}=Zt();return{checkActiveNav:a=>{if(a==="/"&&s==="/")return!0;const n=a.replace(/^\//,""),l=s.replace(/^\//,"");return n?l.startsWith(n):!1}}}function ir({key:s,defaultValue:t}){const[a,n]=c.useState(()=>{const l=localStorage.getItem(s);return l!==null?JSON.parse(l):t});return c.useEffect(()=>{localStorage.setItem(s,JSON.stringify(a))},[a,s]),[a,n]}function dc(){const[s,t]=ir({key:"expanded-sidebar-items",defaultValue:["仪表盘","系统管理","节点管理","订阅管理","用户管理"]});return{expandedItems:s,toggleItem:n=>{t(l=>l.includes(n)?l.filter(o=>o!==n):[...l,n])},isExpanded:n=>s.includes(n)}}function uc({links:s,isCollapsed:t,className:a,closeNav:n}){const l=({sub:o,...d})=>{const x=`${d.title}-${d.href}`;return t&&o?c.createElement(hc,{...d,sub:o,key:x,closeNav:n}):t?c.createElement(mc,{...d,key:x,closeNav:n}):o?c.createElement(xc,{...d,sub:o,key:x,closeNav:n}):c.createElement(or,{...d,key:x,closeNav:n})};return e.jsx("div",{"data-collapsed":t,className:v("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",a),children:e.jsx(le,{delayDuration:0,children:e.jsx("nav",{className:"grid gap-1 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:s.map(l)})})})}function or({title:s,icon:t,label:a,href:n,closeNav:l,subLink:o=!1}){const{checkActiveNav:d}=Vt();return e.jsxs(Ts,{to:n,onClick:l,className:v(As({variant:d(n)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",o&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":d(n)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:t}),s,a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:a})]})}function xc({title:s,icon:t,label:a,sub:n,closeNav:l}){const{checkActiveNav:o}=Vt(),{isExpanded:d,toggleItem:x}=dc(),r=!!n?.find(h=>o(h.href)),i=d(s)||r;return e.jsxs(nr,{open:i,onOpenChange:()=>x(s),children:[e.jsxs(rr,{className:v(As({variant:"ghost",size:"sm"}),"group h-12 w-full justify-start rounded-none px-6"),children:[e.jsx("div",{className:"mr-2",children:t}),s,a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:a}),e.jsx("span",{className:v('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(ln,{stroke:1})})]}),e.jsx(lr,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:n.map(h=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(or,{...h,subLink:!0,closeNav:l})},h.title))})})]})}function mc({title:s,icon:t,label:a,href:n}){const{checkActiveNav:l}=Vt();return e.jsxs(se,{delayDuration:0,children:[e.jsx(te,{asChild:!0,children:e.jsxs(Ts,{to:n,className:v(As({variant:l(n)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[t,e.jsx("span",{className:"sr-only",children:s})]})}),e.jsxs(ee,{side:"right",className:"flex items-center gap-4",children:[s,a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:a})]})]})}function hc({title:s,icon:t,label:a,sub:n}){const{checkActiveNav:l}=Vt(),o=!!n?.find(d=>l(d.href));return e.jsxs(_s,{children:[e.jsxs(se,{delayDuration:0,children:[e.jsx(te,{asChild:!0,children:e.jsx(Cs,{asChild:!0,children:e.jsx(T,{variant:o?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:t})})}),e.jsxs(ee,{side:"right",className:"flex items-center gap-4",children:[s," ",a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:a}),e.jsx(ln,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(fs,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(la,{children:[s," ",a?`(${a})`:""]}),e.jsx(et,{}),n.map(({title:d,icon:x,label:r,href:i})=>e.jsx(me,{asChild:!0,children:e.jsxs(Ts,{to:i,className:`${l(i)?"bg-secondary":""}`,children:[x," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:d}),r&&e.jsx("span",{className:"ml-auto text-xs",children:r})]})},`${d}-${i}`))]})]})}const cr=[{title:"仪表盘",label:"",href:"/",icon:e.jsx(Ul,{size:18})},{title:"系统管理",label:"",href:"",icon:e.jsx(Bl,{size:18}),sub:[{title:"系统配置",label:"",href:"/config/system",icon:e.jsx(on,{size:18})},{title:"主题配置",label:"",href:"/config/theme",icon:e.jsx(Gl,{size:18})},{title:"公告管理",label:"",href:"/config/notice",icon:e.jsx(Yl,{size:18})},{title:"支付配置",label:"",href:"/config/payment",icon:e.jsx(wa,{size:18})},{title:"知识库管理",label:"",href:"/config/knowledge",icon:e.jsx(Wl,{size:18})}]},{title:"节点管理",label:"",href:"",icon:e.jsx(cn,{size:18}),sub:[{title:"节点管理",label:"",href:"/server/manage",icon:e.jsx(Jl,{size:18})},{title:"权限组管理",label:"",href:"/server/group",icon:e.jsx(dn,{size:18})},{title:"路由管理",label:"",href:"/server/route",icon:e.jsx(Ql,{size:18})}]},{title:"订阅管理",label:"",href:"",icon:e.jsx(Zl,{size:18}),sub:[{title:"套餐管理",label:"",href:"/finance/plan",icon:e.jsx(Xl,{size:18})},{title:"订单管理",label:"",href:"/finance/order",icon:e.jsx(wa,{size:18})},{title:"优惠券管理",label:"",href:"/finance/coupon",icon:e.jsx(ei,{size:18})}]},{title:"用户管理",label:"",href:"",icon:e.jsx(si,{size:18}),sub:[{title:"用户管理",label:"",href:"/user/manage",icon:e.jsx(ti,{size:18})},{title:"工单管理",label:"",href:"/user/ticket",icon:e.jsx(un,{size:18})}]}];function jc({className:s,isCollapsed:t,setIsCollapsed:a}){const[n,l]=c.useState(!1);return c.useEffect(()=>{n?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[n]),e.jsxs("aside",{className:v(`fixed left-0 right-0 top-0 z-50 w-full border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${t?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>l(!1),className:`absolute inset-0 transition-[opacity] delay-100 duration-700 ${n?"h-svh opacity-50":"h-0 opacity-0"} w-full bg-black md:hidden`}),e.jsxs(ye,{children:[e.jsxs(Ne,{className:"sticky top-0 justify-between px-4 py-3 shadow md:px-4",children:[e.jsxs("div",{className:`flex items-center ${t?"":"gap-2"}`,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:`transition-all ${t?"h-6 w-6":"h-8 w-8"}`,children:[e.jsx("rect",{width:"256",height:"256",fill:"none"}),e.jsx("line",{x1:"208",y1:"128",x2:"128",y2:"208",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("line",{x1:"192",y1:"40",x2:"40",y2:"192",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("span",{className:"sr-only",children:"Website Name"})]}),e.jsx("div",{className:`flex flex-col justify-end truncate ${t?"invisible w-0":"visible w-auto"}`,children:e.jsx("span",{className:"font-medium",children:window?.settings?.title})})]}),e.jsx(T,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Toggle Navigation","aria-controls":"sidebar-menu","aria-expanded":n,onClick:()=>l(o=>!o),children:n?e.jsx(ai,{}):e.jsx(ni,{})})]}),e.jsx(uc,{id:"sidebar-menu",className:`h-full flex-1 overflow-auto ${n?"max-h-screen":"max-h-0 py-0 md:max-h-screen md:py-2"}`,closeNav:()=>l(!1),isCollapsed:t,links:cr}),e.jsx(T,{onClick:()=>a(o=>!o),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex",children:e.jsx(ri,{stroke:1.5,className:`h-5 w-5 ${t?"rotate-180":""}`})})]})]})}function gc(){const[s,t]=ir({key:"collapsed-sidebar",defaultValue:!1});return c.useEffect(()=>{const a=()=>{t(window.innerWidth<768?!1:s)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[s,t]),[s,t]}function fc(){const[s,t]=gc();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(jc,{isCollapsed:s,setIsCollapsed:t}),e.jsx("main",{id:"content",className:`overflow-x-hidden pt-16 transition-[margin] md:overflow-y-hidden md:pt-0 ${s?"md:ml-14":"md:ml-64"} h-full`,children:e.jsx(Xt,{})})]})}const pc=Object.freeze(Object.defineProperty({__proto__:null,default:fc},Symbol.toStringTag,{value:"Module"})),ps=c.forwardRef(({className:s,...t},a)=>e.jsx(we,{ref:a,className:v("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...t}));ps.displayName=we.displayName;const vc=({children:s,...t})=>e.jsx(ue,{...t,children:e.jsx(ce,{className:"overflow-hidden p-0",children:e.jsx(ps,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:s})})}),Ps=c.forwardRef(({className:s,...t},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(li,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(we.Input,{ref:a,className:v("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",s),...t})]}));Ps.displayName=we.Input.displayName;const vs=c.forwardRef(({className:s,...t},a)=>e.jsx(we.List,{ref:a,className:v("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...t}));vs.displayName=we.List.displayName;const Vs=c.forwardRef((s,t)=>e.jsx(we.Empty,{ref:t,className:"py-6 text-center text-sm",...s}));Vs.displayName=we.Empty.displayName;const Ve=c.forwardRef(({className:s,...t},a)=>e.jsx(we.Group,{ref:a,className:v("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",s),...t}));Ve.displayName=we.Group.displayName;const Hs=c.forwardRef(({className:s,...t},a)=>e.jsx(we.Separator,{ref:a,className:v("-mx-1 h-px bg-border",s),...t}));Hs.displayName=we.Separator.displayName;const be=c.forwardRef(({className:s,...t},a)=>e.jsx(we.Item,{ref:a,className:v("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...t}));be.displayName=we.Item.displayName;function bc(){const s=[];for(const t of cr)if(t.href&&s.push(t),t.sub)for(const a of t.sub)s.push({...a,parent:t.title});return s}function ke(){const[s,t]=c.useState(!1),a=ns(),n=bc();c.useEffect(()=>{const o=d=>{d.key==="k"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),t(x=>!x))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[]);const l=c.useCallback(o=>{t(!1),a(o)},[a]);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-10 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>t(!0),children:[e.jsx(ii,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:"搜索..."}),e.jsx("span",{className:"sr-only",children:"搜索"}),e.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-2 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsxs(vc,{open:s,onOpenChange:t,children:[e.jsx(Ps,{placeholder:"搜索所有菜单和功能..."}),e.jsxs(vs,{children:[e.jsx(Vs,{children:"未找到相关结果"}),e.jsx(Ve,{heading:"菜单导航",children:n.map(o=>e.jsxs(be,{value:`${o.parent?o.parent+" ":""}${o.title}`,onSelect:()=>l(o.href),children:[e.jsx("div",{className:"mr-2",children:o.icon}),e.jsx("span",{children:o.title}),o.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:o.parent})]},o.href))})]})]})]})}function Te(){const{theme:s,setTheme:t}=Co();return c.useEffect(()=>{const a=s==="dark"?"#020817":"#fff",n=document.querySelector("meta[name='theme-color']");n&&n.setAttribute("content",a)},[s]),e.jsx(T,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>t(s==="light"?"dark":"light"),children:s==="light"?e.jsx(oi,{size:20}):e.jsx(ci,{size:20})})}const dr=c.forwardRef(({className:s,...t},a)=>e.jsx(xn,{ref:a,className:v("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...t}));dr.displayName=xn.displayName;const ur=c.forwardRef(({className:s,...t},a)=>e.jsx(mn,{ref:a,className:v("aspect-square h-full w-full",s),...t}));ur.displayName=mn.displayName;const xr=c.forwardRef(({className:s,...t},a)=>e.jsx(hn,{ref:a,className:v("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...t}));xr.displayName=hn.displayName;function De(){const s=ns(),t=Ba(),a=di(Uo),n=()=>{Jn(),t(qo()),s("/sign-in")},l=a?.email?.split("@")[0]||"User",o=l.substring(0,2).toUpperCase();return e.jsxs(_s,{children:[e.jsx(Cs,{asChild:!0,children:e.jsx(T,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(dr,{className:"h-8 w-8",children:[e.jsx(ur,{src:a?.avatar_url,alt:l}),e.jsx(xr,{children:o})]})})}),e.jsxs(fs,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(la,{className:"font-normal",children:e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:l}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:a?.email||"user@example.com"})]})}),e.jsx(et,{}),e.jsx(me,{asChild:!0,children:e.jsxs(Ts,{to:"/config/system",children:["设置",e.jsx(Yt,{children:"⌘S"})]})}),e.jsx(et,{}),e.jsxs(me,{onClick:n,children:["退出登录",e.jsx(Yt,{children:"⇧⌘Q"})]})]})]})}const Ge=window?.settings?.secure_path,mr=5*60*1e3,Wt=new Map,yc=s=>{const t=Wt.get(s);return t?Date.now()-t.timestamp>mr?(Wt.delete(s),null):t.data:null},Nc=(s,t)=>{Wt.set(s,{data:t,timestamp:Date.now()})},wc=async(s,t=mr)=>{const a=yc(s);if(a)return a;const n=await I.get(s);return Nc(s,n),n},_c={getList:()=>wc(`${Ge}/notice/fetch`),save:s=>I.post(`${Ge}/notice/save`,s),drop:s=>I.post(`${Ge}/notice/drop`,{id:s}),updateStatus:s=>I.post(`${Ge}/notice/show`,{id:s}),sort:s=>I.post(`${Ge}/notice/sort`,{ids:s})},Fa={getSystemStatus:()=>I.get(`${Ge}/system/getSystemStatus`),getQueueStats:()=>I.get(`${Ge}/system/getQueueStats`),getQueueWorkload:()=>I.get(`${Ge}/system/getQueueWorkload`),getQueueMasters:()=>I.get(`${Ge}/system/getQueueMasters`),getSystemLog:s=>I.get(`${Ge}/system/getSystemLog`,{params:s})},M=window?.settings?.secure_path,Cc=s=>I.get(M+"/stat/getOrder",{params:s}),Sc=()=>I.get(M+"/stat/getStats"),Ma=s=>I.get(M+"/stat/getTrafficRank",{params:s}),kc=()=>I.get(M+"/theme/getThemes"),Tc=s=>I.post(M+"/theme/getThemeConfig",{name:s}),Dc=(s,t)=>I.post(M+"/theme/saveThemeConfig",{name:s,config:t}),Pc=s=>{const t=new FormData;return t.append("file",s),I.post(M+"/theme/upload",t,{headers:{"Content-Type":"multipart/form-data"}})},Vc=s=>I.post(M+"/theme/delete",{name:s}),Ic=s=>I.post(M+"/config/save",s),hr=()=>I.get(M+"/server/manage/getNodes"),Rc=s=>I.post(M+"/server/manage/save",s),Ec=s=>I.post(M+"/server/manage/drop",s),Fc=s=>I.post(M+"/server/manage/copy",s),Mc=s=>I.post(M+"/server/manage/update",s),zc=s=>I.post(M+"/server/manage/sort",s),It=()=>I.get(M+"/server/group/fetch"),Oc=s=>I.post(M+"/server/group/save",s),Lc=s=>I.post(M+"/server/group/drop",s),jr=()=>I.get(M+"/server/route/fetch"),$c=s=>I.post(M+"/server/route/save",s),Ac=s=>I.post(M+"/server/route/drop",s),Hc=()=>I.get(M+"/payment/fetch"),Kc=()=>I.get(M+"/payment/getPaymentMethods"),qc=s=>I.post(M+"/payment/getPaymentForm",s),Uc=s=>I.post(M+"/payment/save",s),Bc=s=>I.post(M+"/payment/drop",s),Gc=s=>I.post(M+"/payment/show",s),Yc=s=>I.post(M+"/payment/sort",s),Wc=()=>I.get(M+"/notice/fetch"),Jc=s=>I.post(M+"/notice/save",s),Qc=s=>I.post(M+"/notice/drop",s),Zc=s=>I.post(M+"/notice/show",s),Xc=()=>I.get(M+"/knowledge/fetch"),ed=s=>I.get(M+"/knowledge/fetch?id="+s),sd=s=>I.post(M+"/knowledge/save",s),td=s=>I.post(M+"/knowledge/drop",s),ad=s=>I.post(M+"/knowledge/show",s),nd=s=>I.post(M+"/knowledge/sort",s),Is=()=>I.get(M+"/plan/fetch"),rd=s=>I.post(M+"/plan/save",s),zt=s=>I.post(M+"/plan/update",s),ld=s=>I.post(M+"/plan/drop",s),id=s=>I.post(M+"/plan/sort",{ids:s}),od=async s=>I.post(M+"/order/fetch",s),cd=s=>I.post(M+"/order/detail",s),dd=s=>I.post(M+"/order/paid",s),ud=s=>I.post(M+"/order/cancel",s),za=s=>I.post(M+"/order/update",s),xd=s=>I.post(M+"/order/assign",s),md=s=>I.post(M+"/coupon/fetch",s),hd=s=>I.post(M+"/coupon/generate",s),jd=s=>I.post(M+"/coupon/drop",s),gd=s=>I.post(M+"/coupon/update",s),fd=s=>I.post(M+"/user/fetch",s),pd=s=>I.post(M+"/user/update",s),vd=s=>I.post(M+"/user/resetSecret",s),bd=s=>I.post(M+"/user/generate",s),yd=s=>I.post(M+"/stat/getStatUser",s),Nd=s=>I.post(M+"/ticket/fetch",s),wd=s=>I.get(M+"/ticket/fetch?id= "+s),_d=s=>I.post(M+"/ticket/reply",s),gr=s=>I.post(M+"/ticket/close",{id:s}),os=(s="")=>I.get(M+"/config/fetch?key="+s),cs=s=>I.post(M+"/config/save",s),Cd=()=>I.get(M+"/config/getEmailTemplate"),Sd=()=>I.post(M+"/config/testSendMail"),kd=()=>I.post(M+"/config/setTelegramWebhook"),Td=_c.sort,fr=ui,ia=c.forwardRef(({className:s,...t},a)=>e.jsx(jn,{ref:a,className:v("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...t}));ia.displayName=jn.displayName;const st=c.forwardRef(({className:s,...t},a)=>e.jsx(gn,{ref:a,className:v("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",s),...t}));st.displayName=gn.displayName;const Dd=c.forwardRef(({className:s,...t},a)=>e.jsx(fn,{ref:a,className:v("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...t}));Dd.displayName=fn.displayName;const G=xi,xs=bi,Y=mi,U=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(pn,{ref:n,className:v("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...a,children:[t,e.jsx(hi,{asChild:!0,children:e.jsx(ta,{className:"h-4 w-4 opacity-50"})})]}));U.displayName=pn.displayName;const pr=c.forwardRef(({className:s,...t},a)=>e.jsx(vn,{ref:a,className:v("flex cursor-default items-center justify-center py-1",s),...t,children:e.jsx(ji,{className:"h-4 w-4"})}));pr.displayName=vn.displayName;const vr=c.forwardRef(({className:s,...t},a)=>e.jsx(bn,{ref:a,className:v("flex cursor-default items-center justify-center py-1",s),...t,children:e.jsx(ta,{className:"h-4 w-4"})}));vr.displayName=bn.displayName;const B=c.forwardRef(({className:s,children:t,position:a="popper",...n},l)=>e.jsx(gi,{children:e.jsxs(yn,{ref:l,className:v("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:a,...n,children:[e.jsx(pr,{}),e.jsx(fi,{className:v("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),e.jsx(vr,{})]})}));B.displayName=yn.displayName;const Pd=c.forwardRef(({className:s,...t},a)=>e.jsx(Nn,{ref:a,className:v("px-2 py-1.5 text-sm font-semibold",s),...t}));Pd.displayName=Nn.displayName;const O=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(wn,{ref:n,className:v("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(pi,{children:e.jsx(ks,{className:"h-4 w-4"})})}),e.jsx(vi,{children:t})]}));O.displayName=wn.displayName;const Vd=c.forwardRef(({className:s,...t},a)=>e.jsx(_n,{ref:a,className:v("-mx-1 my-1 h-px bg-muted",s),...t}));Vd.displayName=_n.displayName;function Rs({className:s,classNames:t,showOutsideDays:a=!0,...n}){return e.jsx(yi,{showOutsideDays:a,className:v("p-3",s),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:v($s({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:v("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:v($s({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({className:l,...o})=>e.jsx(Cn,{className:v("h-4 w-4",l),...o}),IconRight:({className:l,...o})=>e.jsx(sa,{className:v("h-4 w-4",l),...o})},...n})}Rs.displayName="Calendar";const Ze=wi,Xe=_i,qe=c.forwardRef(({className:s,align:t="center",sideOffset:a=4,...n},l)=>e.jsx(Ni,{children:e.jsx(Sn,{ref:l,align:t,sideOffset:a,className:v("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...n})}));qe.displayName=Sn.displayName;const ms={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},Ws=s=>(s/100).toFixed(2),Id=({active:s,payload:t,label:a})=>s&&t&&t.length?e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-sm",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:a}),t.map((n,l)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:n.color}}),e.jsxs("span",{className:"text-muted-foreground",children:[n.name,":"]}),e.jsx("span",{className:"font-medium",children:n.name.includes("金额")?`¥${Ws(n.value)}`:`${n.value}笔`})]},l))]}):null,Rd=[{value:"7d",label:"最近7天"},{value:"30d",label:"最近30天"},{value:"90d",label:"最近90天"},{value:"180d",label:"最近180天"},{value:"365d",label:"最近一年"},{value:"custom",label:"自定义范围"}],Ed=(s,t)=>{const a=new Date;if(s==="custom"&&t)return{startDate:t.from,endDate:t.to};let n;switch(s){case"7d":n=Le(a,7);break;case"30d":n=Le(a,30);break;case"90d":n=Le(a,90);break;case"180d":n=Le(a,180);break;case"365d":n=Le(a,365);break;default:n=Le(a,30)}return{startDate:n,endDate:a}};function Fd(){const[s,t]=c.useState("amount"),[a,n]=c.useState("30d"),[l,o]=c.useState({from:Le(new Date,7),to:new Date}),{startDate:d,endDate:x}=Ed(a,l),{data:r}=Q({queryKey:["orderStat",{start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:i}=await Cc({start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")});return i},refetchInterval:3e4});return e.jsxs($e,{children:[e.jsxs(Je,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(gs,{children:"收入趋势"}),e.jsx(Xs,{children:`${r?.summary.start_date||""} 至 ${r?.summary.end_date||""}`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsxs(G,{value:a,onValueChange:i=>n(i),children:[e.jsx(U,{className:"w-[120px]",children:e.jsx(Y,{placeholder:"选择时间范围"})}),e.jsx(B,{children:Rd.map(i=>e.jsx(O,{value:i.value,children:i.label},i.value))})]}),a==="custom"&&e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(W,{variant:"outline",className:v("min-w-0 justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(lt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:l?.from?l.to?e.jsxs(e.Fragment,{children:[Pe(l.from,"yyyy-MM-dd")," -"," ",Pe(l.to,"yyyy-MM-dd")]}):Pe(l.from,"yyyy-MM-dd"):e.jsx("span",{children:"选择日期范围"})})]})}),e.jsx(qe,{className:"w-auto p-0",align:"end",children:e.jsx(Rs,{mode:"range",defaultMonth:l?.from,selected:{from:l?.from,to:l?.to},onSelect:i=>{i?.from&&i?.to&&o({from:i.from,to:i.to})},numberOfMonths:2})})]})]}),e.jsx(fr,{value:s,onValueChange:i=>t(i),children:e.jsxs(ia,{children:[e.jsx(st,{value:"amount",children:"金额"}),e.jsx(st,{value:"count",children:"笔数"})]})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总收入"}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Ws(r?.summary?.paid_total||0)]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["共 ",r?.summary?.paid_count||0," 笔"]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["平均订单金额 ¥",Ws(r?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总佣金"}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Ws(r?.summary?.commission_total||0)]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["共 ",r?.summary?.commission_count||0," 笔"]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["佣金比率 ",r?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]})]}),e.jsx(Qe,{children:e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(Ci,{width:"100%",height:"100%",children:e.jsxs(Si,{data:r?.list||[],margin:{top:20,right:20,left:0,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"incomeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:ms.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:ms.income.gradient.end,stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"commissionGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:ms.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:ms.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(ki,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>Pe(new Date(i),"MM-dd",{locale:Vi})}),e.jsx(Ti,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>s==="amount"?`¥${Ws(i)}`:`${i}笔`}),e.jsx(Di,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(Pi,{content:e.jsx(Id,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(_a,{type:"monotone",dataKey:"paid_total",name:"收款金额",stroke:ms.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(_a,{type:"monotone",dataKey:"commission_total",name:"佣金金额",stroke:ms.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ca,{dataKey:"paid_count",name:"收款笔数",fill:ms.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(Ca,{dataKey:"commission_count",name:"佣金笔数",fill:ms.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})})]})}function Ee({className:s,...t}){return e.jsx("div",{className:v("animate-pulse rounded-md bg-primary/10",s),...t})}function Md(){return e.jsxs($e,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ee,{className:"h-4 w-[100px]"}),e.jsx(Ee,{className:"h-4 w-4"})]}),e.jsxs(Qe,{children:[e.jsx(Ee,{className:"h-8 w-[120px]"}),e.jsx("div",{className:"flex items-center pt-1",children:e.jsx(Ee,{className:"h-4 w-[100px]"})})]})]})}function zd(){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((s,t)=>e.jsx(Md,{},t))})}var ge=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.CANCELLED=2]="CANCELLED",s[s.COMPLETED=3]="COMPLETED",s[s.DISCOUNTED=4]="DISCOUNTED",s))(ge||{});const Ms={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},Gs={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var as=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(as||{});const br={1:"新购",2:"续费",3:"升级",4:"流量重置"};var pe=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(pe||{});const dt={0:"待确认",1:"发放中",2:"有效",3:"无效"},ut={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var ne=(s=>(s.MONTH_PRICE="month_price",s.QUARTER_PRICE="quarter_price",s.HALF_YEAR_PRICE="half_year_price",s.YEAR_PRICE="year_price",s.TWO_YEAR_PRICE="two_year_price",s.THREE_YEAR_PRICE="three_year_price",s.ONETIME_PRICE="onetime_price",s.RESET_PRICE="reset_price",s))(ne||{});const tt={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var fe=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s))(fe||{});const ws=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"}],ts={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a"};var Rt=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(Rt||{});const oa={1:"按金额优惠",2:"按比例优惠"},Od={0:"正常",1:"锁定"};var Os=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(Os||{});const Ld={0:"开启",1:"已关闭"};var ss=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(ss||{});const Qs={0:"低",1:"中",2:"高"};function hs({title:s,value:t,icon:a,trend:n,description:l,onClick:o,highlight:d,className:x}){return e.jsxs($e,{className:v("transition-colors",o&&"cursor-pointer hover:bg-muted/50",d&&"border-primary/50",x),onClick:o,children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(gs,{className:"text-sm font-medium",children:s}),a]}),e.jsxs(Qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:t}),n?e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(zi,{className:v("h-4 w-4",n.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:v("ml-1 text-xs",n.isPositive?"text-emerald-500":"text-red-500"),children:[n.isPositive?"+":"-",Math.abs(n.value),"%"]}),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:n.label})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:l})]})]})}function $d({className:s}){const t=ns(),{data:a,isLoading:n}=Q({queryKey:["dashboardStats"],queryFn:async()=>(await Sc()).data,refetchInterval:1e3*60*5});if(n||!a)return e.jsx(zd,{});const l=()=>{const o=new URLSearchParams;o.set("commission_status",pe.PENDING.toString()),o.set("status",ge.COMPLETED.toString()),o.set("commission_balance","gt:0"),t(`/finance/order?${o.toString()}`)};return e.jsxs("div",{className:v("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx(hs,{title:"今日收入",value:Ns(a.todayIncome),icon:e.jsx(Ii,{className:"h-4 w-4 text-emerald-500"}),trend:{value:a.dayIncomeGrowth,label:"vs 昨日",isPositive:a.dayIncomeGrowth>0}}),e.jsx(hs,{title:"本月收入",value:Ns(a.currentMonthIncome),icon:e.jsx(Ri,{className:"h-4 w-4 text-blue-500"}),trend:{value:a.monthIncomeGrowth,label:"vs 上月",isPositive:a.monthIncomeGrowth>0}}),e.jsx(hs,{title:"待处理工单",value:a.ticketPendingTotal,icon:e.jsx(Ei,{className:v("h-4 w-4",a.ticketPendingTotal>0?"text-orange-500":"text-muted-foreground")}),description:a.ticketPendingTotal>0?"有待处理的工单需要关注":"暂无待处理工单",onClick:()=>t("/user/ticket"),highlight:a.ticketPendingTotal>0}),e.jsx(hs,{title:"待处理佣金",value:a.commissionPendingTotal,icon:e.jsx(Fi,{className:v("h-4 w-4",a.commissionPendingTotal>0?"text-blue-500":"text-muted-foreground")}),description:a.commissionPendingTotal>0?"有待处理的佣金需要确认":"暂无待处理佣金",onClick:l,highlight:a.commissionPendingTotal>0}),e.jsx(hs,{title:"本月新增用户",value:a.currentMonthNewUsers,icon:e.jsx(At,{className:"h-4 w-4 text-blue-500"}),trend:{value:a.userGrowth,label:"vs 上月",isPositive:a.userGrowth>0}}),e.jsx(hs,{title:"总用户数",value:a.totalUsers,icon:e.jsx(At,{className:"h-4 w-4 text-muted-foreground"}),description:`有效用户: ${a.activeUsers}`}),e.jsx(hs,{title:"本月上行流量",value:Ye(a.monthTraffic.upload),icon:e.jsx(Ht,{className:"h-4 w-4 text-emerald-500"}),description:`今日: ${Ye(a.todayTraffic.upload)}`}),e.jsx(hs,{title:"本月下行流量",value:Ye(a.monthTraffic.download),icon:e.jsx(Mi,{className:"h-4 w-4 text-blue-500"}),description:`今日: ${Ye(a.todayTraffic.download)}`})]})}const at=c.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(kn,{ref:n,className:v("relative overflow-hidden",s),...a,children:[e.jsx(Oi,{className:"h-full w-full rounded-[inherit]",children:t}),e.jsx(wt,{}),e.jsx(Li,{})]}));at.displayName=kn.displayName;const wt=c.forwardRef(({className:s,orientation:t="vertical",...a},n)=>e.jsx(Tn,{ref:n,orientation:t,className:v("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s),...a,children:e.jsx($i,{className:"relative flex-1 rounded-full bg-border"})}));wt.displayName=Tn.displayName;const Jt={today:{label:"今天",getValue:()=>{const s=Hi();return{start:s,end:Ki(s,1)}}},last7days:{label:"最近7天",getValue:()=>{const s=new Date;return{start:Le(s,7),end:s}}},last30days:{label:"最近30天",getValue:()=>{const s=new Date;return{start:Le(s,30),end:s}}},custom:{label:"自定义范围",getValue:()=>null}};function Oa({selectedRange:s,customDateRange:t,onRangeChange:a,onCustomRangeChange:n}){return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.jsxs(G,{value:s,onValueChange:a,children:[e.jsx(U,{className:"w-[120px]",children:e.jsx(Y,{placeholder:"选择时间范围"})}),e.jsx(B,{position:"popper",className:"z-50",children:Object.entries(Jt).map(([l,{label:o}])=>e.jsx(O,{value:l,children:o},l))})]}),s==="custom"&&e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(W,{variant:"outline",className:v("min-w-0 justify-start text-left font-normal",!t&&"text-muted-foreground"),children:[e.jsx(lt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:t?.from?t.to?e.jsxs(e.Fragment,{children:[Pe(t.from,"yyyy-MM-dd")," -"," ",Pe(t.to,"yyyy-MM-dd")]}):Pe(t.from,"yyyy-MM-dd"):e.jsx("span",{children:"选择日期范围"})})]})}),e.jsx(qe,{className:"w-auto p-0",align:"end",children:e.jsx(Rs,{mode:"range",defaultMonth:t?.from,selected:{from:t?.from,to:t?.to},onSelect:l=>{l?.from&&l?.to&&n({from:l.from,to:l.to})},numberOfMonths:2})})]})]})}const Fs=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Ad({className:s}){const[t,a]=c.useState("today"),[n,l]=c.useState({from:Le(new Date,7),to:new Date}),[o,d]=c.useState("today"),[x,r]=c.useState({from:Le(new Date,7),to:new Date}),i=c.useMemo(()=>t==="custom"?{start:n.from,end:n.to}:Jt[t].getValue(),[t,n]),h=c.useMemo(()=>o==="custom"?{start:x.from,end:x.to}:Jt[o].getValue(),[o,x]),{data:D}=Q({queryKey:["nodeTrafficRank",i.start,i.end],queryFn:()=>Ma({type:"node",start_time:de.round(i.start.getTime()/1e3),end_time:de.round(i.end.getTime()/1e3)}),refetchInterval:3e4}),{data:C}=Q({queryKey:["userTrafficRank",h.start,h.end],queryFn:()=>Ma({type:"user",start_time:de.round(h.start.getTime()/1e3),end_time:de.round(h.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:v("grid gap-4 md:grid-cols-2",s),children:[e.jsxs($e,{children:[e.jsx(Je,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(gs,{className:"flex items-center text-base font-medium",children:[e.jsx(Ai,{className:"mr-2 h-4 w-4"}),"节点流量排行"]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(Oa,{selectedRange:t,customDateRange:n,onRangeChange:a,onCustomRangeChange:l}),e.jsx(Sa,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Qe,{className:"flex-1",children:D?.data?e.jsxs(at,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:D.data.map(m=>e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:m.name}),e.jsxs("span",{className:v("ml-2 flex items-center text-xs font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?e.jsx(Kt,{className:"mr-1 h-3 w-3"}):e.jsx(qt,{className:"mr-1 h-3 w-3"}),Math.abs(m.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${m.value/D.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Fs(m.value)})]})]})})}),e.jsx(ee,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"当前流量:"}),e.jsx("span",{className:"font-medium",children:Fs(m.value)}),e.jsx("span",{className:"text-muted-foreground",children:"上期流量:"}),e.jsx("span",{className:"font-medium",children:Fs(m.previousValue)}),e.jsx("span",{className:"text-muted-foreground",children:"变化率:"}),e.jsxs("span",{className:v("font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?"+":"",m.change,"%"]}),e.jsx("span",{className:"text-muted-foreground",children:"记录时间:"}),e.jsx("span",{className:"font-medium",children:Pe(new Date(m.timestamp),"yyyy-MM-dd HH:mm")})]})})]})},m.id))}),e.jsx(wt,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:"Loading..."})})})]}),e.jsxs($e,{children:[e.jsx(Je,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(gs,{className:"flex items-center text-base font-medium",children:[e.jsx(At,{className:"mr-2 h-4 w-4"}),"用户流量排行"]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(Oa,{selectedRange:o,customDateRange:x,onRangeChange:d,onCustomRangeChange:r}),e.jsx(Sa,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Qe,{className:"flex-1",children:C?.data?e.jsxs(at,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:C.data.map(m=>e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:m.name}),e.jsxs("span",{className:v("ml-2 flex items-center text-xs font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?e.jsx(Kt,{className:"mr-1 h-3 w-3"}):e.jsx(qt,{className:"mr-1 h-3 w-3"}),Math.abs(m.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${m.value/C.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Fs(m.value)})]})]})})}),e.jsx(ee,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"当前流量:"}),e.jsx("span",{className:"font-medium",children:Fs(m.value)}),e.jsx("span",{className:"text-muted-foreground",children:"上期流量:"}),e.jsx("span",{className:"font-medium",children:Fs(m.previousValue)}),e.jsx("span",{className:"text-muted-foreground",children:"变化率:"}),e.jsxs("span",{className:v("font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?"+":"",m.change,"%"]}),e.jsx("span",{className:"text-muted-foreground",children:"记录时间:"}),e.jsx("span",{className:"font-medium",children:Pe(new Date(m.timestamp),"yyyy-MM-dd HH:mm")})]})})]})},m.id))}),e.jsx(wt,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:"Loading..."})})})]})]})}const Hd=Ss("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/10",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function L({className:s,variant:t,...a}){return e.jsx("div",{className:v(Hd({variant:t}),s),...a})}const pt=c.forwardRef(({className:s,value:t,...a},n)=>e.jsx(Dn,{ref:n,className:v("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...a,children:e.jsx(qi,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));pt.displayName=Dn.displayName;function Kd(){const[s,t]=c.useState(null),[a,n]=c.useState(null),[l,o]=c.useState(!0),[d,x]=c.useState(!1),r=async()=>{try{x(!0);const[D,C]=await Promise.all([Fa.getSystemStatus(),Fa.getQueueStats()]);t(D.data),n(C.data)}catch(D){console.error("Error fetching system data:",D)}finally{o(!1),x(!1)}};c.useEffect(()=>{r();const D=setInterval(r,3e4);return()=>clearInterval(D)},[]);const i=()=>{r()};if(l)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(aa,{className:"h-6 w-6 animate-spin"})});const h=D=>D?e.jsx(Pn,{className:"h-5 w-5 text-green-500"}):e.jsx(Vn,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs($e,{children:[e.jsxs(Je,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(gs,{className:"flex items-center gap-2",children:[e.jsx(Ui,{className:"h-5 w-5"}),"队列状态"]}),e.jsx(Xs,{children:"当前队列运行状态"})]}),e.jsx(W,{variant:"outline",size:"icon",onClick:i,disabled:d,children:e.jsx(Bi,{className:v("h-4 w-4",d&&"animate-spin")})})]}),e.jsx(Qe,{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:[h(a?.status||!1),e.jsx("span",{className:"font-medium",children:"运行状态"})]}),e.jsx(L,{variant:a?.status?"secondary":"destructive",children:a?.status?"正常":"异常"})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前等待时间:",a?.wait?.default||0," 秒"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{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:"近期任务数"}),e.jsx("p",{className:"text-2xl font-bold",children:a?.recentJobs||0}),e.jsx(pt,{value:(a?.recentJobs||0)/(a?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ee,{children:e.jsxs("p",{children:["统计时间范围: ",a?.periods?.recentJobs||0," 小时"]})})]})}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{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:"每分钟处理量"}),e.jsx("p",{className:"text-2xl font-bold",children:a?.jobsPerMinute||0}),e.jsx(pt,{value:(a?.jobsPerMinute||0)/(a?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ee,{children:e.jsxs("p",{children:["最高吞吐量:"," ",a?.queueWithMaxThroughput?.throughput||0]})})]})})]})]})})]}),e.jsxs($e,{children:[e.jsxs(Je,{children:[e.jsxs(gs,{className:"flex items-center gap-2",children:[e.jsx(Gi,{className:"h-5 w-5"}),"作业详情"]}),e.jsx(Xs,{children:"队列处理详细信息"})]}),e.jsx(Qe,{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:"7日报错数量"}),e.jsx("p",{className:"text-2xl font-bold text-destructive",children:a?.failedJobs||0}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["保留 ",a?.periods?.failedJobs||0," 小时"]})]}),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:"最长运行队列"}),e.jsxs("p",{className:"text-2xl font-bold",children:[a?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a?.queueWithMaxRuntime?.name||"N/A"})]})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"活跃进程"}),e.jsxs("span",{className:"font-medium",children:[a?.processes||0," /"," ",(a?.processes||0)+(a?.pausedMasters||0)]})]}),e.jsx(pt,{value:(a?.processes||0)/((a?.processes||0)+(a?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]})}function qd(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:"仪表盘"})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ke,{}),e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsx(_e,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"border-b pb-6"}),e.jsxs("div",{className:"grid gap-6",children:[e.jsx($d,{}),e.jsx(Fd,{}),e.jsx(Ad,{}),e.jsx(Kd,{})]})]})})]})}const Ud=Object.freeze(Object.defineProperty({__proto__:null,default:qd},Symbol.toStringTag,{value:"Module"})),je=c.forwardRef(({className:s,orientation:t="horizontal",decorative:a=!0,...n},l)=>e.jsx(In,{ref:l,decorative:a,orientation:t,className:v("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...n}));je.displayName=In.displayName;function Bd({className:s,items:t,...a}){const{pathname:n}=Zt(),l=ns(),[o,d]=c.useState(n??"/settings"),x=r=>{d(r),l(r)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(G,{value:o,onValueChange:x,children:[e.jsx(U,{className:"h-12 sm:w-48",children:e.jsx(Y,{placeholder:"Theme"})}),e.jsx(B,{children:t.map(r=>e.jsx(O,{value:r.href,children:e.jsxs("div",{className:"flex gap-x-4 px-2 py-1",children:[e.jsx("span",{className:"scale-125",children:r.icon}),e.jsx("span",{className:"text-md",children:r.title})]})},r.href))})]})}),e.jsx("div",{className:"hidden w-full overflow-x-auto bg-background px-1 py-2 md:block",children:e.jsx("nav",{className:v("flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",s),...a,children:t.map(r=>e.jsxs(Ts,{to:r.href,className:v(As({variant:"ghost"}),n===r.href?"bg-muted hover:bg-muted":"hover:bg-transparent hover:underline","justify-start"),children:[e.jsx("span",{className:"mr-2",children:r.icon}),r.title]},r.href))})})]})}const yr=[{title:"站点设置",key:"site",icon:e.jsx(Yi,{size:18}),href:"/config/system",description:"配置站点基本信息,包括站点名称、描述、货币单位等核心设置。"},{title:"安全设置",key:"safe",icon:e.jsx(dn,{size:18}),href:"/config/system/safe",description:"配置系统安全相关选项,包括登录验证、密码策略、API访问等安全设置。"},{title:"订阅设置",key:"subscribe",icon:e.jsx(un,{size:18}),href:"/config/system/subscribe",description:"管理用户订阅相关配置,包括订阅链接格式、更新频率、流量统计等设置。"},{title:"邀请&佣金",key:"invite",icon:e.jsx(Wi,{size:18}),href:"/config/system/invite",description:"管理用户邀请和佣金系统,配置邀请奖励、分销规则等。"},{title:"节点配置",key:"server",icon:e.jsx(cn,{size:18}),href:"/config/system/server",description:"配置节点通信和同步设置,包括通信密钥、轮询间隔、负载均衡等高级选项。"},{title:"邮件设置",key:"email",icon:e.jsx(Ji,{size:18}),href:"/config/system/email",description:"配置系统邮件服务,用于发送验证码、密码重置、通知等邮件,支持多种SMTP服务商。"},{title:"Telegram设置",key:"telegram",icon:e.jsx(Qi,{size:18}),href:"/config/system/telegram",description:"配置Telegram机器人功能,实现用户通知、账户绑定、指令交互等自动化服务。"},{title:"APP设置",key:"app",icon:e.jsx(on,{size:18}),href:"/config/system/app",description:"管理移动应用程序相关配置,包括API接口、版本控制、推送通知等功能设置。"}];function Gd(){return e.jsxs(ye,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:"系统设置"}),e.jsx("div",{className:"text-muted-foreground",children:"管理系统核心配置,包括站点、安全、订阅、邀请佣金、节点、邮件和通知等设置"})]}),e.jsx(je,{className:"my-6"}),e.jsxs("div",{className:"flex flex-1 flex-col space-y-8 overflow-auto lg:flex-row lg:space-x-12 lg:space-y-0",children:[e.jsx("aside",{className:"sticky top-0 lg:w-1/5",children:e.jsx(Bd,{items:yr})}),e.jsx("div",{className:"w-full p-1 pr-4 lg:max-w-xl",children:e.jsx("div",{className:"pb-16",children:e.jsx(Xt,{})})})]})]})]})}const Yd=Object.freeze(Object.defineProperty({__proto__:null,default:Gd},Symbol.toStringTag,{value:"Module"}));function Wd({title:s,description:t,children:a}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t})]}),e.jsx(je,{}),a]})}const H=c.forwardRef(({className:s,...t},a)=>e.jsx(Rn,{className:v("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...t,ref:a,children:e.jsx(Zi,{className:v("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));H.displayName=Rn.displayName;const bs=c.forwardRef(({className:s,...t},a)=>e.jsx("textarea",{className:v("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...t}));bs.displayName="Textarea";const Jd=u.object({logo:u.string().nullable().default(""),force_https:u.number().nullable().default(0),stop_register:u.number().nullable().default(0),app_name:u.string().nullable().default(""),app_description:u.string().nullable().default(""),app_url:u.string().nullable().default(""),subscribe_url:u.string().nullable().default(""),try_out_plan_id:u.number().nullable().default(0),try_out_hour:u.coerce.number().nullable().default(0),tos_url:u.string().nullable().default(""),currency:u.string().nullable().default(""),currency_symbol:u.string().nullable().default("")});function Qd(){const[s,t]=c.useState(!1),a=c.useRef(null),{data:n}=Q({queryKey:["settings","site"],queryFn:()=>os("site")}),{data:l}=Q({queryKey:["plans"],queryFn:()=>Is()}),o=ae({resolver:ie(Jd),defaultValues:{},mode:"onBlur"}),{mutateAsync:d}=We({mutationFn:cs,onSuccess:i=>{i.data&&A.success("已自动保存")}});c.useEffect(()=>{if(n?.data?.site){const i=n?.data?.site;Object.entries(i).forEach(([h,D])=>{o.setValue(h,D)}),a.current=i}},[n]);const x=c.useCallback(de.debounce(async i=>{if(!de.isEqual(i,a.current)){t(!0);try{const h=Object.entries(i).reduce((D,[C,m])=>(D[C]=m===null?"":m,D),{});await d(h),a.current=i}finally{t(!1)}}},1e3),[d]),r=c.useCallback(i=>{x(i)},[x]);return c.useEffect(()=>{const i=o.watch(h=>{r(h)});return()=>i.unsubscribe()},[o.watch,r]),e.jsx(oe,{...o,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:o.control,name:"app_name",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"站点名称"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入站点名称",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于显示需要站点名称的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"app_description",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"站点描述"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入站点描述",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于显示需要站点描述的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"app_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"站点网址"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入站点URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"当前网站最新网址,将会在邮件等需要用于网址处体现。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"force_https",render:({field:i})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"强制HTTPS"}),e.jsx(F,{children:"当站点没有使用HTTPS,CDN或反代开启强制HTTPS时需要开启。"})]}),e.jsx(y,{children:e.jsx(H,{checked:!!i.value,onCheckedChange:h=>{i.onChange(Number(h)),r(o.getValues())}})})]})}),e.jsx(g,{control:o.control,name:"logo",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"LOGO"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入LOGO URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于显示需要LOGO的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"subscribe_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"订阅URL"}),e.jsx(y,{children:e.jsx(bs,{placeholder:"用于订阅所使用,多个订阅地址用','隔开.留空则为站点URL。",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于订阅所使用,留空则为站点URL。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"tos_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"用户条款(TOS)URL"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入用户条款URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"用于跳转到用户条款(TOS)"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"stop_register",render:({field:i})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"停止新用户注册"}),e.jsx(F,{children:"开启后任何人都将无法进行注册。"})]}),e.jsx(y,{children:e.jsx(H,{checked:!!i.value,onCheckedChange:h=>{i.onChange(Number(h)),r(o.getValues())}})})]})}),e.jsx(g,{control:o.control,name:"try_out_plan_id",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"注册试用"}),e.jsx(y,{children:e.jsxs(G,{value:i.value?.toString(),onValueChange:h=>{i.onChange(Number(h)),r(o.getValues())},children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"关闭"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"关闭"}),l?.data?.map(h=>e.jsx(O,{value:h.id.toString(),children:h.name},h.id.toString()))]})]})}),e.jsx(F,{children:"选择需要试用的订阅,如果没有选项请先前往订阅管理添加。"}),e.jsx(k,{})]})}),!!o.watch("try_out_plan_id")&&e.jsx(g,{control:o.control,name:"try_out_hour",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"",children:"注册试用时长"}),e.jsx(y,{children:e.jsx(S,{placeholder:"0",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"注册试用时长,单位为小时。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"currency",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"货币单位"}),e.jsx(y,{children:e.jsx(S,{placeholder:"CNY",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"仅用于展示使用,更改后系统中所有的货币单位都将发生变更。"}),e.jsx(k,{})]})}),e.jsx(g,{control:o.control,name:"currency_symbol",render:({field:i})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"货币符号"}),e.jsx(y,{children:e.jsx(S,{placeholder:"¥",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(o.getValues())}})}),e.jsx(F,{children:"仅用于展示使用,更改后系统中所有的货币单位都将发生变更。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Zd(){const s=yr.find(t=>t.key==="site");return e.jsx(Wd,{title:s.title,description:s.description,children:e.jsx(Qd,{})})}const Xd=Object.freeze(Object.defineProperty({__proto__:null,default:Zd},Symbol.toStringTag,{value:"Module"})),eu=u.object({email_verify:u.boolean().nullable(),safe_mode_enable:u.boolean().nullable(),secure_path:u.string().nullable(),email_whitelist_enable:u.boolean().nullable(),email_whitelist_suffix:u.array(u.string().nullable()).nullable(),email_gmail_limit_enable:u.boolean().nullable(),recaptcha_enable:u.boolean().nullable(),recaptcha_key:u.string().nullable(),recaptcha_site_key:u.string().nullable(),register_limit_by_ip_enable:u.boolean().nullable(),register_limit_count:u.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:u.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:u.boolean().nullable(),password_limit_count:u.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:u.coerce.string().transform(s=>s===""?null:s).nullable()}),su={email_verify:!1,safe_mode_enable:!1,secure_path:"",email_whitelist_enable:!1,email_whitelist_suffix:[],email_gmail_limit_enable:!1,recaptcha_enable:!1,recaptcha_key:"",recaptcha_site_key:"",register_limit_by_ip_enable:!1,register_limit_count:"",register_limit_expire:"",password_limit_enable:!1,password_limit_count:"",password_limit_expire:""};function tu(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(eu),defaultValues:su,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","safe"],queryFn:()=>os("safe")}),{mutateAsync:o}=We({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data.safe){const r=l.data.safe;Object.entries(r).forEach(([i,h])=>{typeof h=="number"?n.setValue(i,String(h)):n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"email_verify",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"邮箱验证"}),e.jsx(F,{children:"开启后将会强制要求用户进行邮箱验证。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"email_gmail_limit_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"禁止使用Gmail多别名"}),e.jsx(F,{children:"开启后Gmail多别名将无法注册。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"safe_mode_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"安全模式"}),e.jsx(F,{children:"开启后除了站点URL以外的绑定本站点的域名访问都将会被403。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"secure_path",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"后台路径"}),e.jsx(y,{children:e.jsx(S,{placeholder:"admin",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(F,{children:"后台管理路径,修改后将会改变原有的admin路径"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"email_whitelist_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"邮箱后缀白名单"}),e.jsx(F,{children:"开启后在名单中的邮箱后缀才允许进行注册。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("email_whitelist_enable")&&e.jsx(g,{control:n.control,name:"email_whitelist_suffix",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"白名单后缀"}),e.jsx(y,{children:e.jsx(bs,{placeholder:"请输入后缀域名,逗号分割 如:qq.com,gmail.com",value:r.value?.length?r.value.join(","):"",onChange:i=>{const h=i.target.value?i.target.value.split(","):[];r.onChange(h),x(n.getValues())}})}),e.jsx(F,{children:"请使用逗号进行分割,如:qq.com,gmail.com。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"recaptcha_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"防机器人"}),e.jsx(F,{children:"开启后将会使用Google reCAPTCHA防止机器人。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"recaptcha_key",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"密钥"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入密钥",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"recaptcha_site_key",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"站点密钥"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入站点密钥",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:n.control,name:"register_limit_by_ip_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"IP注册限制"}),e.jsx(F,{children:"开启后同一IP将会被限制注册次数。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"register_limit_count",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限制次数"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入限制次数",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"register_limit_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限制时长(分钟)"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入限制时长",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:n.control,name:"password_limit_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"密码错误限制"}),e.jsx(F,{children:"开启后密码错误将会被限制登录。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"password_limit_count",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限制次数"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入限制次数",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"password_limit_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限制时长(分钟)"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入限制时长",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function au(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"安全设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置系统安全相关选项,包括登录验证、密码策略、API访问等安全设置。"})]}),e.jsx(je,{}),e.jsx(tu,{})]})}const nu=Object.freeze(Object.defineProperty({__proto__:null,default:au},Symbol.toStringTag,{value:"Module"})),ru=u.object({plan_change_enable:u.boolean().nullable().default(!1),reset_traffic_method:u.coerce.number().nullable().default(0),surplus_enable:u.boolean().nullable().default(!1),new_order_event_id:u.coerce.number().nullable().default(0),renew_order_event_id:u.coerce.number().nullable().default(0),change_order_event_id:u.coerce.number().nullable().default(0),show_info_to_server_enable:u.boolean().nullable().default(!1),show_protocol_to_server_enable:u.boolean().nullable().default(!1),default_remind_expire:u.boolean().nullable().default(!1),default_remind_traffic:u.boolean().nullable().default(!1),remind_mail_enable:u.boolean().nullable().default(!1),subscribe_path:u.string().nullable().default("s")}),lu={plan_change_enable:!1,reset_traffic_method:0,surplus_enable:!1,new_order_event_id:0,renew_order_event_id:0,change_order_event_id:0,show_info_to_server_enable:!1,show_protocol_to_server_enable:!1,default_remind_expire:!1,default_remind_traffic:!1,remind_mail_enable:!1,subscribe_path:"s"};function iu(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(ru),defaultValues:lu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","subscribe"],queryFn:()=>os("subscribe")}),{mutateAsync:o}=We({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data?.subscribe){const r=l?.data?.subscribe;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"plan_change_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"允许用户更改订阅"}),e.jsx(F,{children:"开启后用户将会可以对订阅计划进行变更。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"reset_traffic_method",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"月流量重置方式"}),e.jsx("div",{className:"relative w-max",children:e.jsx(y,{children:e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"每月1号"}),e.jsx(O,{value:"1",children:"按月重置"}),e.jsx(O,{value:"2",children:"不重置"}),e.jsx(O,{value:"3",children:"每年1月1号"}),e.jsx(O,{value:"4",children:"按年重置"})]})]})})}),e.jsx(F,{children:"全局流量重置方式,默认每月1号。可以在订阅管理为订阅单独设置。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"surplus_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"开启折抵方案"}),e.jsx(F,{children:"开启后用户更换订阅将会由系统对原有订阅进行折抵,方案参考文档。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"new_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"当订阅新购时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(y,{children:e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"不执行任何动作"}),e.jsx(O,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(F,{children:"新购订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"renew_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"当订阅续费时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(y,{children:e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"不执行任何动作"}),e.jsx(O,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(F,{children:"续费订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"change_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"当订阅变更时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(y,{children:e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"不执行任何动作"}),e.jsx(O,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(F,{children:"变更订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"subscribe_path",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"订阅路径"}),e.jsx(y,{children:e.jsx(S,{placeholder:"subscribe",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["订阅路径,修改后将会改变原有的subscribe路径",e.jsx("br",{}),"当前订阅路径格式:",r.value?`${r.value}/xxxxxxxxxx`:"s/xxxxxxxxxx"]}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"show_info_to_server_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"在订阅中展示订阅信息"}),e.jsx(F,{children:"开启后将会在用户订阅节点时输出订阅信息。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"show_protocol_to_server_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"在订阅中线路名称中显示协议名称"}),e.jsx(F,{children:"开启后订阅线路会附带协议名称(例如: [Hy2]香港)"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"remind_mail_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"邮件提醒"}),e.jsx(F,{children:"开启后用户订阅即将到期时和流量告急时时将发送邮件通知。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function ou(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"订阅设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"管理用户订阅相关配置,包括订阅链接格式、更新频率、流量统计等设置。"})]}),e.jsx(je,{}),e.jsx(iu,{})]})}const cu=Object.freeze(Object.defineProperty({__proto__:null,default:ou},Symbol.toStringTag,{value:"Module"})),du=u.object({invite_force:u.boolean().default(!1),invite_commission:u.coerce.string().default("0"),invite_gen_limit:u.coerce.string().default("0"),invite_never_expire:u.boolean().default(!1),commission_first_time_enable:u.boolean().default(!1),commission_auto_check_enable:u.boolean().default(!1),commission_withdraw_limit:u.coerce.string().default("0"),commission_withdraw_method:u.array(u.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:u.boolean().default(!1),commission_distribution_enable:u.boolean().default(!1),commission_distribution_l1:u.coerce.number().default(0),commission_distribution_l2:u.coerce.number().default(0),commission_distribution_l3:u.coerce.number().default(0)}),uu={invite_force:!1,invite_commission:"0",invite_gen_limit:"0",invite_never_expire:!1,commission_first_time_enable:!1,commission_auto_check_enable:!1,commission_withdraw_limit:"0",commission_withdraw_method:["支付宝","USDT","Paypal"],withdraw_close_enable:!1,commission_distribution_enable:!1,commission_distribution_l1:0,commission_distribution_l2:0,commission_distribution_l3:0};function xu(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(du),defaultValues:uu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","invite"],queryFn:()=>os("invite")}),{mutateAsync:o}=We({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data?.invite){const r=l?.data?.invite;Object.entries(r).forEach(([i,h])=>{typeof h=="number"?n.setValue(i,String(h)):n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"invite_force",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"开启强制邀请"}),e.jsx(F,{children:"开启后只有被邀请的用户才可以进行注册。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"invite_commission",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:" 邀请佣金百分比"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(F,{children:"默认全局的佣金分配比例,你可以在用户管理单独配置单个比例。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"invite_gen_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"用户可创建邀请码上限"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(F,{children:"用户可创建邀请码上限"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"invite_never_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"邀请码永不失效"}),e.jsx(F,{children:"开启后邀请码被使用后将不会失效,否则使用过后即失效。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_first_time_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"佣金仅首次发放"}),e.jsx(F,{children:"开启后被邀请人首次支付时才会产生佣金,可以在用户管理对用户进行单独配置。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_auto_check_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"佣金自动确认"}),e.jsx(F,{children:"开启后佣金将会在订单完成3日后自动进行确认。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_withdraw_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"提现单申请门槛(元)"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(F,{children:"小于门槛金额的提现单将不会被提交。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_withdraw_method",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"提现方式"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",...r,value:Array.isArray(r.value)?r.value.join(","):"",onChange:i=>{const h=i.target.value.split(",").filter(Boolean);r.onChange(h),x(n.getValues())}})}),e.jsx(F,{children:"可以支持的提现方式,多个用逗号分隔。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"withdraw_close_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"关闭提现"}),e.jsx(F,{children:"关闭后将禁止用户申请提现,且邀请佣金将会直接进入用户余额。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"三级分销"}),e.jsx(F,{children:"开启后将佣金将按照设置的3成比例进行分成,三成比例合计请不要大于100%。"})]}),e.jsx(y,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"commission_distribution_l1",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"一级邀请人比例"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_l2",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"二级邀请人比例"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_l3",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"三级邀请人比例"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function mu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"邀请&佣金设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"邀请注册、佣金相关设置。"})]}),e.jsx(je,{}),e.jsx(xu,{})]})}const hu=Object.freeze(Object.defineProperty({__proto__:null,default:mu},Symbol.toStringTag,{value:"Module"})),ju=u.object({frontend_theme:u.string().nullable(),frontend_theme_sidebar:u.string().nullable(),frontend_theme_header:u.string().nullable(),frontend_theme_color:u.string().nullable(),frontend_background_url:u.string().url().nullable()}),gu={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function fu(){const{data:s}=Q({queryKey:["settings","frontend"],queryFn:()=>os("frontend")}),t=ae({resolver:ie(ju),defaultValues:gu,mode:"onChange"});c.useEffect(()=>{if(s?.data?.frontend){const n=s?.data?.frontend;Object.entries(n).forEach(([l,o])=>{t.setValue(l,o)})}},[s]);function a(n){cs(n).then(({data:l})=>{l&&A.success("更新成功")})}return e.jsx(oe,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(a),className:"space-y-8",children:[e.jsx(g,{control:t.control,name:"frontend_theme_sidebar",render:({field:n})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"边栏风格"}),e.jsx(F,{children:"边栏风格"})]}),e.jsx(y,{children:e.jsx(H,{checked:n.value,onCheckedChange:n.onChange})})]})}),e.jsx(g,{control:t.control,name:"frontend_theme_header",render:({field:n})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"头部风格"}),e.jsx(F,{children:"边栏风格"})]}),e.jsx(y,{children:e.jsx(H,{checked:n.value,onCheckedChange:n.onChange})})]})}),e.jsx(g,{control:t.control,name:"frontend_theme_color",render:({field:n})=>e.jsxs(j,{children:[e.jsx(p,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(y,{children:e.jsxs("select",{className:v(As({variant:"outline"}),"w-[200px] appearance-none font-normal"),...n,children:[e.jsx("option",{value:"default",children:"默认"}),e.jsx("option",{value:"black",children:"黑色"}),e.jsx("option",{value:"blackblue",children:"暗蓝色"}),e.jsx("option",{value:"green",children:"奶绿色"})]})}),e.jsx(ta,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(F,{children:"主题色"}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"frontend_background_url",render:({field:n})=>e.jsxs(j,{children:[e.jsx(p,{children:"背景"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入图片地址",...n})}),e.jsx(F,{children:"将会在后台登录页面进行展示。"}),e.jsx(k,{})]})}),e.jsx(T,{type:"submit",children:"保存设置"})]})})}function pu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"个性化设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自定义系统界面外观,包括主题风格、布局、颜色方案、背景图等个性化选项。"})]}),e.jsx(je,{}),e.jsx(fu,{})]})}const vu=Object.freeze(Object.defineProperty({__proto__:null,default:pu},Symbol.toStringTag,{value:"Module"})),bu=u.object({server_pull_interval:u.coerce.number().nullable(),server_push_interval:u.coerce.number().nullable(),server_token:u.string().nullable(),device_limit_mode:u.coerce.number().nullable()}),yu={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function Nu(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(bu),defaultValues:yu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","server"],queryFn:()=>os("server")}),{mutateAsync:o}=We({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data.server){const r=l.data.server;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"server_token",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"通讯密钥"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(F,{children:"Xboard与节点通讯的密钥,以便数据不会被他人获取。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"server_pull_interval",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"节点拉取动作轮询间隔"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):null;r.onChange(h)}})}),e.jsx(F,{children:"节点从面板获取数据的间隔频率。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"server_push_interval",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"节点推送动作轮询间隔"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):null;r.onChange(h)}})}),e.jsx(F,{children:"节点推送数据到面板的间隔频率。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"device_limit_mode",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"设备限制模式"}),e.jsxs(G,{onValueChange:r.onChange,value:r.value?.toString()||"0",children:[e.jsx(y,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择设备限制模式"})})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"严格模式"}),e.jsx(O,{value:"1",children:"宽松模式"})]})]}),e.jsx(F,{children:"宽松模式下,同一IP地址使用多个节点只统计为一个设备。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function wu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"节点配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置节点通信和同步设置,包括通信密钥、轮询间隔、负载均衡等高级选项。"})]}),e.jsx(je,{}),e.jsx(Nu,{})]})}const _u=Object.freeze(Object.defineProperty({__proto__:null,default:wu},Symbol.toStringTag,{value:"Module"}));function Cu({open:s,onOpenChange:t,result:a}){const n=!a.error;return e.jsx(ue,{open:s,onOpenChange:t,children:e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(he,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n?e.jsx(Pn,{className:"h-5 w-5 text-green-500"}):e.jsx(Vn,{className:"h-5 w-5 text-destructive"}),e.jsx(xe,{children:n?"邮件发送成功":"邮件发送失败"})]}),e.jsx(Se,{children:n?"测试邮件已成功发送,请检查收件箱":"发送测试邮件时遇到错误"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"发送详情"}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2 text-sm",children:[e.jsx("div",{className:"text-muted-foreground",children:"收件地址"}),e.jsx("div",{children:a.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:a.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:a.template_name})]})]}),a.error&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium text-destructive",children:"错误信息"}),e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive break-all",children:a.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(at,{className:"h-[200px] rounded-md border p-4",children:e.jsx("div",{className:"grid gap-2 text-sm",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2",children:[e.jsx("div",{className:"text-muted-foreground",children:"驱动"}),e.jsx("div",{children:a.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:a.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:a.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:a.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:a.config.from.address?`${a.config.from.address}${a.config.from.name?` (${a.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:a.config.username||"未设置"})]})})})]})]})]})})}const Su=u.object({email_template:u.string().nullable().default("classic"),email_host:u.string().nullable().default(""),email_port:u.string().regex(/^\d+$/).nullable().default("465"),email_username:u.string().nullable().default(""),email_password:u.string().nullable().default(""),email_encryption:u.string().nullable().default(""),email_from_address:u.string().email().nullable().default("")});function ku(){const[s,t]=c.useState(null),[a,n]=c.useState(!1),l=c.useRef(null),[o,d]=c.useState(!1),x=ae({resolver:ie(Su),defaultValues:{},mode:"onBlur"}),{data:r}=Q({queryKey:["settings","email"],queryFn:()=>os("email")}),{data:i}=Q({queryKey:["emailTemplate"],queryFn:()=>Cd()}),{mutateAsync:h}=We({mutationFn:cs,onSuccess:_=>{_.data&&A.success("已自动保存")}}),{mutate:D,isPending:C}=We({mutationFn:Sd,onMutate:()=>{t(null),n(!1)},onSuccess:_=>{t(_.data),n(!0),_.data.error||A.success("发送成功")}});c.useEffect(()=>{if(r?.data.email){const _=r.data.email;Object.entries(_).forEach(([b,N])=>{x.setValue(b,N)}),l.current=_}},[r]);const m=c.useCallback(de.debounce(async _=>{if(!de.isEqual(_,l.current)){d(!0);try{await h(_),l.current=_}finally{d(!1)}}},1e3),[h]),w=c.useCallback(_=>{m(_)},[m]);return c.useEffect(()=>{const _=x.watch(b=>{w(b)});return()=>_.unsubscribe()},[x.watch,w]),e.jsxs(e.Fragment,{children:[e.jsx(oe,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:x.control,name:"email_host",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP服务器地址"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"由邮件服务商提供的服务地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_port",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP服务端口"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"常见的端口有25, 465, 587"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_encryption",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP加密方式"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"465端口加密方式一般为SSL,587端口加密方式一般为TLS"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_username",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP账号"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"由邮件服务商提供的账号"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_password",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"SMTP密码"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||"",type:"password"})}),e.jsx(F,{children:"由邮件服务商提供的密码"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_from_address",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"发件地址"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(F,{children:"由邮件服务商提供的发件地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_template",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"邮件模板"}),e.jsxs(G,{onValueChange:b=>{_.onChange(b),w(x.getValues())},value:_.value||void 0,children:[e.jsx(y,{children:e.jsx(U,{className:"w-[200px]",children:e.jsx(Y,{placeholder:"选择邮件模板"})})}),e.jsx(B,{children:i?.data?.map(b=>e.jsx(O,{value:b,children:b},b))})]}),e.jsx(F,{children:"你可以在文档查看如何自定义邮件模板"}),e.jsx(k,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(T,{onClick:()=>D(),loading:C,disabled:C,children:C?"发送中...":"发送测试邮件"})})]})}),o&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."}),s&&e.jsx(Cu,{open:a,onOpenChange:n,result:s})]})}function Tu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"邮件设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置系统邮件服务,用于发送验证码、密码重置、通知等邮件,支持多种SMTP服务商。"})]}),e.jsx(je,{}),e.jsx(ku,{})]})}const Du=Object.freeze(Object.defineProperty({__proto__:null,default:Tu},Symbol.toStringTag,{value:"Module"})),Pu=u.object({telegram_bot_enable:u.boolean().nullable(),telegram_bot_token:u.string().nullable(),telegram_discuss_link:u.string().nullable()}),Vu={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function Iu(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(Pu),defaultValues:Vu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","telegram"],queryFn:()=>os("telegram")}),{mutateAsync:o}=We({mutationFn:cs,onSuccess:h=>{h.data&&A.success("已自动保存")}}),{mutate:d,isPending:x}=We({mutationFn:kd,onSuccess:h=>{h.data&&A.success("Webhook设置成功")}});c.useEffect(()=>{if(l?.data.telegram){const h=l.data.telegram;Object.entries(h).forEach(([D,C])=>{n.setValue(D,C)}),a.current=h}},[l]);const r=c.useCallback(de.debounce(async h=>{if(!de.isEqual(h,a.current)){t(!0);try{await o(h),a.current=h}finally{t(!1)}}},1e3),[o]),i=c.useCallback(h=>{r(h)},[r]);return c.useEffect(()=>{const h=n.watch(D=>{i(D)});return()=>h.unsubscribe()},[n.watch,i]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"telegram_bot_token",render:({field:h})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"机器人Token"}),e.jsx(y,{children:e.jsx(S,{placeholder:"0000000000:xxxxxxxxx_xxxxxxxxxxxxxxx",...h,value:h.value||""})}),e.jsx(F,{children:"请输入由Botfather提供的token。"}),e.jsx(k,{})]})}),n.watch("telegram_bot_token")&&e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"设置Webhook"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(T,{loading:x,disabled:x,onClick:()=>d(),children:x?"Webhook设置中...":"一键设置"}),s&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"保存中..."})]}),e.jsx(F,{children:"对机器人进行Webhook设置,不设置将无法收到Telegram通知。"}),e.jsx(k,{})]}),e.jsx(g,{control:n.control,name:"telegram_bot_enable",render:({field:h})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"开启机器人通知"}),e.jsx(F,{children:"开启后bot将会对绑定了telegram的管理员和用户进行基础通知。"}),e.jsx(y,{children:e.jsx(H,{checked:h.value||!1,onCheckedChange:D=>{h.onChange(D),i(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"telegram_discuss_link",render:({field:h})=>e.jsxs(j,{children:[e.jsx(p,{className:"text-base",children:"群组地址"}),e.jsx(y,{children:e.jsx(S,{placeholder:"https://t.me/xxxxxx",...h,value:h.value||""})}),e.jsx(F,{children:"填写后将会在用户端展示,或者被用于需要的地方。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Ru(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Telegram设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置Telegram机器人功能,实现用户通知、账户绑定、指令交互等自动化服务。"})]}),e.jsx(je,{}),e.jsx(Iu,{})]})}const Eu=Object.freeze(Object.defineProperty({__proto__:null,default:Ru},Symbol.toStringTag,{value:"Module"})),Fu=u.object({windows_version:u.string().nullable(),windows_download_url:u.string().nullable(),macos_version:u.string().nullable(),macos_download_url:u.string().nullable(),android_version:u.string().nullable(),android_download_url:u.string().nullable()}),Mu={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function zu(){const[s,t]=c.useState(!1),a=c.useRef(null),n=ae({resolver:ie(Fu),defaultValues:Mu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","app"],queryFn:()=>os("app")}),{mutateAsync:o}=We({mutationFn:cs,onSuccess:r=>{r.data&&A.success("已自动保存")}});c.useEffect(()=>{if(l?.data.app){const r=l.data.app;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=c.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await o(r),a.current=r}finally{t(!1)}}},1e3),[o]),x=c.useCallback(r=>{d(r)},[d]);return c.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Windows"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"Windows端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"windows_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(y,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"windows_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(y,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.exe",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"macOS"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"macOS端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"macos_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(y,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"macos_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(y,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.dmg",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Android"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"Android端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"android_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(y,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"android_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(y,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.apk",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Ou(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"APP设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"管理移动应用程序相关配置,包括API接口、版本控制、推送通知等功能设置。"})]}),e.jsx(je,{}),e.jsx(zu,{})]})}const Lu=Object.freeze(Object.defineProperty({__proto__:null,default:Ou},Symbol.toStringTag,{value:"Module"})),ca=c.forwardRef(({className:s,...t},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:v("w-full caption-bottom text-sm",s),...t})}));ca.displayName="Table";const da=c.forwardRef(({className:s,...t},a)=>e.jsx("thead",{ref:a,className:v("[&_tr]:border-b",s),...t}));da.displayName="TableHeader";const ua=c.forwardRef(({className:s,...t},a)=>e.jsx("tbody",{ref:a,className:v("[&_tr:last-child]:border-0",s),...t}));ua.displayName="TableBody";const $u=c.forwardRef(({className:s,...t},a)=>e.jsx("tfoot",{ref:a,className:v("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...t}));$u.displayName="TableFooter";const js=c.forwardRef(({className:s,...t},a)=>e.jsx("tr",{ref:a,className:v("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...t}));js.displayName="TableRow";const xa=c.forwardRef(({className:s,...t},a)=>e.jsx("th",{ref:a,className:v("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t}));xa.displayName="TableHead";const Ls=c.forwardRef(({className:s,...t},a)=>e.jsx("td",{ref:a,className:v("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t}));Ls.displayName="TableCell";const Au=c.forwardRef(({className:s,...t},a)=>e.jsx("caption",{ref:a,className:v("mt-4 text-sm text-muted-foreground",s),...t}));Au.displayName="TableCaption";function Hu({table:s}){const[t,a]=c.useState("");c.useEffect(()=>{a((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const n=l=>{const o=parseInt(l);!isNaN(o)&&o>=1&&o<=s.getPageCount()?s.setPageIndex(o-1):a((s.getState().pagination.pageIndex+1).toString())};return e.jsxs("div",{className:"flex flex-col-reverse gap-4 px-2 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex-1 text-sm text-muted-foreground",children:["已选择 ",s.getFilteredSelectedRowModel().rows.length," 项, 共"," ",s.getFilteredRowModel().rows.length," 项"]}),e.jsxs("div",{className:"flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"每页显示"}),e.jsxs(G,{value:`${s.getState().pagination.pageSize}`,onValueChange:l=>{s.setPageSize(Number(l))},children:[e.jsx(U,{className:"h-8 w-[70px]",children:e.jsx(Y,{placeholder:s.getState().pagination.pageSize})}),e.jsx(B,{side:"top",children:[10,20,30,40,50,100,500].map(l=>e.jsx(O,{value:`${l}`,children:l},l))})]})]}),e.jsxs("div",{className:"flex items-center justify-center space-x-2 text-sm font-medium",children:[e.jsx("span",{children:"第"}),e.jsx(S,{type:"text",value:t,onChange:l=>a(l.target.value),onBlur:l=>n(l.target.value),onKeyDown:l=>{l.key==="Enter"&&n(l.currentTarget.value)},className:"h-8 w-[50px] text-center"}),e.jsxs("span",{children:["页,共 ",s.getPageCount()," 页"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(T,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(0),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:"跳转到第一页"}),e.jsx(Xi,{className:"h-4 w-4"})]}),e.jsxs(T,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.previousPage(),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:"上一页"}),e.jsx(Cn,{className:"h-4 w-4"})]}),e.jsxs(T,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.nextPage(),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:"下一页"}),e.jsx(sa,{className:"h-4 w-4"})]}),e.jsxs(T,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(s.getPageCount()-1),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:"跳转到最后一页"}),e.jsx(eo,{className:"h-4 w-4"})]})]})]})]})}function Ue({table:s,toolbar:t,draggable:a=!1,onDragStart:n,onDragEnd:l,onDragOver:o,onDragLeave:d,onDrop:x,showPagination:r=!0,isLoading:i=!1}){const h=c.useRef(null),D=s.getAllColumns().filter(_=>_.getIsPinned()==="left"),C=s.getAllColumns().filter(_=>_.getIsPinned()==="right"),m=_=>D.slice(0,_).reduce((b,N)=>b+(N.getSize()??0),0),w=_=>C.slice(_+1).reduce((b,N)=>b+(N.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof t=="function"?t(s):t,e.jsx("div",{ref:h,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs(ca,{children:[e.jsx(da,{children:s.getHeaderGroups().map(_=>e.jsx(js,{className:"hover:bg-transparent",children:_.headers.map((b,N)=>{const P=b.column.getIsPinned()==="left",f=b.column.getIsPinned()==="right",R=P?m(D.indexOf(b.column)):void 0,z=f?w(C.indexOf(b.column)):void 0;return e.jsx(xa,{colSpan:b.colSpan,style:{width:b.getSize(),...P&&{left:R},...f&&{right:z}},className:v("h-11 bg-card px-4 text-muted-foreground",(P||f)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",P&&"before:right-0",f&&"before:left-0"]),children:b.isPlaceholder?null:vt(b.column.columnDef.header,b.getContext())},b.id)})},_.id))}),e.jsx(ua,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((_,b)=>e.jsx(js,{"data-state":_.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:a,onDragStart:N=>n?.(N,b),onDragEnd:l,onDragOver:o,onDragLeave:d,onDrop:N=>x?.(N,b),children:_.getVisibleCells().map((N,P)=>{const f=N.column.getIsPinned()==="left",R=N.column.getIsPinned()==="right",z=f?m(D.indexOf(N.column)):void 0,$=R?w(C.indexOf(N.column)):void 0;return e.jsx(Ls,{style:{width:N.column.getSize(),...f&&{left:z},...R&&{right:$}},className:v("bg-card",(f||R)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",f&&"before:right-0",R&&"before:left-0"]),children:vt(N.column.columnDef.cell,N.getContext())},N.id)})},_.id)):e.jsx(js,{children:e.jsx(Ls,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:"暂无数据"})})})]})})}),r&&e.jsx(Hu,{table:s})]})}const Nr=(s,t)=>{let a=null;switch(s.field_type){case"input":a=e.jsx(S,{placeholder:s.placeholder,...t});break;case"textarea":a=e.jsx(bs,{placeholder:s.placeholder,...t});break;case"select":a=e.jsx("select",{className:v($s({variant:"outline"}),"w-full appearance-none font-normal"),...t,children:s.select_options&&Object.keys(s.select_options).map(n=>e.jsx("option",{value:n,children:s.select_options?.[n]},n))});break;default:a=null;break}return a},Ku=u.object({id:u.number().nullable(),name:u.string().min(2,"名称至少需要2个字符").max(30,"名称不能超过30个字符"),icon:u.string().optional().nullable(),notify_domain:u.string().refine(s=>!s||/^https?:\/\/\S+/.test(s),"请输入有效的URL").optional().nullable(),handling_fee_fixed:u.coerce.number().min(0).optional().nullable(),handling_fee_percent:u.coerce.number().min(0).max(100).optional().nullable(),payment:u.string().min(1,"请选择支付接口"),config:u.record(u.string(),u.string())}),La={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function wr({refetch:s,dialogTrigger:t,type:a="add",defaultFormValues:n=La}){const[l,o]=c.useState(!1),[d,x]=c.useState(!1),[r,i]=c.useState([]),[h,D]=c.useState([]),C=ae({resolver:ie(Ku),defaultValues:n,mode:"onChange"}),m=C.watch("payment");c.useEffect(()=>{l&&(async()=>{const{data:b}=await Kc();i(b)})()},[l]),c.useEffect(()=>{if(!m||!l)return;(async()=>{const b={payment:m,...a==="edit"&&{id:Number(C.getValues("id"))}};qc(b).then(({data:N})=>{D(N);const P=N.reduce((f,R)=>(R.field_name&&(f[R.field_name]=R.value??""),f),{});C.setValue("config",P)})})()},[m,l,C,a]);const w=async _=>{x(!0),(await Uc(_)).data&&(A.success("保存成功"),C.reset(La),s(),o(!1)),x(!1)};return e.jsxs(ue,{open:l,onOpenChange:o,children:[e.jsx(Ie,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"})," ",e.jsx("div",{children:"添加支付方式"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(he,{children:e.jsx(xe,{children:a==="add"?"添加支付方式":"编辑支付方式"})}),e.jsx(oe,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(w),className:"space-y-4",children:[e.jsx(g,{control:C.control,name:"name",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"显示名称"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入支付名称",..._})}),e.jsx(F,{children:"用于前端显示"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"icon",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"图标URL"}),e.jsx(y,{children:e.jsx(S,{placeholder:"https://example.com/icon.svg",..._})}),e.jsx(F,{children:"用于前端显示的图标地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"notify_domain",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"通知域名"}),e.jsx(y,{children:e.jsx(S,{placeholder:"https://example.com",..._})}),e.jsx(F,{children:"网关通知将发送到该域名"}),e.jsx(k,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(g,{control:C.control,name:"handling_fee_percent",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"百分比手续费(%)"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"0-100",..._})}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"handling_fee_fixed",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"固定手续费"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"0",..._})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:C.control,name:"payment",render:({field:_})=>e.jsxs(j,{children:[e.jsx(p,{children:"支付接口"}),e.jsxs(G,{value:_.value,onValueChange:_.onChange,children:[e.jsx(y,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择支付接口"})})}),e.jsx(B,{children:r.map(b=>e.jsx(O,{value:b,children:b},b))})]}),e.jsx(k,{})]})}),h.map(_=>e.jsx(g,{control:C.control,name:`config.${_.field_name}`,render:({field:b})=>e.jsxs(j,{children:[e.jsx(p,{children:_.label}),e.jsx(y,{children:Nr(_,b)}),e.jsx(k,{})]})},_.field_name)),e.jsxs(Re,{className:"gap-2",children:[e.jsx(ot,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",disabled:d,className:v(d&&"cursor-not-allowed opacity-50"),children:d?"保存中...":"提交"})]})]})})]})]})}function V({column:s,title:t,tooltip:a,className:n}){return s.getCanSort()?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(T,{variant:"ghost",size:"default",className:v("-ml-3 flex h-8 items-center gap-2 text-nowrap font-medium hover:bg-muted/60",n),onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:[e.jsx("span",{children:t}),a&&e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(ka,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(ee,{children:a})]})}),s.getIsSorted()==="asc"?e.jsx(Kt,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(qt,{className:"h-4 w-4 text-foreground/70"}):e.jsx(so,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-foreground/70"})]})})}):e.jsxs("div",{className:v("flex items-center space-x-1 text-nowrap py-2 font-medium text-muted-foreground",n),children:[e.jsx("span",{children:t}),a&&e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx(ka,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(ee,{children:a})]})})]})}const qu=to,Uu=ao,Bu=no,_r=c.forwardRef(({className:s,...t},a)=>e.jsx(En,{className:v("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t,ref:a}));_r.displayName=En.displayName;const Cr=c.forwardRef(({className:s,...t},a)=>e.jsxs(Bu,{children:[e.jsx(_r,{}),e.jsx(Fn,{ref:a,className:v("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...t})]}));Cr.displayName=Fn.displayName;const Sr=({className:s,...t})=>e.jsx("div",{className:v("flex flex-col space-y-2 text-center sm:text-left",s),...t});Sr.displayName="AlertDialogHeader";const kr=({className:s,...t})=>e.jsx("div",{className:v("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});kr.displayName="AlertDialogFooter";const Tr=c.forwardRef(({className:s,...t},a)=>e.jsx(Mn,{ref:a,className:v("text-lg font-semibold",s),...t}));Tr.displayName=Mn.displayName;const Dr=c.forwardRef(({className:s,...t},a)=>e.jsx(zn,{ref:a,className:v("text-sm text-muted-foreground",s),...t}));Dr.displayName=zn.displayName;const Pr=c.forwardRef(({className:s,...t},a)=>e.jsx(On,{ref:a,className:v($s(),s),...t}));Pr.displayName=On.displayName;const Vr=c.forwardRef(({className:s,...t},a)=>e.jsx(Ln,{ref:a,className:v($s({variant:"outline"}),"mt-2 sm:mt-0",s),...t}));Vr.displayName=Ln.displayName;function Be({onConfirm:s,children:t,title:a="确认操作",description:n="确定要执行此操作吗?",cancelText:l="取消",confirmText:o="确认",variant:d="default",className:x}){return e.jsxs(qu,{children:[e.jsx(Uu,{asChild:!0,children:t}),e.jsxs(Cr,{className:v("sm:max-w-[425px]",x),children:[e.jsxs(Sr,{children:[e.jsx(Tr,{children:a}),e.jsx(Dr,{children:n})]}),e.jsxs(kr,{children:[e.jsx(Vr,{asChild:!0,children:e.jsx(T,{variant:"outline",children:l})}),e.jsx(Pr,{asChild:!0,children:e.jsx(T,{variant:d,onClick:s,children:o})})]})]})]})}const Ir=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M11.29 15.29a2 2 0 0 0-.12.15a.8.8 0 0 0-.09.18a.6.6 0 0 0-.06.18a1.4 1.4 0 0 0 0 .2a.84.84 0 0 0 .08.38a.9.9 0 0 0 .54.54a.94.94 0 0 0 .76 0a.9.9 0 0 0 .54-.54A1 1 0 0 0 13 16a1 1 0 0 0-.29-.71a1 1 0 0 0-1.42 0M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8 8 0 0 1-8 8m0-13a3 3 0 0 0-2.6 1.5a1 1 0 1 0 1.73 1A1 1 0 0 1 12 9a1 1 0 0 1 0 2a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-.18A3 3 0 0 0 12 7"})}),Gu=({refetch:s,isSortMode:t=!1})=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:t?"cursor-move":"opacity-0",children:e.jsx(Tt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(V,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(L,{variant:"outline",children:a.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:a})=>e.jsx(V,{column:a,title:"启用"}),cell:({row:a})=>e.jsx(H,{defaultChecked:a.getValue("enable"),onCheckedChange:async()=>{const{data:n}=await Gc({id:a.original.id});n||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:a})=>e.jsx(V,{column:a,title:"显示名称"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:a.getValue("name")})}),enableSorting:!1,size:200},{accessorKey:"payment",header:({column:a})=>e.jsx(V,{column:a,title:"支付接口"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:a.getValue("payment")})}),enableSorting:!1,size:200},{accessorKey:"notify_url",header:({column:a})=>e.jsxs("div",{className:"flex items-center",children:[e.jsx(V,{column:a,title:"通知地址"}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{className:"ml-1",children:e.jsx(Ir,{className:"h-4 w-4"})}),e.jsx(ee,{children:"支付网关将会把数据通知到本地址,请通过防火墙放行本地址。"})]})})]}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[300px] truncate font-medium",children:a.getValue("notify_url")})}),enableSorting:!1,size:3e3},{id:"actions",header:({column:a})=>e.jsx(V,{className:"justify-end",column:a,title:"操作"}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(wr,{refetch:s,dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Ds,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:a.original}),e.jsx(Be,{title:"删除确认",description:"确定要删除该支付方式吗?此操作无法撤销。",onConfirm:async()=>{const{data:n}=await Bc({id:a.original.id});n&&s()},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function Yu({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽支付方式进行排序,完成后点击保存"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wr,{refetch:t}),e.jsx(S,{placeholder:"搜索支付方式...",value:s.getColumn("name")?.getFilterValue()??"",onChange:o=>s.getColumn("name")?.setFilterValue(o.target.value),className:"h-8 w-[250px]"}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:["重置",e.jsx(Fe,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:n?"default":"outline",onClick:a,size:"sm",children:n?"保存排序":"编辑排序"})})]})}function Wu(){const[s,t]=c.useState([]),[a,n]=c.useState([]),[l,o]=c.useState(!1),[d,x]=c.useState([]),[r,i]=c.useState({"drag-handle":!1}),[h,D]=c.useState({pageSize:20,pageIndex:0}),{refetch:C}=Q({queryKey:["paymentList"],queryFn:async()=>{const{data:N}=await Hc();return x(N?.map(P=>({...P,enable:!!P.enable}))||[]),N}});c.useEffect(()=>{i({"drag-handle":l}),D({pageSize:l?99999:10,pageIndex:0})},[l]);const m=(N,P)=>{l&&(N.dataTransfer.setData("text/plain",P.toString()),N.currentTarget.classList.add("opacity-50"))},w=(N,P)=>{if(!l)return;N.preventDefault(),N.currentTarget.classList.remove("bg-muted");const f=parseInt(N.dataTransfer.getData("text/plain"));if(f===P)return;const R=[...d],[z]=R.splice(f,1);R.splice(P,0,z),x(R)},_=async()=>{l?Yc({ids:d.map(N=>N.id)}).then(()=>{C(),o(!1),A.success("排序保存成功")}):o(!0)},b=Me({data:d,columns:Gu({refetch:C,isSortMode:l}),state:{sorting:a,columnFilters:s,columnVisibility:r,pagination:h},onSortingChange:n,onColumnFiltersChange:t,onColumnVisibilityChange:i,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),getSortedRowModel:Ke(),initialState:{columnPinning:{right:["actions"]}},pageCount:l?1:void 0});return e.jsx(Ue,{table:b,toolbar:N=>e.jsx(Yu,{table:N,refetch:C,saveOrder:_,isSortMode:l}),draggable:l,onDragStart:m,onDragEnd:N=>N.currentTarget.classList.remove("opacity-50"),onDragOver:N=>{N.preventDefault(),N.currentTarget.classList.add("bg-muted")},onDragLeave:N=>N.currentTarget.classList.remove("bg-muted"),onDrop:w,showPagination:!l})}function Ju(){return e.jsxs(ye,{children:[e.jsxs(Ne,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{children:[e.jsx("header",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"支付配置"})}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置支付方式,包括支付宝、微信等。"})]})}),e.jsx("section",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Wu,{})})]})]})}const Qu=Object.freeze(Object.defineProperty({__proto__:null,default:Ju},Symbol.toStringTag,{value:"Module"}));function Zu({themeKey:s,themeInfo:t}){const[a,n]=c.useState(!1),[l,o]=c.useState(!1),[d,x]=c.useState(!1),r=ae({defaultValues:t.configs.reduce((D,C)=>(D[C.field_name]="",D),{})}),i=async()=>{o(!0),Tc(s).then(({data:D})=>{Object.entries(D).forEach(([C,m])=>{r.setValue(C,m)})}).finally(()=>{o(!1)})},h=async D=>{x(!0),Dc(s,D).then(()=>{A.success("保存成功"),n(!1)}).finally(()=>{x(!1)})};return e.jsxs(ue,{open:a,onOpenChange:D=>{n(D),D?i():r.reset()},children:[e.jsx(Ie,{asChild:!0,children:e.jsx(T,{variant:"outline",children:"主题设置"})}),e.jsxs(ce,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(he,{children:[e.jsxs(xe,{children:["配置",t.name,"主题"]}),e.jsx(Se,{children:"修改主题的样式、布局和其他显示选项。"})]}),l?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(aa,{className:"h-6 w-6 animate-spin"})}):e.jsx(oe,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(h),className:"space-y-4",children:[t.configs.map(D=>e.jsx(g,{control:r.control,name:D.field_name,render:({field:C})=>e.jsxs(j,{children:[e.jsx(p,{children:D.label}),e.jsx(y,{children:Nr(D,C)}),e.jsx(k,{})]})},D.field_name)),e.jsxs(Re,{className:"mt-6 gap-2",children:[e.jsx(T,{type:"button",variant:"secondary",onClick:()=>n(!1),children:"取消"}),e.jsx(T,{type:"submit",loading:d,children:"保存"})]})]})})]})]})}function Xu(){const[s,t]=c.useState(null),[a,n]=c.useState(!1),[l,o]=c.useState(!1),[d,x]=c.useState(!1),[r,i]=c.useState(null),h=c.useRef(null),[D,C]=c.useState(0),{data:m,isLoading:w,refetch:_}=Q({queryKey:["themeList"],queryFn:async()=>{const{data:E}=await kc();return E}}),b=async E=>{t(E),Ic({frontend_theme:E}).then(()=>{A.success("主题切换成功"),_()}).finally(()=>{t(null)})},N=async E=>{if(!E.name.endsWith(".zip")){A.error("只支持上传 ZIP 格式的主题文件");return}n(!0),Pc(E).then(()=>{A.success("主题上传成功"),o(!1),_()}).finally(()=>{n(!1),h.current&&(h.current.value="")})},P=E=>{E.preventDefault(),E.stopPropagation(),E.type==="dragenter"||E.type==="dragover"?x(!0):E.type==="dragleave"&&x(!1)},f=E=>{E.preventDefault(),E.stopPropagation(),x(!1),E.dataTransfer.files&&E.dataTransfer.files[0]&&N(E.dataTransfer.files[0])},R=()=>{r&&C(E=>E===0?r.images.length-1:E-1)},z=()=>{r&&C(E=>E===r.images.length-1?0:E+1)},$=(E,K)=>{C(0),i({name:E,images:K})};return e.jsxs(ye,{children:[e.jsxs(Ne,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"主题配置"})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-muted-foreground",children:"主题配置,包括主题色、字体大小等。如果你采用前后分离的方式部署V2board,那么主题配置将不会生效。"}),e.jsxs(T,{onClick:()=>o(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(Ht,{className:"mr-2 h-4 w-4"}),"上传主题"]})]})]}),e.jsx("section",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3",children:w?e.jsxs(e.Fragment,{children:[e.jsx($a,{}),e.jsx($a,{})]}):m?.themes&&Object.entries(m.themes).map(([E,K])=>e.jsx($e,{className:"group relative overflow-hidden transition-all hover:shadow-md",style:{backgroundImage:K.background_url?`url(${K.background_url})`:"none",backgroundSize:"cover",backgroundPosition:"center"},children:e.jsxs("div",{className:v("relative z-10 h-full transition-colors",K.background_url?"group-hover:from-background/98 bg-gradient-to-t from-background/95 via-background/80 to-background/60 backdrop-blur-[1px] group-hover:via-background/90 group-hover:to-background/70":"bg-background"),children:[!!K.can_delete&&e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(Be,{title:"删除主题",description:"确定要删除该主题吗?删除后无法恢复。",confirmText:"删除",variant:"destructive",onConfirm:async()=>{if(E===m?.active){A.error("不能删除当前使用的主题");return}t(E),Vc(E).then(()=>{A.success("主题删除成功"),_()}).finally(()=>{t(null)})},children:e.jsx(T,{disabled:s===E,loading:s===E,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(rs,{className:"h-4 w-4"})})})}),e.jsxs(Je,{children:[e.jsx(gs,{children:K.name}),e.jsx(Xs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{children:K.description}),K.version&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:["版本: ",K.version]})]})})]}),e.jsxs(Qe,{className:"flex items-center justify-end space-x-3",children:[K.images&&Array.isArray(K.images)&&K.images.length>0&&e.jsx(T,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>$(K.name,K.images),children:e.jsx(ro,{className:"h-4 w-4"})}),e.jsx(Zu,{themeKey:E,themeInfo:K}),e.jsx(T,{onClick:()=>b(E),disabled:s===E||E===m.active,loading:s===E,variant:E===m.active?"secondary":"default",children:E===m.active?"当前主题":"激活主题"})]})]})},E))}),e.jsx(ue,{open:l,onOpenChange:o,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(he,{children:[e.jsx(xe,{children:"上传主题"}),e.jsx(Se,{children:"请上传一个有效的主题压缩包(.zip 格式)。主题包应包含完整的主题文件结构。"})]}),e.jsxs("div",{className:v("relative mt-4 flex h-64 flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-10 text-center transition-colors",d&&"border-primary/50 bg-muted/50"),onDragEnter:P,onDragLeave:P,onDragOver:P,onDrop:f,children:[e.jsx("input",{type:"file",ref:h,className:"hidden",accept:".zip",onChange:E=>{const K=E.target.files?.[0];K&&N(K)}}),a?e.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-b-2 border-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"正在上传..."})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"rounded-full border-2 border-muted-foreground/25 p-3",children:e.jsx(Ht,{className:"h-6 w-6 text-muted-foreground/50"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:["将主题文件拖放到此处,或者",e.jsx("button",{type:"button",onClick:()=>h.current?.click(),className:"mx-1 text-primary hover:underline",children:"点击选择"})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"支持 .zip 格式的主题包"})]})]})})]})]})}),e.jsx(ue,{open:!!r,onOpenChange:E=>{E||(i(null),C(0))},children:e.jsxs(ce,{className:"max-w-4xl",children:[e.jsxs(he,{children:[e.jsxs(xe,{children:[r?.name," 主题预览"]}),e.jsx(Se,{className:"text-center",children:r&&`${D+1} / ${r.images.length}`})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"aspect-[16/9] overflow-hidden rounded-lg border bg-muted",children:r?.images[D]&&e.jsx("img",{src:r.images[D],alt:`${r.name} 预览图 ${D+1}`,className:"h-full w-full object-contain"})}),r&&r.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(T,{variant:"outline",size:"icon",className:"absolute left-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:R,children:e.jsx(lo,{className:"h-4 w-4"})}),e.jsx(T,{variant:"outline",size:"icon",className:"absolute right-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:z,children:e.jsx(io,{className:"h-4 w-4"})})]})]}),r&&r.images.length>1&&e.jsx("div",{className:"mt-4 flex gap-2 overflow-x-auto pb-2",children:r.images.map((E,K)=>e.jsx("button",{onClick:()=>C(K),className:v("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",D===K?"border-primary":"border-transparent"),children:e.jsx("img",{src:E,alt:`缩略图 ${K+1}`,className:"h-full w-full object-cover"})},K))})]})})]})]})}function $a(){return e.jsxs($e,{children:[e.jsxs(Je,{children:[e.jsx(Ee,{className:"h-6 w-[200px]"}),e.jsx(Ee,{className:"h-4 w-[300px]"})]}),e.jsxs(Qe,{className:"flex items-center justify-end space-x-3",children:[e.jsx(Ee,{className:"h-10 w-[100px]"}),e.jsx(Ee,{className:"h-10 w-[100px]"})]})]})}const ex=Object.freeze(Object.defineProperty({__proto__:null,default:Xu},Symbol.toStringTag,{value:"Module"})),ma=c.forwardRef(({className:s,value:t,onChange:a,...n},l)=>{const[o,d]=c.useState("");c.useEffect(()=>{if(o.includes(",")){const r=new Set([...t,...o.split(",").map(i=>i.trim())]);a(Array.from(r)),d("")}},[o,a,t]);const x=()=>{if(o){const r=new Set([...t,o]);a(Array.from(r)),d("")}};return e.jsxs("div",{className:v(" has-[:focus-visible]:outline-none has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-neutral-950 dark:has-[:focus-visible]:ring-neutral-300 flex w-full flex-wrap gap-2 rounded-md border border-input shadow-sm px-3 py-2 text-sm ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",s),children:[t.map(r=>e.jsxs(L,{variant:"secondary",children:[r,e.jsx(W,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{a(t.filter(i=>i!==r))},children:e.jsx(Ut,{className:"w-3"})})]},r)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:o,onChange:r=>d(r.target.value),onKeyDown:r=>{r.key==="Enter"||r.key===","?(r.preventDefault(),x()):r.key==="Backspace"&&o.length===0&&t.length>0&&(r.preventDefault(),a(t.slice(0,-1)))},...n,ref:l})]})});ma.displayName="InputTags";const sx=u.object({id:u.number().nullable(),title:u.string().min(1).max(250),content:u.string().min(1),show:u.boolean(),tags:u.array(u.string()),img_url:u.string().nullable()}),tx={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function Rr({refetch:s,dialogTrigger:t,type:a="add",defaultFormValues:n=tx}){const[l,o]=c.useState(!1),d=ae({resolver:ie(sx),defaultValues:n,mode:"onChange",shouldFocusError:!0}),x=new na({html:!0});return e.jsx(oe,{...d,children:e.jsxs(ue,{onOpenChange:o,open:l,children:[e.jsx(Ie,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"})," ",e.jsx("div",{children:"添加公告"})]})}),e.jsxs(ce,{className:"sm:max-w-[1025px]",children:[e.jsxs(he,{children:[e.jsx(xe,{children:a==="add"?"添加公告":"编辑公告"}),e.jsx(Se,{})]}),e.jsx(g,{control:d.control,name:"title",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"标题"}),e.jsx("div",{className:"relative ",children:e.jsx(y,{children:e.jsx(S,{placeholder:"请输入公告标题",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"content",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"公告内容"}),e.jsx(y,{children:e.jsx(ra,{style:{height:"500px"},value:r.value,renderHTML:i=>x.render(i),onChange:({text:i})=>{r.onChange(i)}})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"img_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"公告背景"}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsx(S,{type:"text",placeholder:"请输入公告背景图片URL",...r,value:r.value||""})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"show",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"显示"}),e.jsx("div",{className:"relative py-2",children:e.jsx(y,{children:e.jsx(H,{checked:r.value,onCheckedChange:r.onChange})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"tags",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"节点标签"}),e.jsx(y,{children:e.jsx(ma,{value:r.value,onChange:r.onChange,placeholder:"输入后回车添加标签",className:"w-full"})}),e.jsx(k,{})]})}),e.jsxs(Re,{children:[e.jsx(ot,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",onClick:r=>{r.preventDefault(),d.handleSubmit(async i=>{Jc(i).then(({data:h})=>{h&&(A.success("提交成功"),s(),o(!1))})})()},children:"提交"})]})]})]})})}function ax({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between space-x-2 ",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[!n&&e.jsx(Rr,{refetch:t}),!n&&e.jsx(S,{placeholder:"搜索公告标题...",value:s.getColumn("title")?.getFilterValue()??"",onChange:o=>s.getColumn("title")?.setFilterValue(o.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),l&&!n&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:["重置",e.jsx(Fe,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(T,{variant:n?"default":"outline",onClick:a,className:"h-8",size:"sm",children:n?"保存排序":"编辑排序"})})]})}const nx=s=>[{id:"drag-handle",header:"",cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(oo,{className:"h-4 w-4 text-muted-foreground cursor-move"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(V,{column:t,title:"ID"}),cell:({row:t})=>e.jsx(L,{variant:"outline",className:"font-mono",children:t.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:t})=>e.jsx(V,{column:t,title:"显示状态"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(H,{defaultChecked:t.getValue("show"),onCheckedChange:async()=>{const{data:a}=await Zc({id:t.original.id});a||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:t})=>e.jsx(V,{column:t,title:"标题"}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[500px] items-center",children:e.jsx("span",{className:"truncate font-medium",children:t.getValue("title")})}),enableSorting:!1,size:6e3},{id:"actions",header:({column:t})=>e.jsx(V,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Rr,{refetch:s,dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Ds,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:t.original}),e.jsx(Be,{title:"删除确认",description:"确定要删除该条公告吗?此操作无法撤销。",onConfirm:async()=>{Qc({id:t.original.id}).then(()=>{A.success("删除成功"),s()})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function rx(){const[s,t]=c.useState({}),[a,n]=c.useState({}),[l,o]=c.useState([]),[d,x]=c.useState([]),[r,i]=c.useState(!1),[h,D]=c.useState({}),[C,m]=c.useState({pageSize:50,pageIndex:0}),[w,_]=c.useState([]),{refetch:b}=Q({queryKey:["notices"],queryFn:async()=>{const{data:z}=await Wc();return _(z),z}});c.useEffect(()=>{n({"drag-handle":r,content:!r,created_at:!r,actions:!r}),m({pageSize:r?99999:50,pageIndex:0})},[r]);const N=(z,$)=>{r&&(z.dataTransfer.setData("text/plain",$.toString()),z.currentTarget.classList.add("opacity-50"))},P=(z,$)=>{if(!r)return;z.preventDefault(),z.currentTarget.classList.remove("bg-muted");const E=parseInt(z.dataTransfer.getData("text/plain"));if(E===$)return;const K=[...w],[ds]=K.splice(E,1);K.splice($,0,ds),_(K)},f=async()=>{if(!r){i(!0);return}Td(w.map(z=>z.id)).then(()=>{A.success("排序保存成功"),i(!1),b()}).finally(()=>{i(!1)})},R=Me({data:w??[],columns:nx(b),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,columnSizing:h,pagination:C},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,onColumnSizingChange:D,onPaginationChange:m,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),getSortedRowModel:Ke(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(Ue,{table:R,toolbar:z=>e.jsx(ax,{table:z,refetch:b,saveOrder:f,isSortMode:r}),draggable:r,onDragStart:N,onDragEnd:z=>z.currentTarget.classList.remove("opacity-50"),onDragOver:z=>{z.preventDefault(),z.currentTarget.classList.add("bg-muted")},onDragLeave:z=>z.currentTarget.classList.remove("bg-muted"),onDrop:P,showPagination:!r})})}function lx(){return e.jsxs(ye,{children:[e.jsxs(Ne,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"公告管理"})}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置公告,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(rx,{})})]})]})}const ix=Object.freeze(Object.defineProperty({__proto__:null,default:lx},Symbol.toStringTag,{value:"Module"})),ox=u.object({id:u.number().nullable(),language:u.string().max(250),category:u.string().max(250),title:u.string().min(1).max(250),body:u.string().min(1),show:u.boolean()}),cx={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function Er({refreshData:s,dialogTrigger:t,type:a="add",defaultFormValues:n=cx}){const[l,o]=c.useState(!1),d=ae({resolver:ie(ox),defaultValues:n,mode:"onChange",shouldFocusError:!0}),x=new na({html:!0});return c.useEffect(()=>{l&&n.id&&ed(n.id).then(({data:r})=>{d.reset(r)})},[n.id,d,l]),e.jsxs(ue,{onOpenChange:o,open:l,children:[e.jsx(Ie,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"})," ",e.jsx("div",{children:"添加知识"})]})}),e.jsxs(ce,{className:"sm:max-w-[1025px]",children:[e.jsxs(he,{children:[e.jsx(xe,{children:a==="add"?"添加知识":"编辑知识"}),e.jsx(Se,{})]}),e.jsxs(oe,{...d,children:[e.jsx(g,{control:d.control,name:"title",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"标题"}),e.jsx("div",{className:"relative ",children:e.jsx(y,{children:e.jsx(S,{placeholder:"请输入知识标题",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"category",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"分类"}),e.jsx("div",{className:"relative ",children:e.jsx(y,{children:e.jsx(S,{placeholder:"请输入分类,分类将会自动归类",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"language",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"语言"}),e.jsx(y,{children:e.jsxs(G,{value:r.value,onValueChange:r.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择语言"})}),e.jsx(B,{children:[{field:"English",value:"en-US"},{field:"日本語",value:"ja-JP"},{field:"한국어",value:"ko-KR"},{field:"Tiếng Việt",value:"vi-VN"},{field:"简体中文",value:"zh-CN"},{field:"繁體中文",value:"zh-TW"}].map(i=>e.jsx(O,{value:i.value,className:"cursor-pointer",children:i.field},i.value))})]})})]})}),e.jsx(g,{control:d.control,name:"body",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"内容"}),e.jsx(y,{children:e.jsx(ra,{style:{height:"500px"},value:r.value,renderHTML:i=>x.render(i),onChange:({text:i})=>{r.onChange(i)}})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"show",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"显示"}),e.jsx("div",{className:"relative py-2",children:e.jsx(y,{children:e.jsx(H,{checked:r.value,onCheckedChange:r.onChange})})}),e.jsx(k,{})]})}),e.jsxs(Re,{children:[e.jsx(ot,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",onClick:()=>{d.handleSubmit(r=>{sd(r).then(({data:i})=>{i&&(d.reset(),A.success("操作成功"),o(!1),s())})})()},children:"提交"})]})]})]})]})}function dx({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(it,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(je,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(o=>l.has(o.value)).map(o=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(qe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(ps,{children:[e.jsx(Ps,{placeholder:t}),e.jsxs(vs,{children:[e.jsx(Vs,{children:"No results found."}),e.jsx(Ve,{children:a.map(o=>{const d=l.has(o.value);return e.jsxs(be,{onSelect:()=>{d?l.delete(o.value):l.add(o.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},children:[e.jsx("div",{className:v("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(ks,{className:v("h-4 w-4")})}),o.icon&&e.jsx(o.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:o.label}),n?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(o.value)})]},o.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Hs,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function ux({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽知识条目进行排序,完成后点击保存"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Er,{refreshData:t}),e.jsx(S,{placeholder:"搜索知识...",value:s.getColumn("title")?.getFilterValue()??"",onChange:o=>s.getColumn("title")?.setFilterValue(o.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(dx,{column:s.getColumn("category"),title:"分类",options:Array.from(new Set(s.getCoreRowModel().rows.map(o=>o.getValue("category")))).map(o=>({label:o,value:o}))}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:["重置",e.jsx(Fe,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:n?"default":"outline",onClick:a,size:"sm",children:n?"保存排序":"编辑排序"})})]})}const xx=({refetch:s,isSortMode:t=!1})=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:t?"cursor-move":"opacity-0",children:e.jsx(Tt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(V,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(L,{variant:"outline",className:"justify-center",children:a.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:a})=>e.jsx(V,{column:a,title:"状态"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(H,{defaultChecked:a.getValue("show"),onCheckedChange:async()=>{ad({id:a.original.id}).then(({data:n})=>{n||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:a})=>e.jsx(V,{column:a,title:"标题"}),cell:({row:a})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"line-clamp-2 font-medium",children:a.getValue("title")})}),enableSorting:!0,size:600},{accessorKey:"category",header:({column:a})=>e.jsx(V,{column:a,title:"分类"}),cell:({row:a})=>e.jsx(L,{variant:"secondary",className:"max-w-[180px] truncate",children:a.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:a})=>e.jsx(V,{className:"justify-end",column:a,title:"操作"}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx(Er,{refreshData:s,dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Ds,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:a.original}),e.jsx(Be,{title:"确认删除",description:"此操作将永久删除该知识库记录,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{td({id:a.original.id}).then(({data:n})=>{n&&(A.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function mx(){const[s,t]=c.useState([]),[a,n]=c.useState([]),[l,o]=c.useState(!1),[d,x]=c.useState([]),[r,i]=c.useState({"drag-handle":!1}),[h,D]=c.useState({pageSize:20,pageIndex:0}),{refetch:C,isLoading:m,data:w}=Q({queryKey:["knowledge"],queryFn:async()=>{const{data:f}=await Xc();return x(f||[]),f}});c.useEffect(()=>{i({"drag-handle":l}),D({pageSize:l?99999:10,pageIndex:0})},[l]);const _=(f,R)=>{l&&(f.dataTransfer.setData("text/plain",R.toString()),f.currentTarget.classList.add("opacity-50"))},b=(f,R)=>{if(!l)return;f.preventDefault(),f.currentTarget.classList.remove("bg-muted");const z=parseInt(f.dataTransfer.getData("text/plain"));if(z===R)return;const $=[...d],[E]=$.splice(z,1);$.splice(R,0,E),x($)},N=async()=>{l?nd({ids:d.map(f=>f.id)}).then(()=>{C(),o(!1),A.success("排序保存成功")}):o(!0)},P=Me({data:d,columns:xx({refetch:C,isSortMode:l}),state:{sorting:a,columnFilters:s,columnVisibility:r,pagination:h},onSortingChange:n,onColumnFiltersChange:t,onColumnVisibilityChange:i,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),getSortedRowModel:Ke(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ue,{table:P,toolbar:f=>e.jsx(ux,{table:f,refetch:C,saveOrder:N,isSortMode:l}),draggable:l,onDragStart:_,onDragEnd:f=>f.currentTarget.classList.remove("opacity-50"),onDragOver:f=>{f.preventDefault(),f.currentTarget.classList.add("bg-muted")},onDragLeave:f=>f.currentTarget.classList.remove("bg-muted"),onDrop:b,showPagination:!l})}function hx(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight mb-2",children:"知识库管理"}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置知识库,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(mx,{})})]})]})}const jx=Object.freeze(Object.defineProperty({__proto__:null,default:hx},Symbol.toStringTag,{value:"Module"}));function gx(s,t){const[a,n]=c.useState(s);return c.useEffect(()=>{const l=setTimeout(()=>n(s),t);return()=>{clearTimeout(l)}},[s,t]),a}function Ot(s,t){if(s.length===0)return{};if(!t)return{"":s};const a={};return s.forEach(n=>{const l=n[t]||"";a[l]||(a[l]=[]),a[l].push(n)}),a}function fx(s,t){const a=JSON.parse(JSON.stringify(s));for(const[n,l]of Object.entries(a))a[n]=l.filter(o=>!t.find(d=>d.value===o.value));return a}function px(s,t){for(const[,a]of Object.entries(s))if(a.some(n=>t.find(l=>l.value===n.value)))return!0;return!1}const Fr=c.forwardRef(({className:s,...t},a)=>co(l=>l.filtered.count===0)?e.jsx("div",{ref:a,className:v("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...t}):null);Fr.displayName="CommandEmpty";const nt=c.forwardRef(({value:s,onChange:t,placeholder:a,defaultOptions:n=[],options:l,delay:o,onSearch:d,loadingIndicator:x,emptyIndicator:r,maxSelected:i=Number.MAX_SAFE_INTEGER,onMaxSelected:h,hidePlaceholderWhenSelected:D,disabled:C,groupBy:m,className:w,badgeClassName:_,selectFirstItem:b=!0,creatable:N=!1,triggerSearchOnFocus:P=!1,commandProps:f,inputProps:R,hideClearAllButton:z=!1},$)=>{const E=c.useRef(null),[K,ds]=c.useState(!1),Ks=c.useRef(!1),[va,ba]=c.useState(!1),[J,qs]=c.useState(s||[]),[ys,ya]=c.useState(Ot(n,m)),[us,Ft]=c.useState(""),Us=gx(us,o||500);c.useImperativeHandle($,()=>({selectedValue:[...J],input:E.current,focus:()=>E.current?.focus()}),[J]);const ct=c.useCallback(q=>{const Z=J.filter(Ce=>Ce.value!==q.value);qs(Z),t?.(Z)},[t,J]),ll=c.useCallback(q=>{const Z=E.current;Z&&((q.key==="Delete"||q.key==="Backspace")&&Z.value===""&&J.length>0&&(J[J.length-1].fixed||ct(J[J.length-1])),q.key==="Escape"&&Z.blur())},[ct,J]);c.useEffect(()=>{s&&qs(s)},[s]),c.useEffect(()=>{if(!l||d)return;const q=Ot(l||[],m);JSON.stringify(q)!==JSON.stringify(ys)&&ya(q)},[n,l,m,d,ys]),c.useEffect(()=>{const q=async()=>{ba(!0);const Ce=await d?.(Us);ya(Ot(Ce||[],m)),ba(!1)};(async()=>{!d||!K||(P&&await q(),Us&&await q())})()},[Us,m,K,P]);const il=()=>{if(!N||px(ys,[{value:us,label:us}])||J.find(Z=>Z.value===us))return;const q=e.jsx(be,{value:us,className:"cursor-pointer",onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation()},onSelect:Z=>{if(J.length>=i){h?.(J.length);return}Ft("");const Ce=[...J,{value:Z,label:Z}];qs(Ce),t?.(Ce)},children:`Create "${us}"`});if(!d&&us.length>0||d&&Us.length>0&&!va)return q},ol=c.useCallback(()=>{if(r)return d&&!N&&Object.keys(ys).length===0?e.jsx(be,{value:"-",disabled:!0,children:r}):e.jsx(Fr,{children:r})},[N,r,d,ys]),cl=c.useMemo(()=>fx(ys,J),[ys,J]),dl=c.useCallback(()=>{if(f?.filter)return f.filter;if(N)return(q,Z)=>q.toLowerCase().includes(Z.toLowerCase())?1:-1},[N,f?.filter]),ul=c.useCallback(()=>{const q=J.filter(Z=>Z.fixed);qs(q),t?.(q)},[t,J]);return e.jsxs(ps,{...f,onKeyDown:q=>{ll(q),f?.onKeyDown?.(q)},className:v("h-auto overflow-visible bg-transparent",f?.className),shouldFilter:f?.shouldFilter!==void 0?f.shouldFilter:!d,filter:dl(),children:[e.jsx("div",{className:v("rounded-md border border-input text-sm ring-offset-background focus-within:ring-1 focus-within:ring-ring ",{"px-3 py-2":J.length!==0,"cursor-text":!C&&J.length!==0},w),onClick:()=>{C||E.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[J.map(q=>e.jsxs(L,{className:v("data-[disabled]:bg-muted-foreground data-[disabled]:text-muted data-[disabled]:hover:bg-muted-foreground","data-[fixed]:bg-muted-foreground data-[fixed]:text-muted data-[fixed]:hover:bg-muted-foreground",_),"data-fixed":q.fixed,"data-disabled":C||void 0,children:[q.label,e.jsx("button",{className:v("ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",(C||q.fixed)&&"hidden"),onKeyDown:Z=>{Z.key==="Enter"&&ct(q)},onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation()},onClick:()=>ct(q),children:e.jsx(Ut,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},q.value)),e.jsx(we.Input,{...R,ref:E,value:us,disabled:C,onValueChange:q=>{Ft(q),R?.onValueChange?.(q)},onBlur:q=>{Ks.current===!1&&ds(!1),R?.onBlur?.(q)},onFocus:q=>{ds(!0),P&&d?.(Us),R?.onFocus?.(q)},placeholder:D&&J.length!==0?"":a,className:v("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":D,"px-3 py-2":J.length===0,"ml-1":J.length!==0},R?.className)}),e.jsx("button",{type:"button",onClick:ul,className:v((z||C||J.length<1||J.filter(q=>q.fixed).length===J.length)&&"hidden"),children:e.jsx(Ut,{})})]})}),e.jsx("div",{className:"relative",children:K&&e.jsx(vs,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{Ks.current=!1},onMouseEnter:()=>{Ks.current=!0},onMouseUp:()=>{E.current?.focus()},children:va?e.jsx(e.Fragment,{children:x}):e.jsxs(e.Fragment,{children:[ol(),il(),!b&&e.jsx(be,{value:"-",className:"hidden"}),Object.entries(cl).map(([q,Z])=>e.jsx(Ve,{heading:q,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:Z.map(Ce=>e.jsx(be,{value:Ce.value,disabled:Ce.disable,onMouseDown:Bs=>{Bs.preventDefault(),Bs.stopPropagation()},onSelect:()=>{if(J.length>=i){h?.(J.length);return}Ft("");const Bs=[...J,Ce];qs(Bs),t?.(Bs)},className:v("cursor-pointer",Ce.disable&&"cursor-default text-muted-foreground"),children:Ce.label},Ce.value))})},q))]})})})]})});nt.displayName="MultipleSelector";const vx=u.object({id:u.number().optional(),name:u.string().min(2,"组名至少需要2个字符").max(50,"组名不能超过50个字符").regex(/^[a-zA-Z0-9\u4e00-\u9fa5_-]+$/,"组名只能包含字母、数字、中文、下划线和连字符")});function Et({refetch:s,dialogTrigger:t,defaultValues:a={name:""},type:n="add"}){const l=ae({resolver:ie(vx),defaultValues:a,mode:"onChange"}),[o,d]=c.useState(!1),[x,r]=c.useState(!1),i=async h=>{r(!0),Oc(h).then(()=>{A.success(n==="edit"?"更新成功":"创建成功"),s&&s(),l.reset(),d(!1)}).finally(()=>{r(!1)})};return e.jsxs(ue,{open:o,onOpenChange:d,children:[e.jsx(Ie,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("span",{children:"添加权限组"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(he,{children:[e.jsx(xe,{children:n==="edit"?"编辑权限组":"创建权限组"}),e.jsx(Se,{children:n==="edit"?"修改权限组信息,更新后会立即生效。":"创建新的权限组,可以为不同的用户分配不同的权限。"})]}),e.jsx(oe,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[e.jsx(g,{control:l.control,name:"name",render:({field:h})=>e.jsxs(j,{children:[e.jsx(p,{children:"组名称"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入权限组名称",...h,className:"w-full"})}),e.jsx(F,{children:"权限组名称用于标识不同的用户组,建议使用有意义的名称。"}),e.jsx(k,{})]})}),e.jsxs(Re,{className:"gap-2",children:[e.jsx(ot,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsxs(T,{type:"submit",disabled:x||!l.formState.isValid,children:[x&&e.jsx(aa,{className:"mr-2 h-4 w-4 animate-spin"}),n==="edit"?"更新":"创建"]})]})]})})]})]})}const Mr=c.createContext(void 0);function bx({children:s,refetch:t}){const[a,n]=c.useState(!1),[l,o]=c.useState(null),[d,x]=c.useState(fe.Shadowsocks);return e.jsx(Mr.Provider,{value:{isOpen:a,setIsOpen:n,editingServer:l,setEditingServer:o,serverType:d,setServerType:x,refetch:t},children:s})}function zr(){const s=c.useContext(Mr);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function Lt({dialogTrigger:s,value:t,setValue:a,templateType:n}){c.useEffect(()=>{console.log(t)},[t]);const[l,o]=c.useState(!1),[d,x]=c.useState(()=>{if(!t||Object.keys(t).length===0)return"";try{return JSON.stringify(t,null,2)}catch{return""}}),[r,i]=c.useState(null),h=b=>{if(!b)return null;try{const N=JSON.parse(b);return typeof N!="object"||N===null?"配置必须是一个JSON对象":null}catch{return"无效的JSON格式"}},D={tcp:{label:"TCP",content:{acceptProxyProtocol:!1,header:{type:"none"}}},"tcp-http":{label:"TCP + HTTP",content:{acceptProxyProtocol:!1,header:{type:"http",request:{version:"1.1",method:"GET",path:["/"],headers:{Host:["www.example.com"]}},response:{version:"1.1",status:"200",reason:"OK"}}}},grpc:{label:"gRPC",content:{serviceName:"GunService"}},ws:{label:"WebSocket",content:{path:"/",headers:{Host:"v2ray.com"}}}},C=()=>{switch(n){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];default:return[]}},m=()=>{const b=h(d||"");if(b){A.error(b);return}try{if(!d){a(null),o(!1);return}a(JSON.parse(d)),o(!1)}catch{A.error("保存时发生错误")}},w=b=>{x(b),i(h(b))},_=b=>{const N=D[b];if(N){const P=JSON.stringify(N.content,null,2);x(P),i(null)}};return c.useEffect(()=>{l&&console.log(t)},[l,t]),c.useEffect(()=>{l&&t&&Object.keys(t).length>0&&x(JSON.stringify(t,null,2))},[l,t]),e.jsxs(ue,{open:l,onOpenChange:b=>{!b&&l&&m(),o(b)},children:[e.jsx(Ie,{asChild:!0,children:s??e.jsx(W,{variant:"link",children:"编辑协议"})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(he,{children:e.jsx(xe,{children:"编辑协议配置"})}),e.jsxs("div",{className:"space-y-4",children:[C().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:C().map(b=>e.jsxs(W,{variant:"outline",size:"sm",onClick:()=>_(b),children:["使用",D[b].label,"模板"]},b))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(bs,{className:`min-h-[200px] font-mono text-sm ${r?"border-red-500 focus-visible:ring-red-500":""}`,value:d,placeholder:`请输入JSON配置${C().length>0?"或选择上方模板":""}`,onChange:b=>w(b.target.value)}),r&&e.jsx("p",{className:"text-sm text-red-500",children:r})]})]}),e.jsxs(Re,{className:"gap-2",children:[e.jsx(W,{variant:"outline",onClick:()=>o(!1),children:"取消"}),e.jsx(W,{onClick:m,disabled:!!r,children:"确定"})]})]})]})}function vh(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const yx={},Nx=Object.freeze(Object.defineProperty({__proto__:null,default:yx},Symbol.toStringTag,{value:"Module"})),bh=No(Nx),Aa=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),wx=()=>{try{const s=uo.box.keyPair(),t=Aa(Ta.encodeBase64(s.secretKey)),a=Aa(Ta.encodeBase64(s.publicKey));return{privateKey:t,publicKey:a}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},_x=()=>{try{return wx()}catch(s){throw console.error("Error generating key pair:",s),s}},Cx=s=>{const t=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(t),Array.from(t).map(a=>a.toString(16).padStart(2,"0")).join("").substring(0,s)},Sx=()=>{const s=Math.floor(Math.random()*8)*2+2;return Cx(s)},kx=u.object({cipher:u.string().default("aes-128-gcm"),obfs:u.string().default("0"),obfs_settings:u.object({path:u.string().default(""),host:u.string().default("")}).default({})}),Tx=u.object({tls:u.coerce.number().default(0),tls_settings:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({})}),Dx=u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({})}),Px=u.object({version:u.coerce.number().default(2),alpn:u.string().default("h2"),obfs:u.object({open:u.coerce.boolean().default(!1),type:u.string().default("salamander"),password:u.string().default("")}).default({}),tls:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),bandwidth:u.object({up:u.string().default(""),down:u.string().default("")}).default({})}),Vx=u.object({tls:u.coerce.number().default(0),tls_settings:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),reality_settings:u.object({server_port:u.coerce.number().default(443),server_name:u.string().default(""),allow_insecure:u.boolean().default(!1),public_key:u.string().default(""),private_key:u.string().default(""),short_id:u.string().default("")}).default({}),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({}),flow:u.string().default("")}),es={shadowsocks:{schema:kx,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"]},vmess:{schema:Tx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:Dx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Px,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:Vx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"},{value:"kcp",label:"mKCP"},{value:"httpupgrade",label:"HttpUpgrade"},{value:"xhttp",label:"XHTTP"}],flowOptions:["none","xtls-rprx-direct","xtls-rprx-splice","xtls-rprx-vision"]}},Ix=({serverType:s,value:t,onChange:a})=>{const n=s?es[s]:null,l=n?.schema||u.record(u.any()),o=s?l.parse({}):{},d=ae({resolver:ie(l),defaultValues:o,mode:"onChange"});return c.useEffect(()=>{if(!t||Object.keys(t).length===0){if(s){const m=l.parse({});d.reset(m)}}else d.reset(t)},[s,t,a,d,l]),c.useEffect(()=>{const m=d.watch(w=>{a(w)});return()=>m.unsubscribe()},[d,a]),!s||!n?null:{shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"cipher",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"加密算法"}),e.jsx(y,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择加密算法"})}),e.jsx(B,{children:e.jsx(xs,{children:es.shadowsocks.ciphers.map(w=>e.jsx(O,{value:w,children:w},w))})})]})})]})}),e.jsx(g,{control:d.control,name:"obfs",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"混淆"}),e.jsx(y,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择混淆方式"})}),e.jsx(B,{children:e.jsxs(xs,{children:[e.jsx(O,{value:"0",children:"无"}),e.jsx(O,{value:"http",children:"HTTP"})]})})]})})]})}),d.watch("obfs")==="http"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"obfs_settings.path",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(y,{children:e.jsx(S,{type:"text",placeholder:"路径",...m})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"obfs_settings.host",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(y,{children:e.jsx(S,{type:"text",placeholder:"Host",...m})}),e.jsx(k,{})]})})]})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"tls",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"TLS"}),e.jsx(y,{children:e.jsxs(G,{value:m.value?.toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择安全性"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"不支持"}),e.jsx(O,{value:"1",children:"支持"})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"服务器名称指示(SNI)"}),e.jsx(y,{children:e.jsx(S,{placeholder:"不使用请留空",...m})})]})}),e.jsx(g,{control:d.control,name:"tls_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(p,{children:["传输协议",e.jsx(Lt,{value:d.watch("network_settings"),setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")})]}),e.jsx(y,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择传输协议"})}),e.jsx(B,{children:e.jsx(xs,{children:es.vmess.networkOptions.map(w=>e.jsx(O,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"服务器名称指示(SNI)"}),e.jsx(y,{children:e.jsx(S,{placeholder:"当节点地址于证书不一致时用于证书验证",...m,value:m.value||""})})]})}),e.jsx(g,{control:d.control,name:"allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(p,{children:["传输协议",e.jsx(Lt,{value:d.watch("network_settings")||{},setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")||"tcp"})]}),e.jsx(y,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value||"tcp",children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择传输协议"})}),e.jsx(B,{children:e.jsx(xs,{children:es.trojan.networkOptions.map(w=>e.jsx(O,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"version",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"协议版本"}),e.jsx(y,{children:e.jsxs(G,{value:(m.value||2).toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"协议版本"})}),e.jsx(B,{children:e.jsx(xs,{children:es.hysteria.versions.map(w=>e.jsxs(O,{value:w,className:"cursor-pointer",children:["V",w]},w))})})]})})]})}),d.watch("version")==1&&e.jsx(g,{control:d.control,name:"alpn",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"ALPN"}),e.jsx(y,{children:e.jsxs(G,{value:m.value||"h2",onValueChange:m.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"ALPN"})}),e.jsx(B,{children:e.jsx(xs,{children:es.hysteria.alpnOptions.map(w=>e.jsx(O,{value:w,children:w},w))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"obfs.open",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"混淆"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})}),!!d.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[d.watch("version")=="2"&&e.jsx(g,{control:d.control,name:"obfs.type",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"混淆实现"}),e.jsx(y,{children:e.jsxs(G,{value:m.value||"salamander",onValueChange:m.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择混淆实现"})}),e.jsx(B,{children:e.jsx(xs,{children:e.jsx(O,{value:"salamander",children:"Salamander"})})})]})})]})}),e.jsx(g,{control:d.control,name:"obfs.password",render:({field:m})=>e.jsxs(j,{className:d.watch("version")==2?"w-full":"flex-[2]",children:[e.jsx(p,{children:"混淆密码"}),e.jsxs("div",{className:"relative",children:[e.jsx(y,{children:e.jsx(S,{placeholder:"请输入混淆密码",...m,value:m.value||"",className:"pr-9"})}),e.jsx(W,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",_=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(b=>w[b%w.length]).join("");d.setValue("obfs.password",_),A.success("混淆密码生成成功")},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(ve,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})]})]})})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"服务器名称指示(SNI)"}),e.jsx(y,{children:e.jsx(S,{placeholder:"当节点地址于证书不一致时用于证书验证",...m,value:m.value||""})})]})}),e.jsx(g,{control:d.control,name:"tls.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"bandwidth.up",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"上行宽带"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入上行宽带"+(d.watch("version")==2?",留空则使用BBR":""),className:"rounded-br-none rounded-tr-none",...m,value:m.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:"Mbps"})})]})]})}),e.jsx(g,{control:d.control,name:"bandwidth.down",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"下行宽带"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入下行宽带"+(d.watch("version")==2?",留空则使用BBR":""),className:"rounded-br-none rounded-tr-none",...m,value:m.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:"Mbps"})})]})]})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"tls",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"安全性"}),e.jsx(y,{children:e.jsxs(G,{value:m.value?.toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择安全性"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"无"}),e.jsx(O,{value:"1",children:"TLS"}),e.jsx(O,{value:"2",children:"Reality"})]})]})})]})}),d.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"服务器名称指示(SNI)"}),e.jsx(y,{children:e.jsx(S,{placeholder:"不使用请留空",...m})})]})}),e.jsx(g,{control:d.control,name:"tls_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),d.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"reality_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"伪装站点(dest)"}),e.jsx(y,{children:e.jsx(S,{placeholder:"例如:example.com",...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.server_port",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"端口(port)"}),e.jsx(y,{children:e.jsx(S,{placeholder:"例如:443",...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(g,{control:d.control,name:"reality_settings.private_key",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"私钥(Private key)"}),e.jsx(y,{children:e.jsx(S,{...m})})]})}),e.jsxs(W,{variant:"outline",className:"",onClick:()=>{try{const m=_x();d.setValue("reality_settings.private_key",m.privateKey),d.setValue("reality_settings.public_key",m.publicKey),A.success("密钥对生成成功")}catch{A.error("生成密钥对失败")}},children:[e.jsx(ve,{icon:"ion:key-outline",className:"mr-2 h-4 w-4"}),"生成密钥对"]})]}),e.jsx(g,{control:d.control,name:"reality_settings.public_key",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"公钥(Public key)"}),e.jsx(y,{children:e.jsx(S,{...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.short_id",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"Short ID"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{children:e.jsx(S,{...m,placeholder:"可留空,长度为2的倍数,最长16位"})}),e.jsxs(W,{variant:"outline",onClick:()=>{const w=Sx();d.setValue("reality_settings.short_id",w),A.success("Short ID 生成成功")},children:[e.jsx(ve,{icon:"ion:refresh-outline",className:"mr-2 h-4 w-4"}),"生成"]})]}),e.jsx(F,{className:"text-xs text-muted-foreground",children:"客户端可用的 shortId 列表,可用于区分不同的客户端,使用0-f的十六进制字符"})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(p,{children:["传输协议",e.jsx(Lt,{value:d.watch("network_settings"),setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")})]}),e.jsx(y,{children:e.jsxs(G,{onValueChange:m.onChange,value:m.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择传输协议"})}),e.jsx(B,{children:e.jsx(xs,{children:es.vless.networkOptions.map(w=>e.jsx(O,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})}),e.jsx(g,{control:d.control,name:"flow",render:({field:m})=>e.jsxs(j,{children:[e.jsx(p,{children:"流控"}),e.jsx(y,{children:e.jsxs(G,{onValueChange:w=>m.onChange(w==="none"?null:w),value:m.value||"none",children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择流控"})}),e.jsx(B,{children:es.vless.flowOptions.map(w=>e.jsx(O,{value:w,children:w},w))})]})})]})})]})}[s]?.()},Rx=u.object({id:u.number().optional().nullable(),code:u.string().optional(),name:u.string().min(1,"Please enter a valid name."),rate:u.string().min(1,"Please enter a valid rate."),tags:u.array(u.string()).default([]),excludes:u.array(u.string()).default([]),ips:u.array(u.string()).default([]),group_ids:u.array(u.string()).default([]),host:u.string().min(1,"Please enter a valid host."),port:u.string().min(1,"Please enter a valid port."),server_port:u.string().min(1,"Please enter a valid server port."),parent_id:u.string().default("0").nullable(),route_ids:u.array(u.string()).default([]),protocol_settings:u.record(u.any()).default({}).nullable()}),xt={id:null,code:"",name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null};function Ex(){const{isOpen:s,setIsOpen:t,editingServer:a,setEditingServer:n,serverType:l,setServerType:o,refetch:d}=zr(),[x,r]=c.useState([]),[i,h]=c.useState([]),[D,C]=c.useState([]),m=ae({resolver:ie(Rx),defaultValues:xt,mode:"onChange"});c.useEffect(()=>{w()},[s]),c.useEffect(()=>{a?.type&&a.type!==l&&o(a.type)},[a,l,o]),c.useEffect(()=>{a?a.type===l&&m.reset({...xt,...a}):m.reset({...xt,protocol_settings:es[l].schema.parse({})})},[a,m,l]);const w=async()=>{if(!s)return;const[f,R,z]=await Promise.all([It(),jr(),hr()]);r(f.data?.map($=>({label:$.name,value:$.id.toString()}))||[]),h(R.data?.map($=>({label:$.remarks,value:$.id.toString()}))||[]),C(z.data||[])},_=c.useMemo(()=>D?.filter(f=>(f.parent_id===0||f.parent_id===null)&&f.type===l&&f.id!==m.watch("id")),[l,D,m]),b=()=>e.jsxs(_s,{children:[e.jsx(Cs,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"添加节点"})]})}),e.jsx(fs,{align:"start",children:e.jsx(rc,{children:ws.map(({type:f,label:R})=>e.jsx(me,{onClick:()=>{o(f),t(!0)},className:"cursor-pointer",children:e.jsx(L,{variant:"outline",className:"text-white",style:{background:ts[f]},children:R})},f))})})]}),N=()=>{t(!1),n(null),m.reset(xt)},P=async()=>{const f=m.getValues();(await Rc({...f,type:l})).data&&(N(),A.success("提交成功"),d())};return e.jsxs(ue,{open:s,onOpenChange:N,children:[b(),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(he,{children:[e.jsx(xe,{children:a?"编辑节点":"新建节点"}),e.jsx(Se,{})]}),e.jsxs(oe,{...m,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:m.control,name:"name",render:({field:f})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"节点名称"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入节点名称",...f})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"rate",render:({field:f})=>e.jsxs(j,{className:"flex-[1]",children:[e.jsx(p,{children:"倍率"}),e.jsx("div",{className:"relative flex",children:e.jsx(y,{children:e.jsx(S,{type:"number",min:"0",step:"0.1",...f})})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:m.control,name:"code",render:({field:f})=>e.jsxs(j,{children:[e.jsxs(p,{children:["自定义节点ID",e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(选填)"})]}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入自定义节点ID",...f,value:f.value||""})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"tags",render:({field:f})=>e.jsxs(j,{children:[e.jsx(p,{children:"节点标签"}),e.jsx(y,{children:e.jsx(ma,{value:f.value,onChange:f.onChange,placeholder:"输入后回车添加标签",className:"w-full"})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"group_ids",render:({field:f})=>e.jsxs(j,{children:[e.jsxs(p,{className:"flex items-center justify-between",children:["权限组",e.jsx(Et,{dialogTrigger:e.jsx(T,{variant:"link",children:"添加权限组"}),refetch:w})]}),e.jsx(y,{children:e.jsx(nt,{options:x,onChange:R=>f.onChange(R.map(z=>z.value)),value:x?.filter(R=>f.value.includes(R.value)),placeholder:"请选择权限组",emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:"no results found."})})}),e.jsx(k,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:m.control,name:"host",render:({field:f})=>e.jsxs(j,{children:[e.jsx(p,{children:"节点地址"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入节点域名或者IP",...f})}),e.jsx(k,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(g,{control:m.control,name:"port",render:({field:f})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(p,{className:"flex items-center gap-1.5",children:["连接端口",e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(ve,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Da,{children:e.jsx(ee,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:"用户实际连接使用的端口,这是客户端配置中需要填写的端口号。如果使用了中转或隧道,这个端口可能与服务器实际监听的端口不同。"})})})]})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(y,{children:e.jsx(S,{placeholder:"用户连接端口",...f})}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const R=f.value;R&&m.setValue("server_port",R)},children:e.jsx(ve,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"同步到服务端口"})})]})})]}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"server_port",render:({field:f})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(p,{className:"flex items-center gap-1.5",children:["服务端口",e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(ve,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Da,{children:e.jsx(ee,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:"服务器实际监听的端口,这是在服务器上开放的真实端口。如果使用了中转或隧道,这个端口可能与用户连接端口不同。"})})})]})})]}),e.jsx(y,{children:e.jsx(S,{placeholder:"服务端开放端口",...f})}),e.jsx(k,{})]})})]})]}),s&&e.jsx(Ix,{serverType:l,value:m.watch("protocol_settings"),onChange:f=>m.setValue("protocol_settings",f,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(g,{control:m.control,name:"parent_id",render:({field:f})=>e.jsxs(j,{children:[e.jsx(p,{children:"父节点"}),e.jsxs(G,{onValueChange:f.onChange,value:f.value?.toString()||"0",children:[e.jsx(y,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"选择父节点"})})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"无"}),_?.map(R=>e.jsx(O,{value:R.id.toString(),className:"cursor-pointer",children:R.name},R.id))]})]}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"route_ids",render:({field:f})=>e.jsxs(j,{children:[e.jsx(p,{children:"路由组"}),e.jsx(y,{children:e.jsx(nt,{options:i,onChange:R=>f.onChange(R.map(z=>z.value)),value:i?.filter(R=>f.value.includes(R.value)),placeholder:"选择路由组",emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:"no results found."})})}),e.jsx(k,{})]})})]}),e.jsxs(Re,{className:"mt-6",children:[e.jsx(T,{type:"button",variant:"outline",onClick:N,children:"取消"}),e.jsx(T,{type:"submit",onClick:P,children:"提交"})]})]})]})]})}function Ha({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(it,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(je,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(o=>l.has(o.value)).map(o=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(qe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(ps,{children:[e.jsx(Ps,{placeholder:t}),e.jsxs(vs,{children:[e.jsx(Vs,{children:"No results found."}),e.jsx(Ve,{children:a.map(o=>{const d=l.has(o.value);return e.jsxs(be,{onSelect:()=>{d?l.delete(o.value):l.add(o.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},className:"cursor-pointer",children:[e.jsx("div",{className:v("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(ks,{className:v("h-4 w-4")})}),o.icon&&e.jsx(o.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${o.color}`}),e.jsx("span",{children:o.label}),n?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(o.value)})]},o.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Hs,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Fx=[{value:fe.Shadowsocks,label:ws.find(s=>s.type===fe.Shadowsocks)?.label,color:ts[fe.Shadowsocks]},{value:fe.Vmess,label:ws.find(s=>s.type===fe.Vmess)?.label,color:ts[fe.Vmess]},{value:fe.Trojan,label:ws.find(s=>s.type===fe.Trojan)?.label,color:ts[fe.Trojan]},{value:fe.Hysteria,label:ws.find(s=>s.type===fe.Hysteria)?.label,color:ts[fe.Hysteria]},{value:fe.Vless,label:ws.find(s=>s.type===fe.Vless)?.label,color:ts[fe.Vless]}];function Mx({table:s,saveOrder:t,isSortMode:a,groups:n}){const l=s.getState().columnFilters.length>0,o=n.map(d=>({label:d,value:d}));return e.jsxs("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:[!a&&e.jsxs(e.Fragment,{children:[e.jsx(Ex,{}),e.jsx(S,{placeholder:"搜索节点...",value:s.getColumn("name")?.getFilterValue()??"",onChange:d=>s.getColumn("name")?.setFilterValue(d.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(Ha,{column:s.getColumn("type"),title:"类型",options:Fx}),s.getColumn("groups")&&e.jsx(Ha,{column:s.getColumn("groups"),title:"权限组",options:o})]}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Fe,{className:"ml-2 h-4 w-4"})]})]}),a&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽节点进行排序,完成后点击保存"})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:a?"default":"outline",onClick:t,size:"sm",children:a?"保存排序":"编辑排序"})})]})}const rt=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.71 12.71a6 6 0 1 0-7.42 0a10 10 0 0 0-6.22 8.18a1 1 0 0 0 2 .22a8 8 0 0 1 15.9 0a1 1 0 0 0 1 .89h.11a1 1 0 0 0 .88-1.1a10 10 0 0 0-6.25-8.19M12 12a4 4 0 1 1 4-4a4 4 0 0 1-4 4"})}),mt={0:"bg-destructive/80 shadow-sm shadow-destructive/50",1:"bg-yellow-500/80 shadow-sm shadow-yellow-500/50",2:"bg-emerald-500/80 shadow-sm shadow-emerald-500/50"},ht={0:"未运行",1:"无人使用或异常",2:"运行正常"},zx=s=>[{id:"drag-handle",header:({column:t})=>e.jsx(V,{column:t,title:"排序"}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Tt,{className:"size-4 cursor-move text-muted-foreground transition-colors hover:text-primary","aria-hidden":"true"})}),size:50},{accessorKey:"id",header:({column:t})=>e.jsx(V,{column:t,title:"节点ID"}),cell:({row:t})=>{const a=t.getValue("id"),n=t.original.code;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(L,{variant:"outline",className:v("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:ts[t.original.type]},children:[e.jsx($n,{className:"size-3"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"flex items-center gap-0.5",children:n??a}),t.original.parent?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground/30",children:"→"}),e.jsx("span",{children:t.original.parent?.code||t.original.parent?.id})]}):""]})]}),e.jsx(T,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:text-muted-foreground group-hover/id:opacity-100",onClick:l=>{l.stopPropagation(),Nt(n||a.toString())},children:e.jsx(Pa,{className:"size-3"})})]})}),e.jsxs(ee,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[ws.find(l=>l.type===t.original.type)?.label,t.original.parent_id?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:200,enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(V,{column:t,title:"显隐"}),cell:({row:t})=>{const[a,n]=c.useState(!!t.getValue("show"));return e.jsx(H,{checked:a,onCheckedChange:async l=>{n(l),Mc({id:t.original.id,type:t.original.type,show:l?1:0}).catch(()=>{n(!l),s()})},style:{backgroundColor:a?ts[t.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(V,{column:t,title:"节点",tooltip:e.jsxs("div",{className:"grid grid-cols-1 gap-3 p-2",children:[e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:v("h-2.5 w-2.5 rounded-full",mt[0])}),e.jsx("span",{className:"text-sm font-medium",children:ht[0]})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:v("h-2.5 w-2.5 rounded-full",mt[1])}),e.jsx("span",{className:"text-sm font-medium",children:ht[1]})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:v("h-2.5 w-2.5 rounded-full",mt[2])}),e.jsx("span",{className:"text-sm font-medium",children:ht[2]})]})]})})}),cell:({row:t})=>e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:v("size-2.5 flex-shrink-0 rounded-full transition-all duration-200",mt[t.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:t.getValue("name")})]})}),e.jsx(ee,{children:e.jsx("p",{className:"font-medium",children:ht[t.original.available_status]})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:t})=>e.jsx(V,{column:t,title:"地址"}),cell:({row:t})=>{const a=`${t.original.host}:${t.original.port}`,n=t.original.port!==t.original.server_port;return e.jsxs("div",{className:"group relative flex min-w-0 items-start",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-1 gap-y-0.5 pr-7",children:[e.jsx("div",{className:"flex items-center ",children:e.jsxs("span",{className:"font-mono text-sm font-medium text-foreground/90",children:[t.original.host,":",t.original.port]})}),n&&e.jsxs("span",{className:"whitespace-nowrap text-[0.7rem] tracking-tight text-muted-foreground/40",children:["(内部端口 ",t.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(le,{delayDuration:0,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:bg-muted/50 hover:text-muted-foreground group-hover:opacity-100",onClick:l=>{l.stopPropagation(),Nt(a)},children:e.jsx(Pa,{className:"size-3"})})}),e.jsx(ee,{side:"top",sideOffset:10,children:"复制连接地址"})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:t})=>e.jsx(V,{column:t,title:"在线人数",tooltip:"在线人数根据服务端上报频率而定"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(rt,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("online")})]}),size:80,enableSorting:!0,enableHiding:!0},{accessorKey:"rate",header:({column:t})=>e.jsx(V,{column:t,title:"倍率",tooltip:"流量扣费倍率"}),cell:({row:t})=>e.jsxs(L,{variant:"secondary",className:"font-medium",children:[t.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"groups",header:({column:t})=>e.jsx(V,{column:t,title:"权限组",tooltip:"可订阅到该节点的权限组"}),cell:({row:t})=>{const a=t.getValue("groups")||[];return e.jsx("div",{className:"flex min-w-[300px] max-w-[600px] flex-wrap items-center gap-1.5",children:a.length>0?a.map((n,l)=>e.jsx(L,{variant:"secondary",className:v("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"),children:n.name},l)):e.jsx("span",{className:"text-sm text-muted-foreground",children:"--"})})},enableSorting:!1,size:600,filterFn:(t,a,n)=>{const l=t.getValue(a);return l?n.some(o=>l.includes(o)):!1}},{accessorKey:"type",header:({column:t})=>e.jsx(V,{column:t,title:"类型"}),cell:({row:t})=>{const a=t.getValue("type");return e.jsx(L,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:ts[a]},children:a})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:t})=>e.jsx(V,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{setIsOpen:a,setEditingServer:n,setServerType:l}=zr();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(_s,{modal:!1,children:[e.jsx(Cs,{asChild:!0,children:e.jsx(T,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":"打开操作菜单",children:e.jsx(bt,{className:"size-4"})})}),e.jsxs(fs,{align:"end",className:"w-40",children:[e.jsx(me,{className:"cursor-pointer",onClick:()=>{l(t.original.type),n(t.original),a(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(xo,{className:"mr-2 size-4"}),"编辑"]})}),e.jsxs(me,{className:"cursor-pointer",onClick:async()=>{Fc({id:t.original.id}).then(({data:o})=>{o&&(A.success("复制成功"),s())})},children:[e.jsx(mo,{className:"mr-2 size-4"}),"复制"]}),e.jsx(et,{}),e.jsx(me,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:o=>o.preventDefault(),children:e.jsx(Be,{title:"确认删除",description:"此操作将永久删除该节点,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Ec({id:t.original.id}).then(({data:o})=>{o&&(A.success("删除成功"),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(rs,{className:"mr-2 size-4"}),"删除"]})})})]})]})})},size:50}];function Ox(){const[s,t]=c.useState({}),[a,n]=c.useState({"drag-handle":!1}),[l,o]=c.useState([]),[d,x]=c.useState({pageSize:500,pageIndex:0}),[r,i]=c.useState([]),[h,D]=c.useState(!1),[C,m]=c.useState({}),[w,_]=c.useState([]),{refetch:b}=Q({queryKey:["nodeList"],queryFn:async()=>{const{data:$}=await hr();return _($),$}}),N=c.useMemo(()=>{const $=new Set;return w.forEach(E=>{E.groups&&E.groups.forEach(K=>$.add(K.name))}),Array.from($).sort()},[w]);c.useEffect(()=>{n({"drag-handle":h,show:!h,host:!h,online:!h,rate:!h,groups:!h,type:!1,actions:!h}),m({name:h?2e3:200}),x({pageSize:h?99999:500,pageIndex:0})},[h]);const P=($,E)=>{h&&($.dataTransfer.setData("text/plain",E.toString()),$.currentTarget.classList.add("opacity-50"))},f=($,E)=>{if(!h)return;$.preventDefault(),$.currentTarget.classList.remove("bg-muted");const K=parseInt($.dataTransfer.getData("text/plain"));if(K===E)return;const ds=[...w],[Ks]=ds.splice(K,1);ds.splice(E,0,Ks),_(ds)},R=async()=>{if(!h){D(!0);return}const $=w?.map((E,K)=>({id:E.id,order:K+1}));zc($).then(()=>{A.success("排序保存成功"),D(!1),b()}).finally(()=>{D(!1)})},z=Me({data:w||[],columns:zx(b),state:{sorting:r,columnVisibility:a,rowSelection:s,columnFilters:l,columnSizing:C,pagination:d},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:i,onColumnFiltersChange:o,onColumnVisibilityChange:n,onColumnSizingChange:m,onPaginationChange:x,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),getSortedRowModel:Ke(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(bx,{refetch:b,children:e.jsx("div",{className:"space-y-4",children:e.jsx(Ue,{table:z,toolbar:$=>e.jsx(Mx,{table:$,refetch:b,saveOrder:R,isSortMode:h,groups:N}),draggable:h,onDragStart:P,onDragEnd:$=>$.currentTarget.classList.remove("opacity-50"),onDragOver:$=>{$.preventDefault(),$.currentTarget.classList.add("bg-muted")},onDragLeave:$=>$.currentTarget.classList.remove("bg-muted"),onDrop:f,showPagination:!h})})})}function Lx(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"节点管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"管理所有节点,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Ox,{})})]})]})}const $x=Object.freeze(Object.defineProperty({__proto__:null,default:Lx},Symbol.toStringTag,{value:"Module"}));function Ax({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsx("div",{className:"flex items-center justify-between space-x-4",children:e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(Et,{refetch:t}),e.jsx(S,{placeholder:"搜索权限组...",value:s.getColumn("name")?.getFilterValue()??"",onChange:n=>s.getColumn("name")?.setFilterValue(n.target.value),className:v("h-8 w-[150px] lg:w-[250px]",a&&"border-primary/50 ring-primary/20")}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Fe,{className:"ml-2 h-4 w-4"})]})]})})}const Hx=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(V,{column:t,title:"组ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(L,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:t})=>e.jsx(V,{column:t,title:"组名称"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium",children:t.getValue("name")})})},{accessorKey:"users_count",header:({column:t})=>e.jsx(V,{column:t,title:"用户数量"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(rt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"server_count",header:({column:t})=>e.jsx(V,{column:t,title:"节点数量"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx($n,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("server_count")})]}),enableSorting:!0,size:8e3},{id:"actions",header:({column:t})=>e.jsx(V,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Et,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Ds,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]})}),e.jsx(Be,{title:"确认删除",description:"此操作将永久删除该权限组,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Lc({id:t.original.id}).then(({data:a})=>{a&&(A.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}];function Kx(){const[s,t]=c.useState({}),[a,n]=c.useState({}),[l,o]=c.useState([]),[d,x]=c.useState([]),{data:r,refetch:i,isLoading:h}=Q({queryKey:["serverGroupList"],queryFn:async()=>{const{data:C}=await It();return C}}),D=Me({data:r||[],columns:Hx(i),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),getSortedRowModel:Ke(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ue,{table:D,toolbar:C=>e.jsx(Ax,{table:C,refetch:i}),isLoading:h})}function qx(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"权限组管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"管理所有权限组,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Kx,{})})]})]})}const Ux=Object.freeze(Object.defineProperty({__proto__:null,default:qx},Symbol.toStringTag,{value:"Module"})),Bx=u.object({remarks:u.string().min(1,"Please enter a valid remarks."),match:u.array(u.string()),action:u.enum(["block","dns"]),action_value:u.string().optional()});function Or({refetch:s,dialogTrigger:t,defaultValues:a={remarks:"",match:[],action:"block",action_value:""},type:n="add"}){const l=ae({resolver:ie(Bx),defaultValues:a,mode:"onChange"}),[o,d]=c.useState(!1);return e.jsxs(ue,{open:o,onOpenChange:d,children:[e.jsx(Ie,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ve,{icon:"ion:add"})," ",e.jsx("div",{children:"添加路由"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(he,{children:[e.jsx(xe,{children:n==="edit"?"编辑路由":"创建路由"}),e.jsx(Se,{})]}),e.jsxs(oe,{...l,children:[e.jsx(g,{control:l.control,name:"remarks",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"备注"}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsx(S,{type:"text",placeholder:"请输入备注",...x})})}),e.jsx(k,{})]})}),e.jsx(g,{control:l.control,name:"match",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(p,{children:"备注"}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsx(bs,{className:"min-h-[120px]",placeholder:`example.com *.example.com`,value:x.value.join(` `),onChange:r=>{x.onChange(r.target.value.split(` -`))}})})}),e.jsx(k,{})]})}),e.jsx(g,{control:l.control,name:"action",render:({field:x})=>e.jsxs(j,{children:[e.jsx(p,{children:"动作"}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsxs(G,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择动作"})}),e.jsxs(B,{children:[e.jsx(O,{value:"block",children:"禁止访问"}),e.jsx(O,{value:"dns",children:"指定DNS服务器进行解析"})]})]})})}),e.jsx(k,{})]})}),l.watch("action")==="dns"&&e.jsx(g,{control:l.control,name:"action_value",render:({field:x})=>e.jsxs(j,{children:[e.jsx(p,{children:"DNS服务器"}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(S,{type:"text",placeholder:"请输入DNS服务器",...x})})})]})}),e.jsxs(Ee,{children:[e.jsx(it,{asChild:!0,children:e.jsx(D,{variant:"outline",children:"取消"})}),e.jsx(D,{type:"submit",onClick:()=>{Hc(l.getValues()).then(({data:x})=>{x&&(d(!1),s&&s(),l.reset())})},children:"提交"})]})]})]})]})}function Yx({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;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($r,{refetch:t}),e.jsx(S,{placeholder:"搜索路由...",value:s.getColumn("remarks")?.getFilterValue()??"",onChange:n=>s.getColumn("remarks")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),a&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["Reset",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})})}function Wx({columns:s,data:t,refetch:a}){const[n,l]=c.useState({}),[o,d]=c.useState({}),[x,r]=c.useState([]),[i,h]=c.useState([]),T=Le({data:t,columns:s,state:{sorting:i,columnVisibility:o,rowSelection:n,columnFilters:x},enableRowSelection:!0,onRowSelectionChange:l,onSortingChange:h,onColumnFiltersChange:r,onColumnVisibilityChange:d,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:T,toolbar:C=>e.jsx(Yx,{table:C,refetch:a})})}const Jx=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"组ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(L,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:t})=>e.jsx(I,{column:t,title:"备注"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsxs("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:["匹配 ",t.original.match?.length," 条规则"]})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action",header:({column:t})=>e.jsx(I,{column:t,title:"动作"}),cell:({row:t})=>{const a={dns:"指定DNS服务器进行解析",block:"禁止访问"};return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(L,{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:a[t.getValue("action")]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx($r,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(ks,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]})}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该权限组,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Kc({id:t.original.id}).then(({data:a})=>{a&&(A.success("删除成功"),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}];function Qx(){const[s,t]=c.useState([]);function a(){jr().then(({data:n})=>{t(n)})}return c.useEffect(()=>{a()},[]),e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"路由管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"管理所有路由组,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Wx,{data:s,columns:Jx(a),refetch:a})})]})]})}const Zx=Object.freeze(Object.defineProperty({__proto__:null,default:Qx},Symbol.toStringTag,{value:"Module"})),Ar=c.createContext(void 0);function Xx({children:s,refreshData:t}){const[a,n]=c.useState(!1),[l,o]=c.useState(null);return e.jsx(Ar.Provider,{value:{isOpen:a,setIsOpen:n,editingPlan:l,setEditingPlan:o,refreshData:t},children:s})}function xa(){const s=c.useContext(Ar);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function em({table:s,saveOrder:t,isSortMode:a}){const{setIsOpen:n}=xa();return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsxs(D,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>n(!0),children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"添加套餐"})]}),e.jsx(S,{placeholder:"搜索套餐...",value:s.getColumn("name")?.getFilterValue()??"",onChange:l=>s.getColumn("name")?.setFilterValue(l.target.value),className:"h-8 w-[150px] lg:w-[250px]"})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(D,{variant:a?"default":"outline",onClick:t,size:"sm",children:a?"保存排序":"编辑排序"})})]})}const Ha={monthly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},quarterly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},half_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},two_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},three_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},onetime:{color:"text-slate-700",bgColor:"bg-slate-100/80"},reset_traffic:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},sm=s=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(Dt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(L,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"显示"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("show"),onCheckedChange:a=>{zt({id:t.original.id,show:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:t})=>e.jsx(I,{column:t,title:"新购"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("sell"),onCheckedChange:a=>{zt({id:t.original.id,sell:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:t})=>e.jsx(I,{column:t,title:"续费",tooltip:"在订阅停止销售时,已购用户是否可以续费"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("renew"),onCheckedChange:a=>{zt({id:t.original.id,renew:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:t})=>e.jsx(I,{column:t,title:"名称"}),cell:({row:t})=>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:t.getValue("name")})}),enableSorting:!1,enableHiding:!1,size:900},{accessorKey:"users_count",header:({column:t})=>e.jsx(I,{column:t,title:"统计"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-2",children:[e.jsx(nt,{}),e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"group",header:({column:t})=>e.jsx(I,{column:t,title:"权限组"}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center gap-1.5 text-nowrap",children:e.jsx(L,{variant:"secondary",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"),children:t.getValue("group")?.name})}),enableSorting:!1,enableHiding:!1},{accessorKey:"prices",header:({column:t})=>e.jsx(I,{column:t,title:"价格"}),cell:({row:t})=>{const a=t.getValue("prices"),n=[{period:"月付",key:"monthly",unit:"元/月"},{period:"季付",key:"quarterly",unit:"元/季"},{period:"半年付",key:"half_yearly",unit:"元/半年"},{period:"年付",key:"yearly",unit:"元/年"},{period:"两年付",key:"two_yearly",unit:"元/两年"},{period:"三年付",key:"three_yearly",unit:"元/三年"},{period:"流量包",key:"onetime",unit:"元"},{period:"重置包",key:"reset_traffic",unit:"元/次"}];return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n.map(({period:l,key:o,unit:d})=>a[o]!=null&&e.jsxs(L,{variant:"secondary",className:y("px-2 py-0.5 font-medium transition-colors text-nowrap",Ha[o].color,Ha[o].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[l," ¥",a[o],d]},o))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{setIsOpen:a,setEditingPlan:n}=xa();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{n(t.original),a(!0)},children:[e.jsx(ks,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该订阅,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{od({id:t.original.id}).then(({data:l})=>{l&&(A.success("删除成功"),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}}],tm=u.object({id:u.number().nullable(),group_id:u.union([u.number(),u.string()]).nullable().optional(),name:u.string().min(1).max(250),content:u.string().nullable().optional(),transfer_enable:u.union([u.number().min(0),u.string().min(1)]),prices:u.object({monthly:u.union([u.number(),u.string()]).nullable().optional(),quarterly:u.union([u.number(),u.string()]).nullable().optional(),half_yearly:u.union([u.number(),u.string()]).nullable().optional(),yearly:u.union([u.number(),u.string()]).nullable().optional(),two_yearly:u.union([u.number(),u.string()]).nullable().optional(),three_yearly:u.union([u.number(),u.string()]).nullable().optional(),onetime:u.union([u.number(),u.string()]).nullable().optional(),reset_traffic:u.union([u.number(),u.string()]).nullable().optional()}).default({}),speed_limit:u.union([u.number(),u.string()]).nullable().optional(),capacity_limit:u.union([u.number(),u.string()]).nullable().optional(),device_limit:u.union([u.number(),u.string()]).nullable().optional(),force_update:u.boolean().optional(),reset_traffic_method:u.number().nullable(),users_count:u.number().optional()}),Hr=c.forwardRef(({className:s,...t},a)=>e.jsx(An,{ref:a,className:y("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",s),...t,children:e.jsx(go,{className:y("flex items-center justify-center text-current"),children:e.jsx(Cs,{className:"h-4 w-4"})})}));Hr.displayName=An.displayName;const jt={id:null,group_id:null,name:"",content:"",transfer_enable:"",prices:{monthly:"",quarterly:"",half_yearly:"",yearly:"",two_yearly:"",three_yearly:"",onetime:"",reset_traffic:""},speed_limit:"",capacity_limit:"",device_limit:"",force_update:!1,reset_traffic_method:null},gt={monthly:{label:"月付",months:1,discount:1},quarterly:{label:"季付",months:3,discount:.95},half_yearly:{label:"半年付",months:6,discount:.9},yearly:{label:"年付",months:12,discount:.85},two_yearly:{label:"两年付",months:24,discount:.8},three_yearly:{label:"三年付",months:36,discount:.75},onetime:{label:"流量包",months:1,discount:1},reset_traffic:{label:"重置包",months:1,discount:1}},am=[{value:null,label:"跟随系统设置"},{value:0,label:"每月1号"},{value:1,label:"按月重置"},{value:2,label:"不重置"},{value:3,label:"每年1月1日"},{value:4,label:"按年重置"}];function nm(){const{isOpen:s,setIsOpen:t,editingPlan:a,setEditingPlan:n,refreshData:l}=xa(),[o,d]=c.useState(!1),x=ae({resolver:ie(tm),defaultValues:{...jt,...a||{}},mode:"onChange"});c.useEffect(()=>{a?x.reset({...jt,...a}):x.reset(jt)},[a,x]);const r=new ta({html:!0}),[i,h]=c.useState();async function T(){Vt().then(({data:w})=>{h(w)})}c.useEffect(()=>{s&&T()},[s]);const C=w=>{if(isNaN(w))return;const _=Object.entries(gt).reduce((v,[N,P])=>{const f=w*P.months*P.discount;return{...v,[N]:f.toFixed(2)}},{});x.setValue("prices",_,{shouldDirty:!0})},m=()=>{t(!1),n(null),x.reset(jt)};return e.jsx(ue,{open:s,onOpenChange:m,children:e.jsxs(ce,{children:[e.jsxs(je,{children:[e.jsx(xe,{children:a?"编辑套餐":"添加套餐"}),e.jsx(Se,{})]}),e.jsxs(oe,{...x,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:x.control,name:"name",render:({field:w})=>e.jsxs(j,{children:[e.jsx(p,{children:"套餐名称"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入套餐名称",...w})}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"group_id",render:({field:w})=>e.jsxs(j,{children:[e.jsxs(p,{className:"flex items-center justify-between",children:["权限组",e.jsx(Et,{dialogTrigger:e.jsx(D,{variant:"link",children:"添加权限组"}),refetch:T})]}),e.jsxs(G,{value:w.value||"",onValueChange:w.onChange,children:[e.jsx(b,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"选择权限组"})})}),e.jsx(B,{children:i?.map(_=>e.jsx(O,{value:_.id,children:_.name},_.id))})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"transfer_enable",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"流量"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(S,{type:"number",min:0,placeholder:"请输入流量大小",className:"rounded-r-none",...w})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:"GB"})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"speed_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"限速"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(S,{type:"number",min:0,placeholder:"请输入限速",className:"rounded-r-none",...w})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:"Mbps"})]}),e.jsx(k,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center",children:[e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"}),e.jsx("h3",{className:"mx-4 text-sm font-medium text-gray-500 dark:text-gray-400",children:"售价设置"}),e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(S,{type:"number",placeholder:"基础月付价格",className:"h-7 w-32 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500",onChange:w=>{const _=parseFloat(w.target.value);C(_)}})]}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(D,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const w=Object.keys(gt).reduce((_,v)=>({..._,[v]:""}),{});x.setValue("prices",w,{shouldDirty:!0})},children:"清空价格"})}),e.jsx(ee,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:"清空所有周期的价格设置"})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(gt).filter(([w])=>!["onetime","reset_traffic"].includes(w)).map(([w,_])=>e.jsx("div",{className:"group relative rounded-md bg-card p-2 ring-1 ring-gray-200 transition-all hover:ring-primary dark:ring-gray-800",children:e.jsx(g,{control:x.control,name:`prices.${w}`,render:({field:v})=>e.jsxs(j,{children:[e.jsxs(p,{className:"text-xs font-medium text-muted-foreground",children:[_.label,e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",_.months===1?"每月":`每${_.months}个月`,"结算)"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"0.00",min:0,...v,value:v.value??"",onChange:N=>v.onChange(N.target.value),className:"h-7 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500"})})]})]})})},w))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(gt).filter(([w])=>["onetime","reset_traffic"].includes(w)).map(([w,_])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(g,{control:x.control,name:`prices.${w}`,render:({field:v})=>e.jsx(j,{children:e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsx(p,{className:"text-xs font-medium",children:_.label}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:w==="onetime"?"一次性流量包,购买后立即生效":"用户可随时购买流量重置包,立即重置流量"})]}),e.jsxs("div",{className:"relative w-full md:w-32",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"0.00",min:0,...v,className:"h-7 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500"})})]})]})})})},w))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(g,{control:x.control,name:"device_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"设备限制"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(S,{type:"number",min:0,placeholder:"留空则不限制",className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:"台"})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"capacity_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"容量限制"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(S,{type:"number",min:0,placeholder:"留空则不限制",className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:"人"})]}),e.jsx(k,{})]})})]}),e.jsx(g,{control:x.control,name:"reset_traffic_method",render:({field:w})=>e.jsxs(j,{children:[e.jsx(p,{children:"流量重置方式"}),e.jsxs(G,{value:w.value?.toString()??"null",onValueChange:_=>w.onChange(_=="null"?null:Number(_)),children:[e.jsx(b,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"选择流量重置方式"})})}),e.jsx(B,{children:am.map(_=>e.jsx(O,{value:_.value?.toString()??"null",children:_.label},_.value))})]}),e.jsx(F,{className:"text-xs",children:"设置订阅流量的重置方式,不同的重置方式会影响用户的流量计算方式"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"content",render:({field:w})=>{const[_,v]=c.useState(!1);return e.jsxs(j,{className:"space-y-2",children:[e.jsxs(p,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:["套餐描述",e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(D,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>v(!_),children:_?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"}),e.jsx("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 010-1.186A10.004 10.004 0 0110 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0110 17c-4.257 0-7.893-2.66-9.336-6.41zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{fillRule:"evenodd",d:"M3.28 2.22a.75.75 0 00-1.06 1.06l14.5 14.5a.75.75 0 101.06-1.06l-1.745-1.745a10.029 10.029 0 003.3-4.38 1.651 1.651 0 000-1.185A10.004 10.004 0 009.999 3a9.956 9.956 0 00-4.744 1.194L3.28 2.22zM7.752 6.69l1.092 1.092a2.5 2.5 0 013.374 3.373l1.091 1.092a4 4 0 00-5.557-5.557z",clipRule:"evenodd"}),e.jsx("path",{d:"M10.748 13.93l2.523 2.523a9.987 9.987 0 01-3.27.547c-4.258 0-7.894-2.66-9.337-6.41a1.651 1.651 0 010-1.186A10.007 10.007 0 012.839 6.02L6.07 9.252a4 4 0 004.678 4.678z"})]})})}),e.jsx(ee,{side:"top",children:e.jsx("p",{className:"text-xs",children:_?"隐藏预览":"显示预览"})})]})})]}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(D,{variant:"outline",size:"sm",onClick:()=>{w.onChange(`## 套餐特点 +`))}})})}),e.jsx(k,{})]})}),e.jsx(g,{control:l.control,name:"action",render:({field:x})=>e.jsxs(j,{children:[e.jsx(p,{children:"动作"}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsxs(G,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择动作"})}),e.jsxs(B,{children:[e.jsx(O,{value:"block",children:"禁止访问"}),e.jsx(O,{value:"dns",children:"指定DNS服务器进行解析"})]})]})})}),e.jsx(k,{})]})}),l.watch("action")==="dns"&&e.jsx(g,{control:l.control,name:"action_value",render:({field:x})=>e.jsxs(j,{children:[e.jsx(p,{children:"DNS服务器"}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsx(S,{type:"text",placeholder:"请输入DNS服务器",...x})})})]})}),e.jsxs(Re,{children:[e.jsx(ot,{asChild:!0,children:e.jsx(T,{variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",onClick:()=>{$c(l.getValues()).then(({data:x})=>{x&&(d(!1),s&&s(),l.reset())})},children:"提交"})]})]})]})]})}function Gx({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;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(Or,{refetch:t}),e.jsx(S,{placeholder:"搜索路由...",value:s.getColumn("remarks")?.getFilterValue()??"",onChange:n=>s.getColumn("remarks")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["Reset",e.jsx(Fe,{className:"ml-2 h-4 w-4"})]})]})})}function Yx({columns:s,data:t,refetch:a}){const[n,l]=c.useState({}),[o,d]=c.useState({}),[x,r]=c.useState([]),[i,h]=c.useState([]),D=Me({data:t,columns:s,state:{sorting:i,columnVisibility:o,rowSelection:n,columnFilters:x},enableRowSelection:!0,onRowSelectionChange:l,onSortingChange:h,onColumnFiltersChange:r,onColumnVisibilityChange:d,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),getSortedRowModel:Ke(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ue,{table:D,toolbar:C=>e.jsx(Gx,{table:C,refetch:a})})}const Wx=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(V,{column:t,title:"组ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(L,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:t})=>e.jsx(V,{column:t,title:"备注"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsxs("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:["匹配 ",t.original.match?.length," 条规则"]})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action",header:({column:t})=>e.jsx(V,{column:t,title:"动作"}),cell:({row:t})=>{const a={dns:"指定DNS服务器进行解析",block:"禁止访问"};return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(L,{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:a[t.getValue("action")]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Or,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Ds,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]})}),e.jsx(Be,{title:"确认删除",description:"此操作将永久删除该权限组,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Ac({id:t.original.id}).then(({data:a})=>{a&&(A.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}];function Jx(){const[s,t]=c.useState([]);function a(){jr().then(({data:n})=>{t(n)})}return c.useEffect(()=>{a()},[]),e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"路由管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"管理所有路由组,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Yx,{data:s,columns:Wx(a),refetch:a})})]})]})}const Qx=Object.freeze(Object.defineProperty({__proto__:null,default:Jx},Symbol.toStringTag,{value:"Module"})),Lr=c.createContext(void 0);function Zx({children:s,refreshData:t}){const[a,n]=c.useState(!1),[l,o]=c.useState(null);return e.jsx(Lr.Provider,{value:{isOpen:a,setIsOpen:n,editingPlan:l,setEditingPlan:o,refreshData:t},children:s})}function ha(){const s=c.useContext(Lr);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function Xx({table:s,saveOrder:t,isSortMode:a}){const{setIsOpen:n}=ha();return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsxs(T,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>n(!0),children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"添加套餐"})]}),e.jsx(S,{placeholder:"搜索套餐...",value:s.getColumn("name")?.getFilterValue()??"",onChange:l=>s.getColumn("name")?.setFilterValue(l.target.value),className:"h-8 w-[150px] lg:w-[250px]"})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:a?"default":"outline",onClick:t,size:"sm",children:a?"保存排序":"编辑排序"})})]})}const Ka={monthly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},quarterly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},half_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},two_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},three_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},onetime:{color:"text-slate-700",bgColor:"bg-slate-100/80"},reset_traffic:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},em=s=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(Tt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(V,{column:t,title:"ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(L,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:t})=>e.jsx(V,{column:t,title:"显示"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("show"),onCheckedChange:a=>{zt({id:t.original.id,show:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:t})=>e.jsx(V,{column:t,title:"新购"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("sell"),onCheckedChange:a=>{zt({id:t.original.id,sell:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:t})=>e.jsx(V,{column:t,title:"续费",tooltip:"在订阅停止销售时,已购用户是否可以续费"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("renew"),onCheckedChange:a=>{zt({id:t.original.id,renew:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:t})=>e.jsx(V,{column:t,title:"名称"}),cell:({row:t})=>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:t.getValue("name")})}),enableSorting:!1,enableHiding:!1,size:900},{accessorKey:"users_count",header:({column:t})=>e.jsx(V,{column:t,title:"统计"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-2",children:[e.jsx(rt,{}),e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"group",header:({column:t})=>e.jsx(V,{column:t,title:"权限组"}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center gap-1.5 text-nowrap",children:e.jsx(L,{variant:"secondary",className:v("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"),children:t.getValue("group")?.name})}),enableSorting:!1,enableHiding:!1},{accessorKey:"prices",header:({column:t})=>e.jsx(V,{column:t,title:"价格"}),cell:({row:t})=>{const a=t.getValue("prices"),n=[{period:"月付",key:"monthly",unit:"元/月"},{period:"季付",key:"quarterly",unit:"元/季"},{period:"半年付",key:"half_yearly",unit:"元/半年"},{period:"年付",key:"yearly",unit:"元/年"},{period:"两年付",key:"two_yearly",unit:"元/两年"},{period:"三年付",key:"three_yearly",unit:"元/三年"},{period:"流量包",key:"onetime",unit:"元"},{period:"重置包",key:"reset_traffic",unit:"元/次"}];return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n.map(({period:l,key:o,unit:d})=>a[o]!=null&&e.jsxs(L,{variant:"secondary",className:v("px-2 py-0.5 font-medium transition-colors text-nowrap",Ka[o].color,Ka[o].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[l," ¥",a[o],d]},o))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:t})=>e.jsx(V,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{setIsOpen:a,setEditingPlan:n}=ha();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{n(t.original),a(!0)},children:[e.jsx(Ds,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),e.jsx(Be,{title:"确认删除",description:"此操作将永久删除该订阅,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{ld({id:t.original.id}).then(({data:l})=>{l&&(A.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}}],sm=u.object({id:u.number().nullable(),group_id:u.union([u.number(),u.string()]).nullable().optional(),name:u.string().min(1).max(250),content:u.string().nullable().optional(),transfer_enable:u.union([u.number().min(0),u.string().min(1)]),prices:u.object({monthly:u.union([u.number(),u.string()]).nullable().optional(),quarterly:u.union([u.number(),u.string()]).nullable().optional(),half_yearly:u.union([u.number(),u.string()]).nullable().optional(),yearly:u.union([u.number(),u.string()]).nullable().optional(),two_yearly:u.union([u.number(),u.string()]).nullable().optional(),three_yearly:u.union([u.number(),u.string()]).nullable().optional(),onetime:u.union([u.number(),u.string()]).nullable().optional(),reset_traffic:u.union([u.number(),u.string()]).nullable().optional()}).default({}),speed_limit:u.union([u.number(),u.string()]).nullable().optional(),capacity_limit:u.union([u.number(),u.string()]).nullable().optional(),device_limit:u.union([u.number(),u.string()]).nullable().optional(),force_update:u.boolean().optional(),reset_traffic_method:u.number().nullable(),users_count:u.number().optional()}),$r=c.forwardRef(({className:s,...t},a)=>e.jsx(An,{ref:a,className:v("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",s),...t,children:e.jsx(ho,{className:v("flex items-center justify-center text-current"),children:e.jsx(ks,{className:"h-4 w-4"})})}));$r.displayName=An.displayName;const jt={id:null,group_id:null,name:"",content:"",transfer_enable:"",prices:{monthly:"",quarterly:"",half_yearly:"",yearly:"",two_yearly:"",three_yearly:"",onetime:"",reset_traffic:""},speed_limit:"",capacity_limit:"",device_limit:"",force_update:!1,reset_traffic_method:null},gt={monthly:{label:"月付",months:1,discount:1},quarterly:{label:"季付",months:3,discount:.95},half_yearly:{label:"半年付",months:6,discount:.9},yearly:{label:"年付",months:12,discount:.85},two_yearly:{label:"两年付",months:24,discount:.8},three_yearly:{label:"三年付",months:36,discount:.75},onetime:{label:"流量包",months:1,discount:1},reset_traffic:{label:"重置包",months:1,discount:1}},tm=[{value:null,label:"跟随系统设置"},{value:0,label:"每月1号"},{value:1,label:"按月重置"},{value:2,label:"不重置"},{value:3,label:"每年1月1日"},{value:4,label:"按年重置"}];function am(){const{isOpen:s,setIsOpen:t,editingPlan:a,setEditingPlan:n,refreshData:l}=ha(),[o,d]=c.useState(!1),x=ae({resolver:ie(sm),defaultValues:{...jt,...a||{}},mode:"onChange"});c.useEffect(()=>{a?x.reset({...jt,...a}):x.reset(jt)},[a,x]);const r=new na({html:!0}),[i,h]=c.useState();async function D(){It().then(({data:w})=>{h(w)})}c.useEffect(()=>{s&&D()},[s]);const C=w=>{if(isNaN(w))return;const _=Object.entries(gt).reduce((b,[N,P])=>{const f=w*P.months*P.discount;return{...b,[N]:f.toFixed(2)}},{});x.setValue("prices",_,{shouldDirty:!0})},m=()=>{t(!1),n(null),x.reset(jt)};return e.jsx(ue,{open:s,onOpenChange:m,children:e.jsxs(ce,{children:[e.jsxs(he,{children:[e.jsx(xe,{children:a?"编辑套餐":"添加套餐"}),e.jsx(Se,{})]}),e.jsxs(oe,{...x,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:x.control,name:"name",render:({field:w})=>e.jsxs(j,{children:[e.jsx(p,{children:"套餐名称"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入套餐名称",...w})}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"group_id",render:({field:w})=>e.jsxs(j,{children:[e.jsxs(p,{className:"flex items-center justify-between",children:["权限组",e.jsx(Et,{dialogTrigger:e.jsx(T,{variant:"link",children:"添加权限组"}),refetch:D})]}),e.jsxs(G,{value:w.value||"",onValueChange:w.onChange,children:[e.jsx(y,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"选择权限组"})})}),e.jsx(B,{children:i?.map(_=>e.jsx(O,{value:_.id,children:_.name},_.id))})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"transfer_enable",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"流量"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(S,{type:"number",min:0,placeholder:"请输入流量大小",className:"rounded-r-none",...w})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:"GB"})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"speed_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"限速"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(S,{type:"number",min:0,placeholder:"请输入限速",className:"rounded-r-none",...w})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:"Mbps"})]}),e.jsx(k,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center",children:[e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"}),e.jsx("h3",{className:"mx-4 text-sm font-medium text-gray-500 dark:text-gray-400",children:"售价设置"}),e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(S,{type:"number",placeholder:"基础月付价格",className:"h-7 w-32 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500",onChange:w=>{const _=parseFloat(w.target.value);C(_)}})]}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const w=Object.keys(gt).reduce((_,b)=>({..._,[b]:""}),{});x.setValue("prices",w,{shouldDirty:!0})},children:"清空价格"})}),e.jsx(ee,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:"清空所有周期的价格设置"})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(gt).filter(([w])=>!["onetime","reset_traffic"].includes(w)).map(([w,_])=>e.jsx("div",{className:"group relative rounded-md bg-card p-2 ring-1 ring-gray-200 transition-all hover:ring-primary dark:ring-gray-800",children:e.jsx(g,{control:x.control,name:`prices.${w}`,render:({field:b})=>e.jsxs(j,{children:[e.jsxs(p,{className:"text-xs font-medium text-muted-foreground",children:[_.label,e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",_.months===1?"每月":`每${_.months}个月`,"结算)"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"0.00",min:0,...b,value:b.value??"",onChange:N=>b.onChange(N.target.value),className:"h-7 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500"})})]})]})})},w))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(gt).filter(([w])=>["onetime","reset_traffic"].includes(w)).map(([w,_])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(g,{control:x.control,name:`prices.${w}`,render:({field:b})=>e.jsx(j,{children:e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsx(p,{className:"text-xs font-medium",children:_.label}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:w==="onetime"?"一次性流量包,购买后立即生效":"用户可随时购买流量重置包,立即重置流量"})]}),e.jsxs("div",{className:"relative w-full md:w-32",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"0.00",min:0,...b,className:"h-7 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500"})})]})]})})})},w))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(g,{control:x.control,name:"device_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"设备限制"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(S,{type:"number",min:0,placeholder:"留空则不限制",className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:"台"})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"capacity_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(p,{children:"容量限制"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(S,{type:"number",min:0,placeholder:"留空则不限制",className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:"人"})]}),e.jsx(k,{})]})})]}),e.jsx(g,{control:x.control,name:"reset_traffic_method",render:({field:w})=>e.jsxs(j,{children:[e.jsx(p,{children:"流量重置方式"}),e.jsxs(G,{value:w.value?.toString()??"null",onValueChange:_=>w.onChange(_=="null"?null:Number(_)),children:[e.jsx(y,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"选择流量重置方式"})})}),e.jsx(B,{children:tm.map(_=>e.jsx(O,{value:_.value?.toString()??"null",children:_.label},_.value))})]}),e.jsx(F,{className:"text-xs",children:"设置订阅流量的重置方式,不同的重置方式会影响用户的流量计算方式"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"content",render:({field:w})=>{const[_,b]=c.useState(!1);return e.jsxs(j,{className:"space-y-2",children:[e.jsxs(p,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:["套餐描述",e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>b(!_),children:_?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"}),e.jsx("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 010-1.186A10.004 10.004 0 0110 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0110 17c-4.257 0-7.893-2.66-9.336-6.41zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{fillRule:"evenodd",d:"M3.28 2.22a.75.75 0 00-1.06 1.06l14.5 14.5a.75.75 0 101.06-1.06l-1.745-1.745a10.029 10.029 0 003.3-4.38 1.651 1.651 0 000-1.185A10.004 10.004 0 009.999 3a9.956 9.956 0 00-4.744 1.194L3.28 2.22zM7.752 6.69l1.092 1.092a2.5 2.5 0 013.374 3.373l1.091 1.092a4 4 0 00-5.557-5.557z",clipRule:"evenodd"}),e.jsx("path",{d:"M10.748 13.93l2.523 2.523a9.987 9.987 0 01-3.27.547c-4.258 0-7.894-2.66-9.337-6.41a1.651 1.651 0 010-1.186A10.007 10.007 0 012.839 6.02L6.07 9.252a4 4 0 004.678 4.678z"})]})})}),e.jsx(ee,{side:"top",children:e.jsx("p",{className:"text-xs",children:_?"隐藏预览":"显示预览"})})]})})]}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"outline",size:"sm",onClick:()=>{w.onChange(`## 套餐特点 • 高速稳定的全球网络接入 • 支持多设备同时在线 • 无限制的流量重置 @@ -14,8 +14,8 @@ import{r as c,j as e,t as hl,c as jl,I as ba,a as _s,S as Wt,u as ns,b as Jt,d a ## 注意事项 - 禁止滥用 - 遵守当地法律法规 -- 支持随时更换套餐`)},children:"使用模板"})}),e.jsx(ee,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:"点击使用预设的套餐描述模板"})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${_?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"}`,children:[e.jsx("div",{className:"space-y-2",children:e.jsx(b,{children:e.jsx(aa,{style:{height:"400px"},value:w.value||"",renderHTML:N=>r.render(N),onChange:({text:N})=>w.onChange(N),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:"在这里编写套餐描述...",className:"rounded-md border"})})}),_&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"预览"}),e.jsx("div",{className:"prose prose-sm dark:prose-invert h-[400px] max-w-none overflow-y-auto rounded-md border p-4",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:r.render(w.value||"")}})})]})]}),e.jsx(F,{className:"text-xs",children:"支持 Markdown 格式,可以使用标题、列表、粗体、斜体等样式来美化描述内容"}),e.jsx(k,{})]})}})]}),e.jsx(Ee,{className:"mt-6",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("div",{className:"flex-shrink-0",children:a&&e.jsx(g,{control:x.control,name:"force_update",render:({field:w})=>e.jsxs(j,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(b,{children:e.jsx(Hr,{checked:w.value,onCheckedChange:w.onChange})}),e.jsx("div",{className:"",children:e.jsx(p,{className:"text-sm",children:"强制更新到用户"})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(D,{type:"button",variant:"outline",onClick:m,children:"取消"}),e.jsx(D,{type:"submit",disabled:o,onClick:()=>{x.handleSubmit(async w=>{d(!0),(await id(w)).data&&(A.success(a?"套餐更新成功":"套餐添加成功"),m(),l()),d(!1)})()},children:o?"提交中...":"提交"})]})]})})]})]})})}function rm(){const[s,t]=c.useState({}),[a,n]=c.useState({"drag-handle":!1}),[l,o]=c.useState([]),[d,x]=c.useState([]),[r,i]=c.useState(!1),[h,T]=c.useState({pageSize:20,pageIndex:0}),[C,m]=c.useState([]),{refetch:w}=Q({queryKey:["planList"],queryFn:async()=>{const{data:f}=await Ps();return m(f),f}});c.useEffect(()=>{n({"drag-handle":r}),T({pageSize:r?99999:10,pageIndex:0})},[r]);const _=(f,R)=>{r&&(f.dataTransfer.setData("text/plain",R.toString()),f.currentTarget.classList.add("opacity-50"))},v=(f,R)=>{if(!r)return;f.preventDefault(),f.currentTarget.classList.remove("bg-muted");const z=parseInt(f.dataTransfer.getData("text/plain"));if(z===R)return;const $=[...C],[E]=$.splice(z,1);$.splice(R,0,E),m($)},N=async()=>{if(!r){i(!0);return}const f=C?.map(R=>R.id);cd(f).then(()=>{A.success("排序保存成功"),i(!1),w()}).finally(()=>{i(!1)})},P=Le({data:C||[],columns:sm(w),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:h},enableRowSelection:!0,onPaginationChange:T,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}},pageCount:r?1:void 0});return e.jsx(Xx,{refreshData:w,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ge,{table:P,toolbar:f=>e.jsx(em,{table:f,refetch:w,saveOrder:N,isSortMode:r}),draggable:r,onDragStart:_,onDragEnd:f=>f.currentTarget.classList.remove("opacity-50"),onDragOver:f=>{f.preventDefault(),f.currentTarget.classList.add("bg-muted")},onDragLeave:f=>f.currentTarget.classList.remove("bg-muted"),onDrop:v,showPagination:!r}),e.jsx(nm,{})]})})}function lm(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"订阅管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以配置订阅计划,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(rm,{})})]})]})}const im=Object.freeze(Object.defineProperty({__proto__:null,default:lm},Symbol.toStringTag,{value:"Module"})),Kr=[{value:me.PENDING,label:Es[me.PENDING],icon:fo,color:Bs[me.PENDING]},{value:me.PROCESSING,label:Es[me.PROCESSING],icon:Hn,color:Bs[me.PROCESSING]},{value:me.COMPLETED,label:Es[me.COMPLETED],icon:qt,color:Bs[me.COMPLETED]},{value:me.CANCELLED,label:Es[me.CANCELLED],icon:Kn,color:Bs[me.CANCELLED]},{value:me.DISCOUNTED,label:Es[me.DISCOUNTED],icon:qt,color:Bs[me.DISCOUNTED]}],qr=[{value:fe.PENDING,label:ct[fe.PENDING],icon:po,color:dt[fe.PENDING]},{value:fe.PROCESSING,label:ct[fe.PROCESSING],icon:Hn,color:dt[fe.PROCESSING]},{value:fe.VALID,label:ct[fe.VALID],icon:qt,color:dt[fe.VALID]},{value:fe.INVALID,label:ct[fe.INVALID],icon:Kn,color:dt[fe.INVALID]}];function ft({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=s?.getFilterValue(),o=Array.isArray(l)?new Set(l):l!==void 0?new Set([l]):new Set;return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,o?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:o.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:o.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[o.size," selected"]}):a.filter(d=>o.has(d.value)).map(d=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:d.label},d.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(fs,{children:[e.jsx(Ds,{placeholder:t}),e.jsxs(ps,{children:[e.jsx(Ts,{children:"No results found."}),e.jsx(Ve,{children:a.map(d=>{const x=o.has(d.value);return e.jsxs(be,{onSelect:()=>{const r=new Set(o);x?r.delete(d.value):r.add(d.value);const i=Array.from(r);s?.setFilterValue(i.length?i:void 0)},children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Cs,{className:y("h-4 w-4")})}),d.icon&&e.jsx(d.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${d.color}`}),e.jsx("span",{children:d.label}),n?.get(d.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(d.value)})]},d.value)})}),o.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(As,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const om=u.object({email:u.string().min(1),plan_id:u.number(),period:u.string(),total_amount:u.number()}),cm={email:"",plan_id:0,total_amount:0,period:""};function Ur({refetch:s,trigger:t,defaultValues:a}){const[n,l]=c.useState(!1),o=ae({resolver:ie(om),defaultValues:{...cm,...a},mode:"onChange"}),[d,x]=c.useState([]);return c.useEffect(()=>{n&&Ps().then(({data:r})=>{x(r)})},[n]),e.jsxs(ue,{open:n,onOpenChange:l,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(D,{variant:"outline",size:"sm",className:" h-8 space-x-2",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"添加订单"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:"订单分配"}),e.jsx(Se,{})]}),e.jsxs(oe,{...o,children:[e.jsx(g,{control:o.control,name:"email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"用户邮箱"}),e.jsx(b,{children:e.jsx(S,{placeholder:"请输入用户邮箱",...r})})]})}),e.jsx(g,{control:o.control,name:"plan_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"订阅计划"}),e.jsx(b,{children:e.jsxs(G,{value:r.value?r.value?.toString():void 0,onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择订阅计划"})}),e.jsx(B,{children:d.map(i=>e.jsx(O,{value:i.id.toString(),children:i.name},i.id))})]})})]})}),e.jsx(g,{control:o.control,name:"period",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"订阅时长"}),e.jsx(b,{children:e.jsxs(G,{value:r.value,onValueChange:r.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择购买时长"})}),e.jsx(B,{children:Object.keys(st).map(i=>e.jsx(O,{value:i,children:st[i]},i))})]})})]})}),e.jsx(g,{control:o.control,name:"total_amount",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"支付金额"}),e.jsx(b,{children:e.jsx(S,{type:"number",placeholder:"请输入需要支付的金额",value:r.value/100,onChange:i=>r.onChange(parseFloat(i.currentTarget.value)*100)})}),e.jsx(k,{})]})}),e.jsxs(Ee,{children:[e.jsx(D,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(D,{type:"submit",onClick:()=>{o.handleSubmit(r=>{md(r).then(({data:i})=>{i&&(s&&s(),o.reset(),l(!1),A.success("添加成功"))})})()},children:"确定"})]})]})]})]})}const dm=Object.values(as).filter(s=>typeof s=="number").map(s=>({label:Nr[s],value:s,color:s===as.NEW?"green-500":s===as.RENEWAL?"blue-500":s===as.UPGRADE?"purple-500":"orange-500"})),um=Object.values(ne).map(s=>({label:st[s],value:s,color:s===ne.MONTH_PRICE?"slate-500":s===ne.QUARTER_PRICE?"cyan-500":s===ne.HALF_YEAR_PRICE?"indigo-500":s===ne.YEAR_PRICE?"violet-500":s===ne.TWO_YEAR_PRICE?"fuchsia-500":s===ne.THREE_YEAR_PRICE?"pink-500":s===ne.ONETIME_PRICE?"rose-500":"orange-500"}));function xm({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ur,{refetch:t}),e.jsx(S,{placeholder:"搜索订单...",value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:n=>s.getColumn("trade_no")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2",children:[s.getColumn("type")&&e.jsx(ft,{column:s.getColumn("type"),title:"订单类型",options:dm}),s.getColumn("period")&&e.jsx(ft,{column:s.getColumn("period"),title:"订单周期",options:um}),s.getColumn("status")&&e.jsx(ft,{column:s.getColumn("status"),title:"订单状态",options:Kr}),s.getColumn("commission_status")&&e.jsx(ft,{column:s.getColumn("commission_status"),title:"佣金状态",options:qr})]}),a&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})}function Ae({label:s,value:t,className:a,valueClassName:n}){return e.jsxs("div",{className:y("flex items-center py-1.5",a),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:y("text-sm",n),children:t||"-"})]})}function mm({status:s}){const t={PENDING:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",PAID:"bg-green-100 text-green-800 hover:bg-green-100",FAILED:"bg-red-100 text-red-800 hover:bg-red-100",REFUNDED:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(L,{variant:"secondary",className:y("font-medium",t[s]),children:Es[s]})}function hm({id:s,trigger:t}){const[a,n]=c.useState(!1),[l,o]=c.useState();return c.useEffect(()=>{(async()=>{if(a){const{data:x}=await dd({id:s});o(x)}})()},[a,s]),e.jsxs(ue,{onOpenChange:n,open:a,children:[e.jsx(Re,{asChild:!0,children:t}),e.jsxs(ce,{className:"max-w-xl",children:[e.jsxs(je,{className:"space-y-2",children:[e.jsx(xe,{className:"text-lg font-medium",children:"订单信息"}),e.jsx("div",{className:"flex items-center justify-between text-sm",children:e.jsxs("div",{className:"flex items-center space-x-6",children:[e.jsxs("div",{className:"text-muted-foreground",children:["订单号:",l?.trade_no]}),l?.status&&e.jsx(mm,{status:l.status})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"基本信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ae,{label:"用户邮箱",value:l?.user?.email?e.jsxs(Ss,{to:`/user/manage?email=${l.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[l.user.email,e.jsx(qn,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(Ae,{label:"订单周期",value:l&&st[l.period]}),e.jsx(Ae,{label:"订阅计划",value:l?.plan?.name,valueClassName:"font-medium"}),e.jsx(Ae,{label:"回调单号",value:l?.callback_no,valueClassName:"font-mono text-xs"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"金额信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ae,{label:"支付金额",value:hs(l?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(ge,{className:"my-2"}),e.jsx(Ae,{label:"余额支付",value:hs(l?.balance_amount||0)}),e.jsx(Ae,{label:"优惠金额",value:hs(l?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(Ae,{label:"退回金额",value:hs(l?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(Ae,{label:"折抵金额",value:hs(l?.surplus_amount||0)})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"时间信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ae,{label:"创建时间",value:re(l?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(Ae,{label:"更新时间",value:re(l?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const jm={[as.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[as.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[as.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[as.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},gm={[ne.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},fm=s=>[{accessorKey:"trade_no",header:({column:t})=>e.jsx(I,{column:t,title:"订单号"}),cell:({row:t})=>{const a=t.original.trade_no,n=a.length>6?`${a.slice(0,3)}...${a.slice(-3)}`:a;return e.jsx("div",{className:"flex items-center",children:e.jsx(hm,{trigger:e.jsxs(W,{variant:"ghost",size:"sm",className:"flex h-8 items-center gap-1.5 px-2 font-medium text-primary transition-colors hover:bg-primary/10 hover:text-primary/80",children:[e.jsx("span",{className:"font-mono",children:n}),e.jsx(qn,{className:"h-3.5 w-3.5 opacity-70"})]}),id:t.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:t})=>e.jsx(I,{column:t,title:"类型"}),cell:({row:t})=>{const a=t.getValue("type"),n=jm[a]||{color:"text-slate-700",bgColor:"bg-slate-100/80"};return e.jsx(L,{variant:"secondary",className:y("font-medium transition-colors text-nowrap",n.color,n.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:Nr[a]})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:t})=>e.jsx(I,{column:t,title:"订阅计划"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium text-foreground/90 sm:max-w-72 md:max-w-[31rem]",children:t.original.plan?.name||"-"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"period",header:({column:t})=>e.jsx(I,{column:t,title:"周期"}),cell:({row:t})=>{const a=t.getValue("period"),n=gm[a]||{color:"text-gray-700",bgColor:"bg-gray-50"};return e.jsx(L,{variant:"secondary",className:y("font-medium transition-colors text-nowrap",n.color,n.bgColor,"hover:bg-opacity-80"),children:st[a]})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:t})=>e.jsx(I,{column:t,title:"支付金额"}),cell:({row:t})=>{const a=t.getValue("total_amount"),n=typeof a=="number"?(a/100).toFixed(2):"N/A";return e.jsxs("div",{className:"flex items-center font-mono text-foreground/90",children:["¥",n]})},enableSorting:!0,enableHiding:!1},{accessorKey:"status",header:({column:t})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(I,{column:t,title:"订单状态"}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx(Er,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(ee,{side:"top",className:"max-w-[200px] text-sm",children:"标记为[已支付]后将会由系统进行开通后并完成"})]})})]}),cell:({row:t})=>{const a=Kr.find(n=>n.value===t.getValue("status"));return a?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[a.icon&&e.jsx(a.icon,{className:`h-4 w-4 text-${a.color}`}),e.jsx("span",{className:"text-sm font-medium",children:a.label})]}),a.value===me.PENDING&&e.jsxs(Ns,{modal:!0,children:[e.jsx(ws,{asChild:!0,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(bt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"打开菜单"})]})}),e.jsxs(gs,{align:"end",className:"w-[140px]",children:[e.jsx(he,{className:"cursor-pointer",onClick:async()=>{await ud({trade_no:t.original.trade_no}),s()},children:"标记为已支付"}),e.jsx(he,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await xd({trade_no:t.original.trade_no}),s()},children:"取消订单"})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:t})=>e.jsx(I,{column:t,title:"佣金金额"}),cell:({row:t})=>{const a=t.getValue("commission_balance"),n=a?(a/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:a?`¥${n}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:t})=>e.jsx(I,{column:t,title:"佣金状态"}),cell:({row:t})=>{const a=t.original.commission_balance,n=qr.find(l=>l.value===t.getValue("commission_status"));return a==0||!n?e.jsx("span",{className:"text-muted-foreground",children:"-"}):e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n.icon&&e.jsx(n.icon,{className:`h-4 w-4 text-${n.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n.label})]}),n.value===fe.PENDING&&e.jsxs(Ns,{modal:!0,children:[e.jsx(ws,{asChild:!0,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(bt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"打开菜单"})]})}),e.jsxs(gs,{align:"end",className:"w-[120px]",children:[e.jsx(he,{className:"cursor-pointer",onClick:async()=>{await Ma({trade_no:t.original.trade_no,commission_status:fe.PROCESSING}),s()},children:"标记为有效"}),e.jsx(he,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ma({trade_no:t.original.trade_no,commission_status:fe.INVALID}),s()},children:"标记为无效"})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:t})=>e.jsx(I,{column:t,title:"创建时间"}),cell:({row:t})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:re(t.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}];function pm(){const[s]=Un(),[t,a]=c.useState({}),[n,l]=c.useState({}),[o,d]=c.useState([]),[x,r]=c.useState([]),[i,h]=c.useState({pageIndex:0,pageSize:20});c.useEffect(()=>{const _=[],v=s.get("order_id");v&&_.push({id:"order_id",value:v});const N=s.get("commission_status");N&&_.push({id:"commission_status",value:parseInt(N)});const P=s.get("status");P&&_.push({id:"status",value:parseInt(P)});const f=s.get("commission_balance");f&&_.push({id:"commission_balance",value:f}),_.length>0&&d(_)},[s]);const{refetch:T,data:C,isLoading:m}=Q({queryKey:["orderList",i,o,x],queryFn:()=>gr({pageSize:i.pageSize,current:i.pageIndex+1,filter:o,sort:x})}),w=Le({data:C?.data??[],columns:fm(T),state:{sorting:x,columnVisibility:n,rowSelection:t,columnFilters:o,pagination:i},rowCount:C?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:r,onColumnFiltersChange:d,onColumnVisibilityChange:l,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),onPaginationChange:h,getSortedRowModel:Ue(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:w,toolbar:e.jsx(xm,{table:w,refetch:T}),showPagination:!0})}function vm(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:" 订单管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"在这里可以查看用户订单,包括分配、查看、删除等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(pm,{})})]})]})}const bm=Object.freeze(Object.defineProperty({__proto__:null,default:vm},Symbol.toStringTag,{value:"Module"}));function ym({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(o=>l.has(o.value)).map(o=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(fs,{children:[e.jsx(Ds,{placeholder:t}),e.jsxs(ps,{children:[e.jsx(Ts,{children:"No results found."}),e.jsx(Ve,{children:a.map(o=>{const d=l.has(o.value);return e.jsxs(be,{onSelect:()=>{d?l.delete(o.value):l.add(o.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Cs,{className:y("h-4 w-4")})}),o.icon&&e.jsx(o.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${o.color}`}),e.jsx("span",{children:o.label}),n?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(o.value)})]},o.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(As,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Nm=u.object({id:u.coerce.number().nullable().optional(),name:u.string().min(1,"请输入优惠券名称"),code:u.string().nullable(),type:u.union([u.string(),u.nativeEnum(Rt)]),value:u.coerce.number(),started_at:u.coerce.number(),ended_at:u.coerce.number(),limit_use:u.union([u.string(),u.number()]).nullable(),limit_use_with_user:u.union([u.string(),u.number()]).nullable(),generate_count:u.coerce.number().nullable().optional(),limit_plan_ids:u.array(u.number()).default([]).nullable(),limit_period:u.array(u.nativeEnum(ne)).default([]).nullable()}).refine(s=>s.ended_at>s.started_at,{message:"结束时间必须晚于开始时间",path:["ended_at"]}),Ka={name:"",code:"",type:Rt.AMOUNT,value:0,started_at:Math.floor(Date.now()/1e3),ended_at:Math.floor(Date.now()/1e3)+7*24*60*60,limit_use:"",limit_use_with_user:"",limit_plan_ids:[],limit_period:[],generate_count:""};function Br({defaultValues:s,refetch:t,type:a="create",dialogTrigger:n=e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"添加优惠券"})]}),open:l,onOpenChange:o}){const[d,x]=c.useState(!1),r=l??d,i=o??x,[h,T]=c.useState([]),C=ae({resolver:ie(Nm),defaultValues:s||Ka});c.useEffect(()=>{s&&C.reset(s)},[s,C]),c.useEffect(()=>{Ps().then(({data:v})=>T(v))},[]);const m=v=>{if(!v)return;const N=(P,f)=>{const R=new Date(f*1e3);return P.setHours(R.getHours(),R.getMinutes(),R.getSeconds()),Math.floor(P.getTime()/1e3)};v.from&&C.setValue("started_at",N(v.from,C.watch("started_at"))),v.to&&C.setValue("ended_at",N(v.to,C.watch("ended_at")))},w=async v=>{try{await jd(v),i(!1),a==="create"&&C.reset(Ka),t()}catch(N){console.error("保存优惠券失败:",N)}},_=(v,N)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:N}),e.jsx(S,{type:"datetime-local",step:"1",value:re(C.watch(v),"YYYY-MM-DDTHH:mm:ss"),onChange:P=>{const f=new Date(P.target.value);C.setValue(v,Math.floor(f.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(ue,{open:r,onOpenChange:i,children:[n&&e.jsx(Re,{asChild:!0,children:n}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(je,{children:e.jsx(xe,{children:a==="create"?"添加优惠券":"编辑优惠券"})}),e.jsx(oe,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(w),className:"space-y-4",children:[e.jsx(g,{control:C.control,name:"name",render:({field:v})=>e.jsxs(j,{children:[e.jsx(p,{children:"优惠券名称"}),e.jsx(S,{placeholder:"请输入优惠券名称",...v}),e.jsx(k,{})]})}),e.jsxs(j,{children:[e.jsx(p,{children:"优惠券类型和值"}),e.jsxs("div",{className:"flex",children:[e.jsx(g,{control:C.control,name:"type",render:({field:v})=>e.jsxs(G,{value:v.value.toString(),onValueChange:v.onChange,children:[e.jsx(U,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(Y,{placeholder:"优惠券类型"})}),e.jsx(B,{children:Object.entries(la).map(([N,P])=>e.jsx(O,{value:N,children:P},N))})]})}),e.jsx(g,{control:C.control,name:"value",render:({field:v})=>e.jsx(S,{type:"number",placeholder:"请输入值",...v,onChange:N=>v.onChange(N.target.value===""?"":N.target.value),className:"flex-[2] rounded-none border-x-0 text-left"})}),e.jsx("div",{className:"flex min-w-[40px] items-center justify-center rounded-md rounded-l-none border border-l-0 border-input bg-muted/50 px-3 font-medium text-muted-foreground",children:e.jsx("span",{children:C.watch("type")===Rt.AMOUNT?"¥":"%"})})]})]}),e.jsxs(j,{children:[e.jsx(p,{children:"优惠券有效期"}),e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(D,{variant:"outline",className:y("w-full justify-start text-left font-normal",!C.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(rt,{className:"mr-2 h-4 w-4"}),re(C.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ","至"," ",re(C.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(Be,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(Is,{mode:"range",selected:{from:new Date(C.watch("started_at")*1e3),to:new Date(C.watch("ended_at")*1e3)},onSelect:m,numberOfMonths:2})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[_("started_at","开始时间"),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:"至"}),_("ended_at","结束时间")]})})]})]}),e.jsx(k,{})]}),e.jsx(g,{control:C.control,name:"limit_use",render:({field:v})=>e.jsxs(j,{children:[e.jsx(p,{children:"最大使用次数"}),e.jsx(S,{type:"number",min:0,placeholder:"限制最大使用次数,留空则不限制",...v,value:v.value===void 0?"":v.value,onChange:N=>v.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(F,{className:"text-xs",children:"设置优惠券的总使用次数限制,留空表示不限制使用次数"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_use_with_user",render:({field:v})=>e.jsxs(j,{children:[e.jsx(p,{children:"每个用户可使用次数"}),e.jsx(S,{type:"number",min:0,placeholder:"限制每个用户可使用次数,留空则不限制",...v,value:v.value===void 0?"":v.value,onChange:N=>v.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(F,{className:"text-xs",children:"限制每个用户可使用该优惠券的次数,留空表示不限制单用户使用次数"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_period",render:({field:v})=>e.jsxs(j,{children:[e.jsx(p,{children:"指定周期"}),e.jsx(at,{options:Object.entries(ne).filter(([N])=>isNaN(Number(N))).map(([N,P])=>({label:P,value:N})),onChange:N=>{if(N.length===0){v.onChange([]);return}const P=N.map(f=>ne[f.value]);v.onChange(P)},value:(v.value||[]).map(N=>({label:Object.entries(ne).find(([P,f])=>f===N)?.[1]||"",value:Object.entries(ne).find(([P,f])=>f===N)?.[0]||""})),placeholder:"限制指定周期可以使用优惠,留空则不限制",emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"没有找到匹配的周期"})}),e.jsx(F,{className:"text-xs",children:"选择可以使用优惠券的订阅周期,留空表示不限制使用周期"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_plan_ids",render:({field:v})=>e.jsxs(j,{children:[e.jsx(p,{children:"指定订阅"}),e.jsx(at,{options:h?.map(N=>({label:N.name,value:N.id.toString()}))||[],onChange:N=>v.onChange(N.map(P=>Number(P.value))),value:(h||[]).filter(N=>(v.value||[]).includes(N.id)).map(N=>({label:N.name,value:N.id.toString()})),placeholder:"限制指定订阅可以使用优惠,留空则不限制",emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"没有找到匹配的订阅"})}),e.jsx(k,{})]})}),a==="create"&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:C.control,name:"code",render:({field:v})=>e.jsxs(j,{children:[e.jsx(p,{children:"自定义优惠码"}),e.jsx(S,{placeholder:"自定义优惠码,留空则自动生成",...v,className:"h-9"}),e.jsx(F,{className:"text-xs",children:"可以自定义优惠码,留空则系统自动生成"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"generate_count",render:({field:v})=>e.jsxs(j,{children:[e.jsx(p,{children:"批量生成数量"}),e.jsx(S,{type:"number",min:0,placeholder:"批量生成优惠码数量,留空则生成单个",...v,value:v.value===void 0?"":v.value,onChange:N=>v.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(F,{className:"text-xs",children:"批量生成多个优惠码,留空则只生成单个优惠码"}),e.jsx(k,{})]})})]}),e.jsx(Ee,{children:e.jsx(D,{type:"submit",disabled:C.formState.isSubmitting,children:C.formState.isSubmitting?"保存中...":"保存"})})]})})]})]})}function wm({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Br,{refetch:t}),e.jsx(S,{placeholder:"搜索优惠券...",value:s.getColumn("name")?.getFilterValue()??"",onChange:n=>s.getColumn("name")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(ym,{column:s.getColumn("type"),title:"类型",options:Object.entries(la).map(([n,l])=>({value:n,label:l}))}),a&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})}const Gr=c.createContext(void 0);function _m({children:s,refetch:t}){const[a,n]=c.useState(!1),[l,o]=c.useState(null),d=r=>{o(r),n(!0)},x=()=>{n(!1),o(null)};return e.jsxs(Gr.Provider,{value:{isOpen:a,currentCoupon:l,openEdit:d,closeEdit:x},children:[s,l&&e.jsx(Br,{defaultValues:l,refetch:t,type:"edit",open:a,onOpenChange:n})]})}function Cm(){const s=c.useContext(Gr);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const Sm=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"ID"}),cell:({row:t})=>e.jsx(L,{children:t.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"启用"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.original.show,onCheckedChange:a=>{fd({id:t.original.id,show:a}).then(({data:n})=>!n&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(I,{column:t,title:"卷名称"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:t.original.name})}),enableSorting:!1,size:800},{accessorKey:"type",header:({column:t})=>e.jsx(I,{column:t,title:"类型"}),cell:({row:t})=>e.jsx(L,{variant:"outline",children:la[t.original.type]}),enableSorting:!0},{accessorKey:"code",header:({column:t})=>e.jsx(I,{column:t,title:"卷码"}),cell:({row:t})=>e.jsx(L,{variant:"secondary",children:t.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:t})=>e.jsx(I,{column:t,title:"剩余次数"}),cell:({row:t})=>e.jsx(L,{variant:"outline",children:t.original.limit_use===null?"无限次":t.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:t})=>e.jsx(I,{column:t,title:"可用次数/用户"}),cell:({row:t})=>e.jsx(L,{variant:"outline",children:t.original.limit_use_with_user===null?"无限制":t.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:t})=>e.jsx(I,{column:t,title:"有效期"}),cell:({row:t})=>{const[a,n]=c.useState(!1),l=Date.now(),o=t.original.started_at*1e3,d=t.original.ended_at*1e3,x=l>d,r=le.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{openEdit:a}=Cm();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>a(t.original),children:[e.jsx(ks,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该优惠券,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{gd({id:t.original.id}).then(({data:n})=>{n&&(A.success("删除成功"),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}}];function km(){const[s,t]=c.useState({}),[a,n]=c.useState({}),[l,o]=c.useState([]),[d,x]=c.useState([]),[r,i]=c.useState({pageIndex:0,pageSize:20}),{refetch:h,data:T}=Q({queryKey:["couponList",r,l,d],queryFn:()=>hd({pageSize:r.pageSize,current:r.pageIndex+1,filter:l,sort:d})}),C=Le({data:T?.data??[],columns:Sm(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:r},pageCount:Math.ceil((T?.total??0)/r.pageSize),rowCount:T?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,onPaginationChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(_m,{refetch:h,children:e.jsx("div",{className:"space-y-4",children:e.jsx(Ge,{table:C,toolbar:e.jsx(wm,{table:C,refetch:h})})})})}function Dm(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"优惠券管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"在这里可以查看优惠券,包括增加、查看、删除等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(km,{})})]})]})}const Tm=Object.freeze(Object.defineProperty({__proto__:null,default:Dm},Symbol.toStringTag,{value:"Module"})),Pm=u.object({email_prefix:u.string().optional(),email_suffix:u.string().min(1),password:u.string().optional(),expired_at:u.number().optional().nullable(),plan_id:u.number().nullable(),generate_count:u.number().optional().nullable()}).refine(s=>s.generate_count===null?s.email_prefix!==void 0&&s.email_prefix!=="":!0,{message:"Email prefix is required when generate_count is null",path:["email_prefix"]}),Im={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0};function Vm({refetch:s}){const[t,a]=c.useState(!1),n=ae({resolver:ie(Pm),defaultValues:Im,mode:"onChange"}),[l,o]=c.useState([]);return c.useEffect(()=>{t&&Ps().then(({data:d})=>{d&&o(d)})},[t]),e.jsxs(ue,{open:t,onOpenChange:a,children:[e.jsx(Re,{asChild:!0,children:e.jsxs(W,{size:"sm",variant:"outline",className:"space-x-2 gap-0",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"创建用户"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:"创建用户"}),e.jsx(Se,{})]}),e.jsxs(oe,{...n,children:[e.jsxs(j,{children:[e.jsx(p,{children:"邮箱"}),e.jsxs("div",{className:"flex",children:[!n.watch("generate_count")&&e.jsx(g,{control:n.control,name:"email_prefix",render:({field:d})=>e.jsx(S,{className:"flex-[5] rounded-r-none",placeholder:"帐号(批量生成请留空)",...d})}),e.jsx("div",{className:`z-[-1] border border-r-0 border-input px-3 py-1 shadow-sm ${n.watch("generate_count")?"rounded-l-md":"border-l-0"}`,children:"@"}),e.jsx(g,{control:n.control,name:"email_suffix",render:({field:d})=>e.jsx(S,{className:"flex-[4] rounded-l-none",placeholder:"域",...d})})]})]}),e.jsx(g,{control:n.control,name:"password",render:({field:d})=>e.jsxs(j,{children:[e.jsx(p,{children:"密码"}),e.jsx(S,{placeholder:"留空则密码与邮件相同",...d}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"expired_at",render:({field:d})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(p,{children:"到期时间"}),e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsx(b,{children:e.jsxs(W,{variant:"outline",className:y("w-full pl-3 text-left font-normal",!d.value&&"text-muted-foreground"),children:[d.value?re(d.value):e.jsx("span",{children:"请选择用户到期日期,留空为长期有效"}),e.jsx(rt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(Be,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(bo,{asChild:!0,children:e.jsx(W,{variant:"outline",className:"w-full",onClick:()=>{d.onChange(null)},children:"长期有效"})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Is,{mode:"single",selected:d.value?new Date(d.value*1e3):void 0,onSelect:x=>{x&&d.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(g,{control:n.control,name:"plan_id",render:({field:d})=>e.jsxs(j,{children:[e.jsx(p,{children:"订阅计划"}),e.jsx(b,{children:e.jsxs(G,{value:d.value?d.value.toString():"null",onValueChange:x=>d.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"无"})}),e.jsxs(B,{children:[e.jsx(O,{value:"null",children:"无"}),l.map(x=>e.jsx(O,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!n.watch("email_prefix")&&e.jsx(g,{control:n.control,name:"generate_count",render:({field:d})=>e.jsxs(j,{children:[e.jsx(p,{children:"生成数量"}),e.jsx(S,{type:"number",placeholder:"如果为批量生产请输入生成数量",value:d.value||"",onChange:x=>d.onChange(x.target.value?parseInt(x.target.value):null)})]})})]}),e.jsxs(Ee,{children:[e.jsx(W,{variant:"outline",onClick:()=>a(!1),children:"取消"}),e.jsx(W,{onClick:()=>n.handleSubmit(d=>{yd(d).then(({data:x})=>{x&&(A.success("生成成功"),n.reset(),s(),a(!1))})})(),children:"生成"})]})]})]})}const Yr=Ba,Wr=Ga,Rm=Ya,Jr=c.forwardRef(({className:s,...t},a)=>e.jsx(_t,{className:y("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t,ref:a}));Jr.displayName=_t.displayName;const Em=_s("fixed overflow-y-scroll z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-md",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-md"}},defaultVariants:{side:"right"}}),ma=c.forwardRef(({side:s="right",className:t,children:a,...n},l)=>e.jsxs(Rm,{children:[e.jsx(Jr,{}),e.jsxs(Ct,{ref:l,className:y(Em({side:s}),t),...n,children:[e.jsxs(Zt,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(Me,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),a]})]}));ma.displayName=Ct.displayName;const ha=({className:s,...t})=>e.jsx("div",{className:y("flex flex-col space-y-2 text-center sm:text-left",s),...t});ha.displayName="SheetHeader";const Qr=({className:s,...t})=>e.jsx("div",{className:y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Qr.displayName="SheetFooter";const ja=c.forwardRef(({className:s,...t},a)=>e.jsx(St,{ref:a,className:y("text-lg font-semibold text-foreground",s),...t}));ja.displayName=St.displayName;const ga=c.forwardRef(({className:s,...t},a)=>e.jsx(kt,{ref:a,className:y("text-sm text-muted-foreground",s),...t}));ga.displayName=kt.displayName;const Gs=[{label:"邮箱",value:"email",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"用户ID",value:"id",type:"number",operators:[{label:"等于",value:"eq"}]},{label:"订阅",value:"plan_id",type:"select",operators:[{label:"等于",value:"eq"}],useOptions:!0},{label:"流量",value:"transfer_enable",type:"number",unit:"GB",operators:[{label:"大于",value:"gt"},{label:"小于",value:"lt"},{label:"等于",value:"eq"}]},{label:"已用流量",value:"total_used",type:"number",unit:"GB",operators:[{label:"大于",value:"gt"},{label:"小于",value:"lt"},{label:"等于",value:"eq"}]},{label:"在线设备",value:"online_count",type:"number",operators:[{label:"等于",value:"eq"},{label:"大于",value:"gt"},{label:"小于",value:"lt"}]},{label:"到期时间",value:"expired_at",type:"date",operators:[{label:"早于",value:"lt"},{label:"晚于",value:"gt"},{label:"等于",value:"eq"}]},{label:"UUID",value:"uuid",type:"text",operators:[{label:"等于",value:"eq"}]},{label:"Token",value:"token",type:"text",operators:[{label:"等于",value:"eq"}]},{label:"账号状态",value:"banned",type:"select",operators:[{label:"等于",value:"eq"}],options:[{label:"正常",value:"0"},{label:"禁用",value:"1"}]},{label:"备注",value:"remark",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"邀请人邮箱",value:"inviter_email",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"邀请人ID",value:"invite_user_id",type:"number",operators:[{label:"等于",value:"eq"}]},{label:"管理员",value:"is_admin",type:"boolean",operators:[{label:"等于",value:"eq"}]},{label:"员工",value:"is_staff",type:"boolean",operators:[{label:"等于",value:"eq"}]}];function Fm({table:s,refetch:t,permissionGroups:a=[],subscriptionPlans:n=[]}){const l=s.getState().columnFilters.length>0,[o,d]=c.useState([]),[x,r]=c.useState(!1),i=v=>v*1024*1024*1024,h=v=>v/(1024*1024*1024),T=()=>{d([...o,{field:"",operator:"",value:""}])},C=v=>{d(o.filter((N,P)=>P!==v))},m=(v,N,P)=>{const f=[...o];if(f[v]={...f[v],[N]:P},N==="field"){const R=Gs.find(z=>z.value===P);R&&(f[v].operator=R.operators[0].value,f[v].value=R.type==="boolean"?!1:"")}d(f)},w=(v,N)=>{const P=Gs.find(f=>f.value===v.field);if(!P)return null;switch(P.type){case"text":return e.jsx(S,{placeholder:"输入值",value:v.value,onChange:f=>m(N,"value",f.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(S,{type:"number",placeholder:`输入数值${P.unit?`(${P.unit})`:""}`,value:P.unit==="GB"?h(v.value||0):v.value,onChange:f=>{const R=Number(f.target.value);m(N,"value",P.unit==="GB"?i(R):R)}}),P.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:P.unit})]});case"date":return e.jsx(Is,{mode:"single",selected:v.value,onSelect:f=>m(N,"value",f),className:"rounded-md border"});case"select":return e.jsxs(G,{value:v.value,onValueChange:f=>m(N,"value",f),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择选项"})}),e.jsx(B,{children:P.useOptions?n.map(f=>e.jsx(O,{value:f.value.toString(),children:f.label},f.value)):P.options?.map(f=>e.jsx(O,{value:f.value.toString(),children:f.label},f.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(H,{checked:v.value,onCheckedChange:f=>m(N,"value",f)}),e.jsx(yt,{children:v.value?"是":"否"})]});default:return null}},_=()=>{const v=o.filter(N=>N.field&&N.operator&&N.value!=="").map(N=>{const P=Gs.find(R=>R.value===N.field);let f=N.value;return N.operator==="contains"?{id:N.field,value:f}:(P?.type==="date"&&f instanceof Date&&(f=Math.floor(f.getTime()/1e3)),P?.type==="boolean"&&(f=f?1:0),{id:N.field,value:`${N.operator}:${f}`})});s.setColumnFilters(v),r(!1)};return e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[e.jsx(Vm,{refetch:t}),e.jsx(S,{placeholder:"搜索用户邮箱...",value:s.getColumn("email")?.getFilterValue()??"",onChange:v=>s.getColumn("email")?.setFilterValue(v.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(Yr,{open:x,onOpenChange:r,children:[e.jsx(Wr,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(yo,{className:"mr-2 h-4 w-4"}),"高级筛选",o.length>0&&e.jsx(L,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:o.length})]})}),e.jsxs(ma,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(ha,{children:[e.jsx(ja,{children:"高级筛选"}),e.jsx(ga,{children:"添加一个或多个筛选条件来精确查找用户"})]}),e.jsxs("div",{className:"mt-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-medium",children:"筛选条件"}),e.jsx(D,{variant:"outline",size:"sm",onClick:T,children:"添加条件"})]}),e.jsx(tt,{className:"h-[calc(100vh-280px)] pr-4",children:e.jsx("div",{className:"space-y-4",children:o.map((v,N)=>e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(yt,{children:["条件 ",N+1]}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>C(N),children:e.jsx(Me,{className:"h-4 w-4"})})]}),e.jsxs(G,{value:v.field,onValueChange:P=>m(N,"field",P),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择字段"})}),e.jsx(B,{children:Gs.map(P=>e.jsx(O,{value:P.value,children:P.label},P.value))})]}),v.field&&e.jsxs(G,{value:v.operator,onValueChange:P=>m(N,"operator",P),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择操作符"})}),e.jsx(B,{children:Gs.find(P=>P.value===v.field)?.operators.map(P=>e.jsx(O,{value:P.value,children:P.label},P.value))})]}),v.field&&v.operator&&w(v,N)]},N))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(D,{variant:"outline",onClick:()=>{d([]),r(!1)},children:"重置"}),e.jsx(D,{onClick:_,children:"应用筛选"})]})]})]})]}),l&&e.jsxs(D,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),d([])},className:"h-8 px-2 lg:px-3",children:["重置筛选",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})})}const Mm=u.object({id:u.number(),email:u.string().email(),invite_user_email:u.string().email().nullable().optional(),password:u.string().optional().nullable(),balance:u.coerce.number(),commission_balance:u.coerce.number(),u:u.number(),d:u.number(),transfer_enable:u.number(),expired_at:u.number().nullable(),plan_id:u.number().nullable(),banned:u.number(),commission_type:u.number(),commission_rate:u.number().nullable(),discount:u.number().nullable(),speed_limit:u.number().nullable(),device_limit:u.number().nullable(),is_admin:u.number(),is_staff:u.number(),remarks:u.string().nullable()}),Zr=c.createContext(void 0);function zm({children:s,defaultValues:t,open:a,onOpenChange:n}){const[l,o]=c.useState(!1),[d,x]=c.useState(!1),[r,i]=c.useState([]),h=ae({resolver:ie(Mm),defaultValues:t,mode:"onChange"});c.useEffect(()=>{a!==void 0&&o(a)},[a]);const T=C=>{o(C),n?.(C)};return e.jsx(Zr.Provider,{value:{form:h,formOpen:l,setFormOpen:T,datePickerOpen:d,setDatePickerOpen:x,planList:r,setPlanList:i},children:s})}function Om(){const s=c.useContext(Zr);if(!s)throw new Error("useUserForm must be used within a UserFormProvider");return s}function Lm({refetch:s}){const{form:t,formOpen:a,setFormOpen:n,datePickerOpen:l,setDatePickerOpen:o,planList:d,setPlanList:x}=Om();return c.useEffect(()=>{a&&Ps().then(({data:r})=>{x(r)})},[a,x]),e.jsxs(oe,{...t,children:[e.jsx(g,{control:t.control,name:"email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"邮箱"}),e.jsx(b,{children:e.jsx(S,{...r,placeholder:"请输入邮箱"})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"invite_user_email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"邀请人邮箱"}),e.jsx(b,{children:e.jsx(S,{value:r.value||"",onChange:i=>r.onChange(i.target.value?i.target.value:null),placeholder:"请输入邮箱"})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"password",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"密码"}),e.jsx(b,{children:e.jsx(S,{value:r.value||"",onChange:r.onChange,placeholder:"如需修改密码请输入"})}),e.jsx(k,{...r})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(g,{control:t.control,name:"balance",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"余额"}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:r.onChange,placeholder:"请输入余额",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"commission_balance",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"佣金余额"}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:r.onChange,placeholder:"请输入佣金余额",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"u",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"已用上行"}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"已用上行",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"d",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"已用下行"}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"已用下行",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{...r})]})})]}),e.jsx(g,{control:t.control,name:"transfer_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"流量"}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"请输入流量",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"expired_at",render:({field:r})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(p,{children:"到期时间"}),e.jsxs(Ze,{open:l,onOpenChange:o,children:[e.jsx(Xe,{asChild:!0,children:e.jsx(b,{children:e.jsxs(D,{type:"button",variant:"outline",className:y("w-full pl-3 text-left font-normal",!r.value&&"text-muted-foreground"),onClick:()=>o(!0),children:[r.value?re(r.value):e.jsx("span",{children:"请选择用户到期日期,留空为长期有效"}),e.jsx(rt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Be,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:i=>{i.preventDefault()},onEscapeKeyDown:i=>{i.preventDefault()},children:e.jsxs("div",{className:"flex flex-col space-y-3 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{r.onChange(null),o(!1)},children:"长期有效"}),e.jsx(D,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const i=new Date;i.setMonth(i.getMonth()+1),i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3)),o(!1)},children:"一个月"}),e.jsx(D,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const i=new Date;i.setMonth(i.getMonth()+3),i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3)),o(!1)},children:"三个月"})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Is,{mode:"single",selected:r.value?new Date(r.value*1e3):void 0,onSelect:i=>{if(i){const h=new Date(r.value?r.value*1e3:Date.now());i.setHours(h.getHours(),h.getMinutes(),h.getSeconds()),r.onChange(Math.floor(i.getTime()/1e3))}},disabled:i=>i{const i=new Date;i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3))},className:"h-6 px-2 text-xs",children:"设为当天结束"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{type:"datetime-local",step:"1",value:re(r.value,"YYYY-MM-DDTHH:mm:ss"),onChange:i=>{const h=new Date(i.target.value);isNaN(h.getTime())||r.onChange(Math.floor(h.getTime()/1e3))},className:"flex-1"}),e.jsx(D,{type:"button",variant:"outline",onClick:()=>o(!1),children:"确定"})]})]})]})})]}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"plan_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"订阅计划"}),e.jsx(b,{children:e.jsxs(G,{value:r.value?r.value.toString():"null",onValueChange:i=>r.onChange(i==="null"?null:parseInt(i)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"无"})}),e.jsxs(B,{children:[e.jsx(O,{value:"null",children:"无"}),d.map(i=>e.jsx(O,{value:i.id.toString(),children:i.name},i.id))]})]})})]})}),e.jsx(g,{control:t.control,name:"banned",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"账户状态"}),e.jsx(b,{children:e.jsxs(G,{value:r.value.toString(),onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(U,{children:e.jsx(Y,{})}),e.jsxs(B,{children:[e.jsx(O,{value:"1",children:"封禁"}),e.jsx(O,{value:"0",children:"正常"})]})]})})]})}),e.jsx(g,{control:t.control,name:"commission_type",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"佣金类型"}),e.jsx(b,{children:e.jsxs(G,{value:r.value.toString(),onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"无"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"跟随系统设置"}),e.jsx(O,{value:"1",children:"循环返利"}),e.jsx(O,{value:"2",children:"首次返利"})]})]})})]})}),e.jsx(g,{control:t.control,name:"commission_rate",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"推荐返利比例"}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"请输入推荐返利比例(为空则跟随站点设置返利比例)",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})})]})}),e.jsx(g,{control:t.control,name:"discount",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"专享折扣比例"}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"请输入专享折扣比例(为空则不享受专享折扣)",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"speed_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限速"}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"留空则不限速",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"Mbps"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"device_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"设备限制"}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"留空则不限制",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"台"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"is_admin",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"是否管理员"}),e.jsx("div",{className:"py-2",children:e.jsx(b,{children:e.jsx(H,{checked:r.value===1,onCheckedChange:i=>r.onChange(i?1:0)})})})]})}),e.jsx(g,{control:t.control,name:"is_staff",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"是否员工"}),e.jsx("div",{className:"py-2",children:e.jsx(b,{children:e.jsx(H,{checked:r.value===1,onCheckedChange:i=>r.onChange(i?1:0)})})})]})}),e.jsx(g,{control:t.control,name:"remarks",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"备注"}),e.jsx(b,{children:e.jsx(vs,{className:"h-24",value:r.value||"",onChange:i=>r.onChange(i.currentTarget.value??null),placeholder:"请在这里记录"})}),e.jsx(k,{})]})}),e.jsxs(Qr,{children:[e.jsx(D,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(D,{type:"submit",onClick:()=>{t.handleSubmit(r=>{vd(r).then(({data:i})=>{i&&(A.success("修改成功"),n(!1),s())})})()},children:"提交"})]})]})}function Xr({refetch:s,defaultValues:t,dialogTrigger:a=e.jsxs(D,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),"编辑用户信息"]})}){const[n,l]=c.useState(!1);return e.jsx(zm,{defaultValues:t,open:n,onOpenChange:l,children:e.jsxs(Yr,{open:n,onOpenChange:l,children:[e.jsx(Wr,{asChild:!0,children:a}),e.jsxs(ma,{className:"max-w-[90%] space-y-4",children:[e.jsxs(ha,{children:[e.jsx(ja,{children:"用户管理"}),e.jsx(ga,{})]}),e.jsx(Lm,{refetch:s})]})]})})}const el=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m17.71 11.29l-5-5a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21l-5 5a1 1 0 0 0 1.42 1.42L11 9.41V17a1 1 0 0 0 2 0V9.41l3.29 3.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42"})}),sl=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.71 11.29a1 1 0 0 0-1.42 0L13 14.59V7a1 1 0 0 0-2 0v7.59l-3.29-3.3a1 1 0 0 0-1.42 1.42l5 5a1 1 0 0 0 .33.21a.94.94 0 0 0 .76 0a1 1 0 0 0 .33-.21l5-5a1 1 0 0 0 0-1.42"})}),$m=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17 11H9.41l3.3-3.29a1 1 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33a1 1 0 0 0 0 .76a1 1 0 0 0 .21.33l5 5a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42L9.41 13H17a1 1 0 0 0 0-2"})}),Am=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.92 11.62a1 1 0 0 0-.21-.33l-5-5a1 1 0 0 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l5-5a1 1 0 0 0 .21-.33a1 1 0 0 0 0-.76"})}),$t=[{accessorKey:"record_at",header:"时间",cell:({row:s})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("time",{className:"text-sm text-muted-foreground",children:Xo(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(el,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:zs(s.original.u)})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(sl,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:zs(s.original.d)})]})},{accessorKey:"server_rate",header:"倍率",cell:({row:s})=>{const t=s.original.server_rate;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(L,{variant:"outline",className:"font-mono",children:[t,"x"]})})}},{id:"total",header:"总计",cell:({row:s})=>{const t=(s.original.u+s.original.d)*s.original.server_rate;return e.jsx("div",{className:"flex items-center justify-end font-mono text-sm",children:zs(t)})}}];function tl({user_id:s,dialogTrigger:t}){const[a,n]=c.useState(!1),[l,o]=c.useState({pageIndex:0,pageSize:20}),{data:d,isLoading:x}=Q({queryKey:["userStats",s,l,a],queryFn:()=>a?Nd({user_id:s,pageSize:l.pageSize,page:l.pageIndex+1}):null}),r=Le({data:d?.data??[],columns:$t,pageCount:Math.ceil((d?.total??0)/l.pageSize),state:{pagination:l},manualPagination:!0,getCoreRowModel:$e(),onPaginationChange:o});return e.jsxs(ue,{open:a,onOpenChange:n,children:[e.jsx(Re,{asChild:!0,children:t}),e.jsxs(ce,{className:"sm:max-w-[700px]",children:[e.jsx(je,{children:e.jsx(xe,{children:"流量使用记录"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(ia,{children:[e.jsx(oa,{children:r.getHeaderGroups().map(i=>e.jsx(js,{children:i.headers.map(h=>e.jsx(da,{className:y("h-10 px-2 text-xs",h.id==="total"&&"text-right"),children:h.isPlaceholder?null:vt(h.column.columnDef.header,h.getContext())},h.id))},i.id))}),e.jsx(ca,{children:x?Array.from({length:l.pageSize}).map((i,h)=>e.jsx(js,{children:Array.from({length:$t.length}).map((T,C)=>e.jsx(Os,{className:"p-2",children:e.jsx(Fe,{className:"h-6 w-full"})},C))},h)):r.getRowModel().rows?.length?r.getRowModel().rows.map(i=>e.jsx(js,{"data-state":i.getIsSelected()&&"selected",className:"h-10",children:i.getVisibleCells().map(h=>e.jsx(Os,{className:"px-2",children:vt(h.column.columnDef.cell,h.getContext())},h.id))},i.id)):e.jsx(js,{children:e.jsx(Os,{colSpan:$t.length,className:"h-24 text-center",children:"暂无记录"})})})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"每页显示"}),e.jsxs(G,{value:`${r.getState().pagination.pageSize}`,onValueChange:i=>{r.setPageSize(Number(i))},children:[e.jsx(U,{className:"h-8 w-[70px]",children:e.jsx(Y,{placeholder:r.getState().pagination.pageSize})}),e.jsx(B,{side:"top",children:[10,20,30,40,50].map(i=>e.jsx(O,{value:`${i}`,children:i},i))})]}),e.jsx("p",{className:"text-sm font-medium",children:"条记录"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm",children:["第 ",r.getState().pagination.pageIndex+1," /"," ",r.getPageCount()," 页"]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r.previousPage(),disabled:!r.getCanPreviousPage()||x,children:e.jsx($m,{className:"h-4 w-4"})}),e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r.nextPage(),disabled:!r.getCanNextPage()||x,children:e.jsx(Am,{className:"h-4 w-4"})})]})]})]})]})]})]})}const Hm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M5 18h4.24a1 1 0 0 0 .71-.29l6.92-6.93L19.71 8a1 1 0 0 0 0-1.42l-4.24-4.29a1 1 0 0 0-1.42 0l-2.82 2.83l-6.94 6.93a1 1 0 0 0-.29.71V17a1 1 0 0 0 1 1m9.76-13.59l2.83 2.83l-1.42 1.42l-2.83-2.83ZM6 13.17l5.93-5.93l2.83 2.83L8.83 16H6ZM21 20H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2"})}),Km=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11h-6V5a1 1 0 0 0-2 0v6H5a1 1 0 0 0 0 2h6v6a1 1 0 0 0 2 0v-6h6a1 1 0 0 0 0-2"})}),qm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 8.94a1.3 1.3 0 0 0-.06-.27v-.09a1 1 0 0 0-.19-.28l-6-6a1 1 0 0 0-.28-.19a.3.3 0 0 0-.09 0a.9.9 0 0 0-.33-.11H10a3 3 0 0 0-3 3v1H6a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-1h1a3 3 0 0 0 3-3zm-6-3.53L17.59 8H16a1 1 0 0 1-1-1ZM15 19a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h1v7a3 3 0 0 0 3 3h5Zm4-4a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3v3a3 3 0 0 0 3 3h3Z"})}),Um=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 11a1 1 0 0 0-1 1a8.05 8.05 0 1 1-2.22-5.5h-2.4a1 1 0 0 0 0 2h4.53a1 1 0 0 0 1-1V3a1 1 0 0 0-2 0v1.77A10 10 0 1 0 22 12a1 1 0 0 0-1-1"})}),Bm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9.5 10.5H12a1 1 0 0 0 0-2h-1V8a1 1 0 0 0-2 0v.55a2.5 2.5 0 0 0 .5 4.95h1a.5.5 0 0 1 0 1H8a1 1 0 0 0 0 2h1v.5a1 1 0 0 0 2 0v-.55a2.5 2.5 0 0 0-.5-4.95h-1a.5.5 0 0 1 0-1M21 12h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Z"})}),Gm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12.3 12.22A4.92 4.92 0 0 0 14 8.5a5 5 0 0 0-10 0a4.92 4.92 0 0 0 1.7 3.72A8 8 0 0 0 1 19.5a1 1 0 0 0 2 0a6 6 0 0 1 12 0a1 1 0 0 0 2 0a8 8 0 0 0-4.7-7.28M9 11.5a3 3 0 1 1 3-3a3 3 0 0 1-3 3m9.74.32A5 5 0 0 0 15 3.5a1 1 0 0 0 0 2a3 3 0 0 1 3 3a3 3 0 0 1-1.5 2.59a1 1 0 0 0-.5.84a1 1 0 0 0 .45.86l.39.26l.13.07a7 7 0 0 1 4 6.38a1 1 0 0 0 2 0a9 9 0 0 0-4.23-7.68"})}),Ym=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 0 0-6.88 2.77V3a1 1 0 0 0-2 0v4.5a1 1 0 0 0 1 1h4.5a1 1 0 0 0 0-2h-2.4A8 8 0 1 1 4 12a1 1 0 0 0-2 0A10 10 0 1 0 12 2m0 6a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h2a1 1 0 0 0 0-2h-1V9a1 1 0 0 0-1-1"})}),Wm=(s,t)=>[{accessorKey:"is_admin",header:({column:a})=>e.jsx(I,{column:a,title:"管理员"}),enableSorting:!1,enableHiding:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n)),size:0},{accessorKey:"is_staff",header:({column:a})=>e.jsx(I,{column:a,title:"员工"}),enableSorting:!1,enableHiding:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n)),size:0},{accessorKey:"id",header:({column:a})=>e.jsx(I,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(L,{variant:"outline",children:a.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:a})=>e.jsx(I,{column:a,title:"邮箱"}),cell:({row:a})=>{const n=a.original.t||0,l=Date.now()/1e3-n<120,o=Math.floor(Date.now()/1e3-n);let d=l?"当前在线":n===0?"从未在线":`最后在线时间: ${re(n)}`;if(!l&&n!==0){const x=Math.floor(o/60),r=Math.floor(x/60),i=Math.floor(r/24);i>0?d+=` +- 支持随时更换套餐`)},children:"使用模板"})}),e.jsx(ee,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:"点击使用预设的套餐描述模板"})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${_?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"}`,children:[e.jsx("div",{className:"space-y-2",children:e.jsx(y,{children:e.jsx(ra,{style:{height:"400px"},value:w.value||"",renderHTML:N=>r.render(N),onChange:({text:N})=>w.onChange(N),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:"在这里编写套餐描述...",className:"rounded-md border"})})}),_&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"预览"}),e.jsx("div",{className:"prose prose-sm dark:prose-invert h-[400px] max-w-none overflow-y-auto rounded-md border p-4",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:r.render(w.value||"")}})})]})]}),e.jsx(F,{className:"text-xs",children:"支持 Markdown 格式,可以使用标题、列表、粗体、斜体等样式来美化描述内容"}),e.jsx(k,{})]})}})]}),e.jsx(Re,{className:"mt-6",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("div",{className:"flex-shrink-0",children:a&&e.jsx(g,{control:x.control,name:"force_update",render:({field:w})=>e.jsxs(j,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(y,{children:e.jsx($r,{checked:w.value,onCheckedChange:w.onChange})}),e.jsx("div",{className:"",children:e.jsx(p,{className:"text-sm",children:"强制更新到用户"})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(T,{type:"button",variant:"outline",onClick:m,children:"取消"}),e.jsx(T,{type:"submit",disabled:o,onClick:()=>{x.handleSubmit(async w=>{d(!0),(await rd(w)).data&&(A.success(a?"套餐更新成功":"套餐添加成功"),m(),l()),d(!1)})()},children:o?"提交中...":"提交"})]})]})})]})]})})}function nm(){const[s,t]=c.useState({}),[a,n]=c.useState({"drag-handle":!1}),[l,o]=c.useState([]),[d,x]=c.useState([]),[r,i]=c.useState(!1),[h,D]=c.useState({pageSize:20,pageIndex:0}),[C,m]=c.useState([]),{refetch:w}=Q({queryKey:["planList"],queryFn:async()=>{const{data:f}=await Is();return m(f),f}});c.useEffect(()=>{n({"drag-handle":r}),D({pageSize:r?99999:10,pageIndex:0})},[r]);const _=(f,R)=>{r&&(f.dataTransfer.setData("text/plain",R.toString()),f.currentTarget.classList.add("opacity-50"))},b=(f,R)=>{if(!r)return;f.preventDefault(),f.currentTarget.classList.remove("bg-muted");const z=parseInt(f.dataTransfer.getData("text/plain"));if(z===R)return;const $=[...C],[E]=$.splice(z,1);$.splice(R,0,E),m($)},N=async()=>{if(!r){i(!0);return}const f=C?.map(R=>R.id);id(f).then(()=>{A.success("排序保存成功"),i(!1),w()}).finally(()=>{i(!1)})},P=Me({data:C||[],columns:em(w),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:h},enableRowSelection:!0,onPaginationChange:D,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),getSortedRowModel:Ke(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}},pageCount:r?1:void 0});return e.jsx(Zx,{refreshData:w,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ue,{table:P,toolbar:f=>e.jsx(Xx,{table:f,refetch:w,saveOrder:N,isSortMode:r}),draggable:r,onDragStart:_,onDragEnd:f=>f.currentTarget.classList.remove("opacity-50"),onDragOver:f=>{f.preventDefault(),f.currentTarget.classList.add("bg-muted")},onDragLeave:f=>f.currentTarget.classList.remove("bg-muted"),onDrop:b,showPagination:!r}),e.jsx(am,{})]})})}function rm(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"订阅管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以配置订阅计划,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(nm,{})})]})]})}const lm=Object.freeze(Object.defineProperty({__proto__:null,default:rm},Symbol.toStringTag,{value:"Module"})),Ar=[{value:ge.PENDING,label:Ms[ge.PENDING],icon:jo,color:Gs[ge.PENDING]},{value:ge.PROCESSING,label:Ms[ge.PROCESSING],icon:Hn,color:Gs[ge.PROCESSING]},{value:ge.COMPLETED,label:Ms[ge.COMPLETED],icon:Bt,color:Gs[ge.COMPLETED]},{value:ge.CANCELLED,label:Ms[ge.CANCELLED],icon:Kn,color:Gs[ge.CANCELLED]},{value:ge.DISCOUNTED,label:Ms[ge.DISCOUNTED],icon:Bt,color:Gs[ge.DISCOUNTED]}],Hr=[{value:pe.PENDING,label:dt[pe.PENDING],icon:go,color:ut[pe.PENDING]},{value:pe.PROCESSING,label:dt[pe.PROCESSING],icon:Hn,color:ut[pe.PROCESSING]},{value:pe.VALID,label:dt[pe.VALID],icon:Bt,color:ut[pe.VALID]},{value:pe.INVALID,label:dt[pe.INVALID],icon:Kn,color:ut[pe.INVALID]}];function ft({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=s?.getFilterValue(),o=Array.isArray(l)?new Set(l):l!==void 0?new Set([l]):new Set;return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(it,{className:"mr-2 h-4 w-4"}),t,o?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(je,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:o.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:o.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[o.size," selected"]}):a.filter(d=>o.has(d.value)).map(d=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:d.label},d.value))})]})]})}),e.jsx(qe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(ps,{children:[e.jsx(Ps,{placeholder:t}),e.jsxs(vs,{children:[e.jsx(Vs,{children:"No results found."}),e.jsx(Ve,{children:a.map(d=>{const x=o.has(d.value);return e.jsxs(be,{onSelect:()=>{const r=new Set(o);x?r.delete(d.value):r.add(d.value);const i=Array.from(r);s?.setFilterValue(i.length?i:void 0)},children:[e.jsx("div",{className:v("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(ks,{className:v("h-4 w-4")})}),d.icon&&e.jsx(d.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${d.color}`}),e.jsx("span",{children:d.label}),n?.get(d.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(d.value)})]},d.value)})}),o.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Hs,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const im=u.object({email:u.string().min(1),plan_id:u.number(),period:u.string(),total_amount:u.number()}),om={email:"",plan_id:0,total_amount:0,period:""};function Kr({refetch:s,trigger:t,defaultValues:a}){const[n,l]=c.useState(!1),o=ae({resolver:ie(im),defaultValues:{...om,...a},mode:"onChange"}),[d,x]=c.useState([]);return c.useEffect(()=>{n&&Is().then(({data:r})=>{x(r)})},[n]),e.jsxs(ue,{open:n,onOpenChange:l,children:[e.jsx(Ie,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:" h-8 space-x-2",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"添加订单"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(he,{children:[e.jsx(xe,{children:"订单分配"}),e.jsx(Se,{})]}),e.jsxs(oe,{...o,children:[e.jsx(g,{control:o.control,name:"email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"用户邮箱"}),e.jsx(y,{children:e.jsx(S,{placeholder:"请输入用户邮箱",...r})})]})}),e.jsx(g,{control:o.control,name:"plan_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"订阅计划"}),e.jsx(y,{children:e.jsxs(G,{value:r.value?r.value?.toString():void 0,onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择订阅计划"})}),e.jsx(B,{children:d.map(i=>e.jsx(O,{value:i.id.toString(),children:i.name},i.id))})]})})]})}),e.jsx(g,{control:o.control,name:"period",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"订阅时长"}),e.jsx(y,{children:e.jsxs(G,{value:r.value,onValueChange:r.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择购买时长"})}),e.jsx(B,{children:Object.keys(tt).map(i=>e.jsx(O,{value:i,children:tt[i]},i))})]})})]})}),e.jsx(g,{control:o.control,name:"total_amount",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"支付金额"}),e.jsx(y,{children:e.jsx(S,{type:"number",placeholder:"请输入需要支付的金额",value:r.value/100,onChange:i=>r.onChange(parseFloat(i.currentTarget.value)*100)})}),e.jsx(k,{})]})}),e.jsxs(Re,{children:[e.jsx(T,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(T,{type:"submit",onClick:()=>{o.handleSubmit(r=>{xd(r).then(({data:i})=>{i&&(s&&s(),o.reset(),l(!1),A.success("添加成功"))})})()},children:"确定"})]})]})]})]})}const cm=Object.values(as).filter(s=>typeof s=="number").map(s=>({label:br[s],value:s,color:s===as.NEW?"green-500":s===as.RENEWAL?"blue-500":s===as.UPGRADE?"purple-500":"orange-500"})),dm=Object.values(ne).map(s=>({label:tt[s],value:s,color:s===ne.MONTH_PRICE?"slate-500":s===ne.QUARTER_PRICE?"cyan-500":s===ne.HALF_YEAR_PRICE?"indigo-500":s===ne.YEAR_PRICE?"violet-500":s===ne.TWO_YEAR_PRICE?"fuchsia-500":s===ne.THREE_YEAR_PRICE?"pink-500":s===ne.ONETIME_PRICE?"rose-500":"orange-500"}));function um({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Kr,{refetch:t}),e.jsx(S,{placeholder:"搜索订单...",value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:n=>s.getColumn("trade_no")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2",children:[s.getColumn("type")&&e.jsx(ft,{column:s.getColumn("type"),title:"订单类型",options:cm}),s.getColumn("period")&&e.jsx(ft,{column:s.getColumn("period"),title:"订单周期",options:dm}),s.getColumn("status")&&e.jsx(ft,{column:s.getColumn("status"),title:"订单状态",options:Ar}),s.getColumn("commission_status")&&e.jsx(ft,{column:s.getColumn("commission_status"),title:"佣金状态",options:Hr})]}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Fe,{className:"ml-2 h-4 w-4"})]})]})}function Oe({label:s,value:t,className:a,valueClassName:n}){return e.jsxs("div",{className:v("flex items-center py-1.5",a),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:v("text-sm",n),children:t||"-"})]})}function xm({status:s}){const t={PENDING:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",PAID:"bg-green-100 text-green-800 hover:bg-green-100",FAILED:"bg-red-100 text-red-800 hover:bg-red-100",REFUNDED:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(L,{variant:"secondary",className:v("font-medium",t[s]),children:Ms[s]})}function mm({id:s,trigger:t}){const[a,n]=c.useState(!1),[l,o]=c.useState();return c.useEffect(()=>{(async()=>{if(a){const{data:x}=await cd({id:s});o(x)}})()},[a,s]),e.jsxs(ue,{onOpenChange:n,open:a,children:[e.jsx(Ie,{asChild:!0,children:t}),e.jsxs(ce,{className:"max-w-xl",children:[e.jsxs(he,{className:"space-y-2",children:[e.jsx(xe,{className:"text-lg font-medium",children:"订单信息"}),e.jsx("div",{className:"flex items-center justify-between text-sm",children:e.jsxs("div",{className:"flex items-center space-x-6",children:[e.jsxs("div",{className:"text-muted-foreground",children:["订单号:",l?.trade_no]}),l?.status&&e.jsx(xm,{status:l.status})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"基本信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Oe,{label:"用户邮箱",value:l?.user?.email?e.jsxs(Ts,{to:`/user/manage?email=${l.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[l.user.email,e.jsx(qn,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(Oe,{label:"订单周期",value:l&&tt[l.period]}),e.jsx(Oe,{label:"订阅计划",value:l?.plan?.name,valueClassName:"font-medium"}),e.jsx(Oe,{label:"回调单号",value:l?.callback_no,valueClassName:"font-mono text-xs"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"金额信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Oe,{label:"支付金额",value:Ns(l?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(je,{className:"my-2"}),e.jsx(Oe,{label:"余额支付",value:Ns(l?.balance_amount||0)}),e.jsx(Oe,{label:"优惠金额",value:Ns(l?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(Oe,{label:"退回金额",value:Ns(l?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(Oe,{label:"折抵金额",value:Ns(l?.surplus_amount||0)})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"时间信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Oe,{label:"创建时间",value:re(l?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(Oe,{label:"更新时间",value:re(l?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const hm={[as.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[as.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[as.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[as.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},jm={[ne.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},gm=s=>[{accessorKey:"trade_no",header:({column:t})=>e.jsx(V,{column:t,title:"订单号"}),cell:({row:t})=>{const a=t.original.trade_no,n=a.length>6?`${a.slice(0,3)}...${a.slice(-3)}`:a;return e.jsx("div",{className:"flex items-center",children:e.jsx(mm,{trigger:e.jsxs(W,{variant:"ghost",size:"sm",className:"flex h-8 items-center gap-1.5 px-2 font-medium text-primary transition-colors hover:bg-primary/10 hover:text-primary/80",children:[e.jsx("span",{className:"font-mono",children:n}),e.jsx(qn,{className:"h-3.5 w-3.5 opacity-70"})]}),id:t.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:t})=>e.jsx(V,{column:t,title:"类型"}),cell:({row:t})=>{const a=t.getValue("type"),n=hm[a]||{color:"text-slate-700",bgColor:"bg-slate-100/80"};return e.jsx(L,{variant:"secondary",className:v("font-medium transition-colors text-nowrap",n.color,n.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:br[a]})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:t})=>e.jsx(V,{column:t,title:"订阅计划"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium text-foreground/90 sm:max-w-72 md:max-w-[31rem]",children:t.original.plan?.name||"-"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"period",header:({column:t})=>e.jsx(V,{column:t,title:"周期"}),cell:({row:t})=>{const a=t.getValue("period"),n=jm[a]||{color:"text-gray-700",bgColor:"bg-gray-50"};return e.jsx(L,{variant:"secondary",className:v("font-medium transition-colors text-nowrap",n.color,n.bgColor,"hover:bg-opacity-80"),children:tt[a]})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:t})=>e.jsx(V,{column:t,title:"支付金额"}),cell:({row:t})=>{const a=t.getValue("total_amount"),n=typeof a=="number"?(a/100).toFixed(2):"N/A";return e.jsxs("div",{className:"flex items-center font-mono text-foreground/90",children:["¥",n]})},enableSorting:!0,enableHiding:!1},{accessorKey:"status",header:({column:t})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(V,{column:t,title:"订单状态"}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx(Ir,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(ee,{side:"top",className:"max-w-[200px] text-sm",children:"标记为[已支付]后将会由系统进行开通后并完成"})]})})]}),cell:({row:t})=>{const a=Ar.find(n=>n.value===t.getValue("status"));return a?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[a.icon&&e.jsx(a.icon,{className:`h-4 w-4 text-${a.color}`}),e.jsx("span",{className:"text-sm font-medium",children:a.label})]}),a.value===ge.PENDING&&e.jsxs(_s,{modal:!0,children:[e.jsx(Cs,{asChild:!0,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(bt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"打开菜单"})]})}),e.jsxs(fs,{align:"end",className:"w-[140px]",children:[e.jsx(me,{className:"cursor-pointer",onClick:async()=>{await dd({trade_no:t.original.trade_no}),s()},children:"标记为已支付"}),e.jsx(me,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await ud({trade_no:t.original.trade_no}),s()},children:"取消订单"})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:t})=>e.jsx(V,{column:t,title:"佣金金额"}),cell:({row:t})=>{const a=t.getValue("commission_balance"),n=a?(a/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:a?`¥${n}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:t})=>e.jsx(V,{column:t,title:"佣金状态"}),cell:({row:t})=>{const a=t.original.commission_balance,n=Hr.find(l=>l.value===t.getValue("commission_status"));return a==0||!n?e.jsx("span",{className:"text-muted-foreground",children:"-"}):e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n.icon&&e.jsx(n.icon,{className:`h-4 w-4 text-${n.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n.label})]}),n.value===pe.PENDING&&e.jsxs(_s,{modal:!0,children:[e.jsx(Cs,{asChild:!0,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(bt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"打开菜单"})]})}),e.jsxs(fs,{align:"end",className:"w-[120px]",children:[e.jsx(me,{className:"cursor-pointer",onClick:async()=>{await za({trade_no:t.original.trade_no,commission_status:pe.PROCESSING}),s()},children:"标记为有效"}),e.jsx(me,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await za({trade_no:t.original.trade_no,commission_status:pe.INVALID}),s()},children:"标记为无效"})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:t})=>e.jsx(V,{column:t,title:"创建时间"}),cell:({row:t})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:re(t.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}];function fm(){const[s]=Un(),[t,a]=c.useState({}),[n,l]=c.useState({}),[o,d]=c.useState([]),[x,r]=c.useState([]),[i,h]=c.useState({pageIndex:0,pageSize:20});c.useEffect(()=>{const b=Object.entries({user_id:"string",order_id:"string",commission_status:"number",status:"number",commission_balance:"string"}).map(([N,P])=>{const f=s.get(N);return f?{id:N,value:P==="number"?parseInt(f):f}:null}).filter(Boolean);b.length>0&&d(b)},[s]);const{refetch:D,data:C,isLoading:m}=Q({queryKey:["orderList",i,o,x],queryFn:()=>od({pageSize:i.pageSize,current:i.pageIndex+1,filter:o,sort:x})}),w=Me({data:C?.data??[],columns:gm(D),state:{sorting:x,columnVisibility:n,rowSelection:t,columnFilters:o,pagination:i},rowCount:C?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:r,onColumnFiltersChange:d,onColumnVisibilityChange:l,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),onPaginationChange:h,getSortedRowModel:Ke(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ue,{table:w,toolbar:e.jsx(um,{table:w,refetch:D}),showPagination:!0})}function pm(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:" 订单管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"在这里可以查看用户订单,包括分配、查看、删除等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(fm,{})})]})]})}const vm=Object.freeze(Object.defineProperty({__proto__:null,default:pm},Symbol.toStringTag,{value:"Module"}));function bm({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(it,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(je,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(o=>l.has(o.value)).map(o=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(qe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(ps,{children:[e.jsx(Ps,{placeholder:t}),e.jsxs(vs,{children:[e.jsx(Vs,{children:"No results found."}),e.jsx(Ve,{children:a.map(o=>{const d=l.has(o.value);return e.jsxs(be,{onSelect:()=>{d?l.delete(o.value):l.add(o.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},children:[e.jsx("div",{className:v("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(ks,{className:v("h-4 w-4")})}),o.icon&&e.jsx(o.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${o.color}`}),e.jsx("span",{children:o.label}),n?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(o.value)})]},o.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Hs,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const ym=u.object({id:u.coerce.number().nullable().optional(),name:u.string().min(1,"请输入优惠券名称"),code:u.string().nullable(),type:u.union([u.string(),u.nativeEnum(Rt)]),value:u.coerce.number(),started_at:u.coerce.number(),ended_at:u.coerce.number(),limit_use:u.union([u.string(),u.number()]).nullable(),limit_use_with_user:u.union([u.string(),u.number()]).nullable(),generate_count:u.coerce.number().nullable().optional(),limit_plan_ids:u.array(u.number()).default([]).nullable(),limit_period:u.array(u.nativeEnum(ne)).default([]).nullable()}).refine(s=>s.ended_at>s.started_at,{message:"结束时间必须晚于开始时间",path:["ended_at"]}),qa={name:"",code:"",type:Rt.AMOUNT,value:0,started_at:Math.floor(Date.now()/1e3),ended_at:Math.floor(Date.now()/1e3)+7*24*60*60,limit_use:"",limit_use_with_user:"",limit_plan_ids:[],limit_period:[],generate_count:""};function qr({defaultValues:s,refetch:t,type:a="create",dialogTrigger:n=e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"添加优惠券"})]}),open:l,onOpenChange:o}){const[d,x]=c.useState(!1),r=l??d,i=o??x,[h,D]=c.useState([]),C=ae({resolver:ie(ym),defaultValues:s||qa});c.useEffect(()=>{s&&C.reset(s)},[s,C]),c.useEffect(()=>{Is().then(({data:b})=>D(b))},[]);const m=b=>{if(!b)return;const N=(P,f)=>{const R=new Date(f*1e3);return P.setHours(R.getHours(),R.getMinutes(),R.getSeconds()),Math.floor(P.getTime()/1e3)};b.from&&C.setValue("started_at",N(b.from,C.watch("started_at"))),b.to&&C.setValue("ended_at",N(b.to,C.watch("ended_at")))},w=async b=>{try{await hd(b),i(!1),a==="create"&&C.reset(qa),t()}catch(N){console.error("保存优惠券失败:",N)}},_=(b,N)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:N}),e.jsx(S,{type:"datetime-local",step:"1",value:re(C.watch(b),"YYYY-MM-DDTHH:mm:ss"),onChange:P=>{const f=new Date(P.target.value);C.setValue(b,Math.floor(f.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(ue,{open:r,onOpenChange:i,children:[n&&e.jsx(Ie,{asChild:!0,children:n}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(he,{children:e.jsx(xe,{children:a==="create"?"添加优惠券":"编辑优惠券"})}),e.jsx(oe,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(w),className:"space-y-4",children:[e.jsx(g,{control:C.control,name:"name",render:({field:b})=>e.jsxs(j,{children:[e.jsx(p,{children:"优惠券名称"}),e.jsx(S,{placeholder:"请输入优惠券名称",...b}),e.jsx(k,{})]})}),e.jsxs(j,{children:[e.jsx(p,{children:"优惠券类型和值"}),e.jsxs("div",{className:"flex",children:[e.jsx(g,{control:C.control,name:"type",render:({field:b})=>e.jsxs(G,{value:b.value.toString(),onValueChange:b.onChange,children:[e.jsx(U,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(Y,{placeholder:"优惠券类型"})}),e.jsx(B,{children:Object.entries(oa).map(([N,P])=>e.jsx(O,{value:N,children:P},N))})]})}),e.jsx(g,{control:C.control,name:"value",render:({field:b})=>e.jsx(S,{type:"number",placeholder:"请输入值",...b,onChange:N=>b.onChange(N.target.value===""?"":N.target.value),className:"flex-[2] rounded-none border-x-0 text-left"})}),e.jsx("div",{className:"flex min-w-[40px] items-center justify-center rounded-md rounded-l-none border border-l-0 border-input bg-muted/50 px-3 font-medium text-muted-foreground",children:e.jsx("span",{children:C.watch("type")===Rt.AMOUNT?"¥":"%"})})]})]}),e.jsxs(j,{children:[e.jsx(p,{children:"优惠券有效期"}),e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(T,{variant:"outline",className:v("w-full justify-start text-left font-normal",!C.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),re(C.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ","至"," ",re(C.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(qe,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(Rs,{mode:"range",selected:{from:new Date(C.watch("started_at")*1e3),to:new Date(C.watch("ended_at")*1e3)},onSelect:m,numberOfMonths:2})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[_("started_at","开始时间"),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:"至"}),_("ended_at","结束时间")]})})]})]}),e.jsx(k,{})]}),e.jsx(g,{control:C.control,name:"limit_use",render:({field:b})=>e.jsxs(j,{children:[e.jsx(p,{children:"最大使用次数"}),e.jsx(S,{type:"number",min:0,placeholder:"限制最大使用次数,留空则不限制",...b,value:b.value===void 0?"":b.value,onChange:N=>b.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(F,{className:"text-xs",children:"设置优惠券的总使用次数限制,留空表示不限制使用次数"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_use_with_user",render:({field:b})=>e.jsxs(j,{children:[e.jsx(p,{children:"每个用户可使用次数"}),e.jsx(S,{type:"number",min:0,placeholder:"限制每个用户可使用次数,留空则不限制",...b,value:b.value===void 0?"":b.value,onChange:N=>b.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(F,{className:"text-xs",children:"限制每个用户可使用该优惠券的次数,留空表示不限制单用户使用次数"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_period",render:({field:b})=>e.jsxs(j,{children:[e.jsx(p,{children:"指定周期"}),e.jsx(nt,{options:Object.entries(ne).filter(([N])=>isNaN(Number(N))).map(([N,P])=>({label:P,value:N})),onChange:N=>{if(N.length===0){b.onChange([]);return}const P=N.map(f=>ne[f.value]);b.onChange(P)},value:(b.value||[]).map(N=>({label:Object.entries(ne).find(([P,f])=>f===N)?.[1]||"",value:Object.entries(ne).find(([P,f])=>f===N)?.[0]||""})),placeholder:"限制指定周期可以使用优惠,留空则不限制",emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"没有找到匹配的周期"})}),e.jsx(F,{className:"text-xs",children:"选择可以使用优惠券的订阅周期,留空表示不限制使用周期"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_plan_ids",render:({field:b})=>e.jsxs(j,{children:[e.jsx(p,{children:"指定订阅"}),e.jsx(nt,{options:h?.map(N=>({label:N.name,value:N.id.toString()}))||[],onChange:N=>b.onChange(N.map(P=>Number(P.value))),value:(h||[]).filter(N=>(b.value||[]).includes(N.id)).map(N=>({label:N.name,value:N.id.toString()})),placeholder:"限制指定订阅可以使用优惠,留空则不限制",emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"没有找到匹配的订阅"})}),e.jsx(k,{})]})}),a==="create"&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:C.control,name:"code",render:({field:b})=>e.jsxs(j,{children:[e.jsx(p,{children:"自定义优惠码"}),e.jsx(S,{placeholder:"自定义优惠码,留空则自动生成",...b,className:"h-9"}),e.jsx(F,{className:"text-xs",children:"可以自定义优惠码,留空则系统自动生成"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"generate_count",render:({field:b})=>e.jsxs(j,{children:[e.jsx(p,{children:"批量生成数量"}),e.jsx(S,{type:"number",min:0,placeholder:"批量生成优惠码数量,留空则生成单个",...b,value:b.value===void 0?"":b.value,onChange:N=>b.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(F,{className:"text-xs",children:"批量生成多个优惠码,留空则只生成单个优惠码"}),e.jsx(k,{})]})})]}),e.jsx(Re,{children:e.jsx(T,{type:"submit",disabled:C.formState.isSubmitting,children:C.formState.isSubmitting?"保存中...":"保存"})})]})})]})]})}function Nm({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qr,{refetch:t}),e.jsx(S,{placeholder:"搜索优惠券...",value:s.getColumn("name")?.getFilterValue()??"",onChange:n=>s.getColumn("name")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(bm,{column:s.getColumn("type"),title:"类型",options:Object.entries(oa).map(([n,l])=>({value:n,label:l}))}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Fe,{className:"ml-2 h-4 w-4"})]})]})}const Ur=c.createContext(void 0);function wm({children:s,refetch:t}){const[a,n]=c.useState(!1),[l,o]=c.useState(null),d=r=>{o(r),n(!0)},x=()=>{n(!1),o(null)};return e.jsxs(Ur.Provider,{value:{isOpen:a,currentCoupon:l,openEdit:d,closeEdit:x},children:[s,l&&e.jsx(qr,{defaultValues:l,refetch:t,type:"edit",open:a,onOpenChange:n})]})}function _m(){const s=c.useContext(Ur);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const Cm=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(V,{column:t,title:"ID"}),cell:({row:t})=>e.jsx(L,{children:t.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(V,{column:t,title:"启用"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.original.show,onCheckedChange:a=>{gd({id:t.original.id,show:a}).then(({data:n})=>!n&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(V,{column:t,title:"卷名称"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:t.original.name})}),enableSorting:!1,size:800},{accessorKey:"type",header:({column:t})=>e.jsx(V,{column:t,title:"类型"}),cell:({row:t})=>e.jsx(L,{variant:"outline",children:oa[t.original.type]}),enableSorting:!0},{accessorKey:"code",header:({column:t})=>e.jsx(V,{column:t,title:"卷码"}),cell:({row:t})=>e.jsx(L,{variant:"secondary",children:t.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:t})=>e.jsx(V,{column:t,title:"剩余次数"}),cell:({row:t})=>e.jsx(L,{variant:"outline",children:t.original.limit_use===null?"无限次":t.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:t})=>e.jsx(V,{column:t,title:"可用次数/用户"}),cell:({row:t})=>e.jsx(L,{variant:"outline",children:t.original.limit_use_with_user===null?"无限制":t.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:t})=>e.jsx(V,{column:t,title:"有效期"}),cell:({row:t})=>{const[a,n]=c.useState(!1),l=Date.now(),o=t.original.started_at*1e3,d=t.original.ended_at*1e3,x=l>d,r=le.jsx(V,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{openEdit:a}=_m();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>a(t.original),children:[e.jsx(Ds,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),e.jsx(Be,{title:"确认删除",description:"此操作将永久删除该优惠券,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{jd({id:t.original.id}).then(({data:n})=>{n&&(A.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}}];function Sm(){const[s,t]=c.useState({}),[a,n]=c.useState({}),[l,o]=c.useState([]),[d,x]=c.useState([]),[r,i]=c.useState({pageIndex:0,pageSize:20}),{refetch:h,data:D}=Q({queryKey:["couponList",r,l,d],queryFn:()=>md({pageSize:r.pageSize,current:r.pageIndex+1,filter:l,sort:d})}),C=Me({data:D?.data??[],columns:Cm(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:r},pageCount:Math.ceil((D?.total??0)/r.pageSize),rowCount:D?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,onPaginationChange:i,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),getSortedRowModel:Ke(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(wm,{refetch:h,children:e.jsx("div",{className:"space-y-4",children:e.jsx(Ue,{table:C,toolbar:e.jsx(Nm,{table:C,refetch:h})})})})}function km(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"优惠券管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"在这里可以查看优惠券,包括增加、查看、删除等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Sm,{})})]})]})}const Tm=Object.freeze(Object.defineProperty({__proto__:null,default:km},Symbol.toStringTag,{value:"Module"})),Dm=u.object({email_prefix:u.string().optional(),email_suffix:u.string().min(1),password:u.string().optional(),expired_at:u.number().optional().nullable(),plan_id:u.number().nullable(),generate_count:u.number().optional().nullable()}).refine(s=>s.generate_count===null?s.email_prefix!==void 0&&s.email_prefix!=="":!0,{message:"Email prefix is required when generate_count is null",path:["email_prefix"]}),Pm={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0};function Vm({refetch:s}){const[t,a]=c.useState(!1),n=ae({resolver:ie(Dm),defaultValues:Pm,mode:"onChange"}),[l,o]=c.useState([]);return c.useEffect(()=>{t&&Is().then(({data:d})=>{d&&o(d)})},[t]),e.jsxs(ue,{open:t,onOpenChange:a,children:[e.jsx(Ie,{asChild:!0,children:e.jsxs(W,{size:"sm",variant:"outline",className:"space-x-2 gap-0",children:[e.jsx(ve,{icon:"ion:add"}),e.jsx("div",{children:"创建用户"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(he,{children:[e.jsx(xe,{children:"创建用户"}),e.jsx(Se,{})]}),e.jsxs(oe,{...n,children:[e.jsxs(j,{children:[e.jsx(p,{children:"邮箱"}),e.jsxs("div",{className:"flex",children:[!n.watch("generate_count")&&e.jsx(g,{control:n.control,name:"email_prefix",render:({field:d})=>e.jsx(S,{className:"flex-[5] rounded-r-none",placeholder:"帐号(批量生成请留空)",...d})}),e.jsx("div",{className:`z-[-1] border border-r-0 border-input px-3 py-1 shadow-sm ${n.watch("generate_count")?"rounded-l-md":"border-l-0"}`,children:"@"}),e.jsx(g,{control:n.control,name:"email_suffix",render:({field:d})=>e.jsx(S,{className:"flex-[4] rounded-l-none",placeholder:"域",...d})})]})]}),e.jsx(g,{control:n.control,name:"password",render:({field:d})=>e.jsxs(j,{children:[e.jsx(p,{children:"密码"}),e.jsx(S,{placeholder:"留空则密码与邮件相同",...d}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"expired_at",render:({field:d})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(p,{children:"到期时间"}),e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsx(y,{children:e.jsxs(W,{variant:"outline",className:v("w-full pl-3 text-left font-normal",!d.value&&"text-muted-foreground"),children:[d.value?re(d.value):e.jsx("span",{children:"请选择用户到期日期,留空为长期有效"}),e.jsx(lt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(qe,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(po,{asChild:!0,children:e.jsx(W,{variant:"outline",className:"w-full",onClick:()=>{d.onChange(null)},children:"长期有效"})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Rs,{mode:"single",selected:d.value?new Date(d.value*1e3):void 0,onSelect:x=>{x&&d.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(g,{control:n.control,name:"plan_id",render:({field:d})=>e.jsxs(j,{children:[e.jsx(p,{children:"订阅计划"}),e.jsx(y,{children:e.jsxs(G,{value:d.value?d.value.toString():"null",onValueChange:x=>d.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"无"})}),e.jsxs(B,{children:[e.jsx(O,{value:"null",children:"无"}),l.map(x=>e.jsx(O,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!n.watch("email_prefix")&&e.jsx(g,{control:n.control,name:"generate_count",render:({field:d})=>e.jsxs(j,{children:[e.jsx(p,{children:"生成数量"}),e.jsx(S,{type:"number",placeholder:"如果为批量生产请输入生成数量",value:d.value||"",onChange:x=>d.onChange(x.target.value?parseInt(x.target.value):null)})]})})]}),e.jsxs(Re,{children:[e.jsx(W,{variant:"outline",onClick:()=>a(!1),children:"取消"}),e.jsx(W,{onClick:()=>n.handleSubmit(d=>{bd(d).then(({data:x})=>{x&&(A.success("生成成功"),n.reset(),s(),a(!1))})})(),children:"生成"})]})]})]})}const Br=Ga,Gr=Ya,Im=Wa,Yr=c.forwardRef(({className:s,...t},a)=>e.jsx(_t,{className:v("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t,ref:a}));Yr.displayName=_t.displayName;const Rm=Ss("fixed overflow-y-scroll z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-md",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-md"}},defaultVariants:{side:"right"}}),ja=c.forwardRef(({side:s="right",className:t,children:a,...n},l)=>e.jsxs(Im,{children:[e.jsx(Yr,{}),e.jsxs(Ct,{ref:l,className:v(Rm({side:s}),t),...n,children:[e.jsxs(ea,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(Fe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),a]})]}));ja.displayName=Ct.displayName;const ga=({className:s,...t})=>e.jsx("div",{className:v("flex flex-col space-y-2 text-center sm:text-left",s),...t});ga.displayName="SheetHeader";const Wr=({className:s,...t})=>e.jsx("div",{className:v("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Wr.displayName="SheetFooter";const fa=c.forwardRef(({className:s,...t},a)=>e.jsx(St,{ref:a,className:v("text-lg font-semibold text-foreground",s),...t}));fa.displayName=St.displayName;const pa=c.forwardRef(({className:s,...t},a)=>e.jsx(kt,{ref:a,className:v("text-sm text-muted-foreground",s),...t}));pa.displayName=kt.displayName;const Ys=[{label:"邮箱",value:"email",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"用户ID",value:"id",type:"number",operators:[{label:"等于",value:"eq"}]},{label:"订阅",value:"plan_id",type:"select",operators:[{label:"等于",value:"eq"}],useOptions:!0},{label:"流量",value:"transfer_enable",type:"number",unit:"GB",operators:[{label:"大于",value:"gt"},{label:"小于",value:"lt"},{label:"等于",value:"eq"}]},{label:"已用流量",value:"total_used",type:"number",unit:"GB",operators:[{label:"大于",value:"gt"},{label:"小于",value:"lt"},{label:"等于",value:"eq"}]},{label:"在线设备",value:"online_count",type:"number",operators:[{label:"等于",value:"eq"},{label:"大于",value:"gt"},{label:"小于",value:"lt"}]},{label:"到期时间",value:"expired_at",type:"date",operators:[{label:"早于",value:"lt"},{label:"晚于",value:"gt"},{label:"等于",value:"eq"}]},{label:"UUID",value:"uuid",type:"text",operators:[{label:"等于",value:"eq"}]},{label:"Token",value:"token",type:"text",operators:[{label:"等于",value:"eq"}]},{label:"账号状态",value:"banned",type:"select",operators:[{label:"等于",value:"eq"}],options:[{label:"正常",value:"0"},{label:"禁用",value:"1"}]},{label:"备注",value:"remark",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"邀请人邮箱",value:"inviter_email",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"邀请人ID",value:"invite_user_id",type:"number",operators:[{label:"等于",value:"eq"}]},{label:"管理员",value:"is_admin",type:"boolean",operators:[{label:"等于",value:"eq"}]},{label:"员工",value:"is_staff",type:"boolean",operators:[{label:"等于",value:"eq"}]}];function Em({table:s,refetch:t,permissionGroups:a=[],subscriptionPlans:n=[]}){const l=s.getState().columnFilters.length>0,[o,d]=c.useState([]),[x,r]=c.useState(!1),i=b=>b*1024*1024*1024,h=b=>b/(1024*1024*1024),D=()=>{d([...o,{field:"",operator:"",value:""}])},C=b=>{d(o.filter((N,P)=>P!==b))},m=(b,N,P)=>{const f=[...o];if(f[b]={...f[b],[N]:P},N==="field"){const R=Ys.find(z=>z.value===P);R&&(f[b].operator=R.operators[0].value,f[b].value=R.type==="boolean"?!1:"")}d(f)},w=(b,N)=>{const P=Ys.find(f=>f.value===b.field);if(!P)return null;switch(P.type){case"text":return e.jsx(S,{placeholder:"输入值",value:b.value,onChange:f=>m(N,"value",f.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(S,{type:"number",placeholder:`输入数值${P.unit?`(${P.unit})`:""}`,value:P.unit==="GB"?h(b.value||0):b.value,onChange:f=>{const R=Number(f.target.value);m(N,"value",P.unit==="GB"?i(R):R)}}),P.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:P.unit})]});case"date":return e.jsx(Rs,{mode:"single",selected:b.value,onSelect:f=>m(N,"value",f),className:"rounded-md border"});case"select":return e.jsxs(G,{value:b.value,onValueChange:f=>m(N,"value",f),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择选项"})}),e.jsx(B,{children:P.useOptions?n.map(f=>e.jsx(O,{value:f.value.toString(),children:f.label},f.value)):P.options?.map(f=>e.jsx(O,{value:f.value.toString(),children:f.label},f.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(H,{checked:b.value,onCheckedChange:f=>m(N,"value",f)}),e.jsx(yt,{children:b.value?"是":"否"})]});default:return null}},_=()=>{const b=o.filter(N=>N.field&&N.operator&&N.value!=="").map(N=>{const P=Ys.find(R=>R.value===N.field);let f=N.value;return N.operator==="contains"?{id:N.field,value:f}:(P?.type==="date"&&f instanceof Date&&(f=Math.floor(f.getTime()/1e3)),P?.type==="boolean"&&(f=f?1:0),{id:N.field,value:`${N.operator}:${f}`})});s.setColumnFilters(b),r(!1)};return e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[e.jsx(Vm,{refetch:t}),e.jsx(S,{placeholder:"搜索用户邮箱...",value:s.getColumn("email")?.getFilterValue()??"",onChange:b=>s.getColumn("email")?.setFilterValue(b.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(Br,{open:x,onOpenChange:r,children:[e.jsx(Gr,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(vo,{className:"mr-2 h-4 w-4"}),"高级筛选",o.length>0&&e.jsx(L,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:o.length})]})}),e.jsxs(ja,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(ga,{children:[e.jsx(fa,{children:"高级筛选"}),e.jsx(pa,{children:"添加一个或多个筛选条件来精确查找用户"})]}),e.jsxs("div",{className:"mt-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-medium",children:"筛选条件"}),e.jsx(T,{variant:"outline",size:"sm",onClick:D,children:"添加条件"})]}),e.jsx(at,{className:"h-[calc(100vh-280px)] pr-4",children:e.jsx("div",{className:"space-y-4",children:o.map((b,N)=>e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(yt,{children:["条件 ",N+1]}),e.jsx(T,{variant:"ghost",size:"sm",onClick:()=>C(N),children:e.jsx(Fe,{className:"h-4 w-4"})})]}),e.jsxs(G,{value:b.field,onValueChange:P=>m(N,"field",P),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择字段"})}),e.jsx(B,{children:Ys.map(P=>e.jsx(O,{value:P.value,children:P.label},P.value))})]}),b.field&&e.jsxs(G,{value:b.operator,onValueChange:P=>m(N,"operator",P),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"选择操作符"})}),e.jsx(B,{children:Ys.find(P=>P.value===b.field)?.operators.map(P=>e.jsx(O,{value:P.value,children:P.label},P.value))})]}),b.field&&b.operator&&w(b,N)]},N))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(T,{variant:"outline",onClick:()=>{d([]),r(!1)},children:"重置"}),e.jsx(T,{onClick:_,children:"应用筛选"})]})]})]})]}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),d([])},className:"h-8 px-2 lg:px-3",children:["重置筛选",e.jsx(Fe,{className:"ml-2 h-4 w-4"})]})]})})}const Fm=u.object({id:u.number(),email:u.string().email(),invite_user_email:u.string().email().nullable().optional(),password:u.string().optional().nullable(),balance:u.coerce.number(),commission_balance:u.coerce.number(),u:u.number(),d:u.number(),transfer_enable:u.number(),expired_at:u.number().nullable(),plan_id:u.number().nullable(),banned:u.number(),commission_type:u.number(),commission_rate:u.number().nullable(),discount:u.number().nullable(),speed_limit:u.number().nullable(),device_limit:u.number().nullable(),is_admin:u.number(),is_staff:u.number(),remarks:u.string().nullable()}),Jr=c.createContext(void 0);function Mm({children:s,defaultValues:t,open:a,onOpenChange:n}){const[l,o]=c.useState(!1),[d,x]=c.useState(!1),[r,i]=c.useState([]),h=ae({resolver:ie(Fm),defaultValues:t,mode:"onChange"});c.useEffect(()=>{a!==void 0&&o(a)},[a]);const D=C=>{o(C),n?.(C)};return e.jsx(Jr.Provider,{value:{form:h,formOpen:l,setFormOpen:D,datePickerOpen:d,setDatePickerOpen:x,planList:r,setPlanList:i},children:s})}function zm(){const s=c.useContext(Jr);if(!s)throw new Error("useUserForm must be used within a UserFormProvider");return s}function Om({refetch:s}){const{form:t,formOpen:a,setFormOpen:n,datePickerOpen:l,setDatePickerOpen:o,planList:d,setPlanList:x}=zm();return c.useEffect(()=>{a&&Is().then(({data:r})=>{x(r)})},[a,x]),e.jsxs(oe,{...t,children:[e.jsx(g,{control:t.control,name:"email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"邮箱"}),e.jsx(y,{children:e.jsx(S,{...r,placeholder:"请输入邮箱"})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"invite_user_email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"邀请人邮箱"}),e.jsx(y,{children:e.jsx(S,{value:r.value||"",onChange:i=>r.onChange(i.target.value?i.target.value:null),placeholder:"请输入邮箱"})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"password",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"密码"}),e.jsx(y,{children:e.jsx(S,{value:r.value||"",onChange:r.onChange,placeholder:"如需修改密码请输入"})}),e.jsx(k,{...r})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(g,{control:t.control,name:"balance",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"余额"}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:r.onChange,placeholder:"请输入余额",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"commission_balance",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"佣金余额"}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:r.onChange,placeholder:"请输入佣金余额",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"u",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"已用上行"}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"已用上行",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"d",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"已用下行"}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"已用下行",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{...r})]})})]}),e.jsx(g,{control:t.control,name:"transfer_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"流量"}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"请输入流量",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"expired_at",render:({field:r})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(p,{children:"到期时间"}),e.jsxs(Ze,{open:l,onOpenChange:o,children:[e.jsx(Xe,{asChild:!0,children:e.jsx(y,{children:e.jsxs(T,{type:"button",variant:"outline",className:v("w-full pl-3 text-left font-normal",!r.value&&"text-muted-foreground"),onClick:()=>o(!0),children:[r.value?re(r.value):e.jsx("span",{children:"请选择用户到期日期,留空为长期有效"}),e.jsx(lt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(qe,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:i=>{i.preventDefault()},onEscapeKeyDown:i=>{i.preventDefault()},children:e.jsxs("div",{className:"flex flex-col space-y-3 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{r.onChange(null),o(!1)},children:"长期有效"}),e.jsx(T,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const i=new Date;i.setMonth(i.getMonth()+1),i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3)),o(!1)},children:"一个月"}),e.jsx(T,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const i=new Date;i.setMonth(i.getMonth()+3),i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3)),o(!1)},children:"三个月"})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Rs,{mode:"single",selected:r.value?new Date(r.value*1e3):void 0,onSelect:i=>{if(i){const h=new Date(r.value?r.value*1e3:Date.now());i.setHours(h.getHours(),h.getMinutes(),h.getSeconds()),r.onChange(Math.floor(i.getTime()/1e3))}},disabled:i=>i{const i=new Date;i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3))},className:"h-6 px-2 text-xs",children:"设为当天结束"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{type:"datetime-local",step:"1",value:re(r.value,"YYYY-MM-DDTHH:mm:ss"),onChange:i=>{const h=new Date(i.target.value);isNaN(h.getTime())||r.onChange(Math.floor(h.getTime()/1e3))},className:"flex-1"}),e.jsx(T,{type:"button",variant:"outline",onClick:()=>o(!1),children:"确定"})]})]})]})})]}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"plan_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"订阅计划"}),e.jsx(y,{children:e.jsxs(G,{value:r.value?r.value.toString():"null",onValueChange:i=>r.onChange(i==="null"?null:parseInt(i)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"无"})}),e.jsxs(B,{children:[e.jsx(O,{value:"null",children:"无"}),d.map(i=>e.jsx(O,{value:i.id.toString(),children:i.name},i.id))]})]})})]})}),e.jsx(g,{control:t.control,name:"banned",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"账户状态"}),e.jsx(y,{children:e.jsxs(G,{value:r.value.toString(),onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(U,{children:e.jsx(Y,{})}),e.jsxs(B,{children:[e.jsx(O,{value:"1",children:"封禁"}),e.jsx(O,{value:"0",children:"正常"})]})]})})]})}),e.jsx(g,{control:t.control,name:"commission_type",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"佣金类型"}),e.jsx(y,{children:e.jsxs(G,{value:r.value.toString(),onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"无"})}),e.jsxs(B,{children:[e.jsx(O,{value:"0",children:"跟随系统设置"}),e.jsx(O,{value:"1",children:"循环返利"}),e.jsx(O,{value:"2",children:"首次返利"})]})]})})]})}),e.jsx(g,{control:t.control,name:"commission_rate",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"推荐返利比例"}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"请输入推荐返利比例(为空则跟随站点设置返利比例)",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})})]})}),e.jsx(g,{control:t.control,name:"discount",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"专享折扣比例"}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"请输入专享折扣比例(为空则不享受专享折扣)",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"speed_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"限速"}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"留空则不限速",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"Mbps"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"device_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"设备限制"}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"留空则不限制",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"台"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"is_admin",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"是否管理员"}),e.jsx("div",{className:"py-2",children:e.jsx(y,{children:e.jsx(H,{checked:r.value===1,onCheckedChange:i=>r.onChange(i?1:0)})})})]})}),e.jsx(g,{control:t.control,name:"is_staff",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"是否员工"}),e.jsx("div",{className:"py-2",children:e.jsx(y,{children:e.jsx(H,{checked:r.value===1,onCheckedChange:i=>r.onChange(i?1:0)})})})]})}),e.jsx(g,{control:t.control,name:"remarks",render:({field:r})=>e.jsxs(j,{children:[e.jsx(p,{children:"备注"}),e.jsx(y,{children:e.jsx(bs,{className:"h-24",value:r.value||"",onChange:i=>r.onChange(i.currentTarget.value??null),placeholder:"请在这里记录"})}),e.jsx(k,{})]})}),e.jsxs(Wr,{children:[e.jsx(T,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(T,{type:"submit",onClick:()=>{t.handleSubmit(r=>{pd(r).then(({data:i})=>{i&&(A.success("修改成功"),n(!1),s())})})()},children:"提交"})]})]})}function Qr({refetch:s,defaultValues:t,dialogTrigger:a=e.jsxs(T,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(it,{className:"mr-2 h-4 w-4"}),"编辑用户信息"]})}){const[n,l]=c.useState(!1);return e.jsx(Mm,{defaultValues:t,open:n,onOpenChange:l,children:e.jsxs(Br,{open:n,onOpenChange:l,children:[e.jsx(Gr,{asChild:!0,children:a}),e.jsxs(ja,{className:"max-w-[90%] space-y-4",children:[e.jsxs(ga,{children:[e.jsx(fa,{children:"用户管理"}),e.jsx(pa,{})]}),e.jsx(Om,{refetch:s})]})]})})}const Zr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m17.71 11.29l-5-5a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21l-5 5a1 1 0 0 0 1.42 1.42L11 9.41V17a1 1 0 0 0 2 0V9.41l3.29 3.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42"})}),Xr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.71 11.29a1 1 0 0 0-1.42 0L13 14.59V7a1 1 0 0 0-2 0v7.59l-3.29-3.3a1 1 0 0 0-1.42 1.42l5 5a1 1 0 0 0 .33.21a.94.94 0 0 0 .76 0a1 1 0 0 0 .33-.21l5-5a1 1 0 0 0 0-1.42"})}),Lm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17 11H9.41l3.3-3.29a1 1 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33a1 1 0 0 0 0 .76a1 1 0 0 0 .21.33l5 5a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42L9.41 13H17a1 1 0 0 0 0-2"})}),$m=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.92 11.62a1 1 0 0 0-.21-.33l-5-5a1 1 0 0 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l5-5a1 1 0 0 0 .21-.33a1 1 0 0 0 0-.76"})}),$t=[{accessorKey:"record_at",header:"时间",cell:({row:s})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("time",{className:"text-sm text-muted-foreground",children:Qo(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Zr,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:Ye(s.original.u)})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xr,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:Ye(s.original.d)})]})},{accessorKey:"server_rate",header:"倍率",cell:({row:s})=>{const t=s.original.server_rate;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(L,{variant:"outline",className:"font-mono",children:[t,"x"]})})}},{id:"total",header:"总计",cell:({row:s})=>{const t=(s.original.u+s.original.d)*s.original.server_rate;return e.jsx("div",{className:"flex items-center justify-end font-mono text-sm",children:Ye(t)})}}];function el({user_id:s,dialogTrigger:t}){const[a,n]=c.useState(!1),[l,o]=c.useState({pageIndex:0,pageSize:20}),{data:d,isLoading:x}=Q({queryKey:["userStats",s,l,a],queryFn:()=>a?yd({user_id:s,pageSize:l.pageSize,page:l.pageIndex+1}):null}),r=Me({data:d?.data??[],columns:$t,pageCount:Math.ceil((d?.total??0)/l.pageSize),state:{pagination:l},manualPagination:!0,getCoreRowModel:ze(),onPaginationChange:o});return e.jsxs(ue,{open:a,onOpenChange:n,children:[e.jsx(Ie,{asChild:!0,children:t}),e.jsxs(ce,{className:"sm:max-w-[700px]",children:[e.jsx(he,{children:e.jsx(xe,{children:"流量使用记录"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(ca,{children:[e.jsx(da,{children:r.getHeaderGroups().map(i=>e.jsx(js,{children:i.headers.map(h=>e.jsx(xa,{className:v("h-10 px-2 text-xs",h.id==="total"&&"text-right"),children:h.isPlaceholder?null:vt(h.column.columnDef.header,h.getContext())},h.id))},i.id))}),e.jsx(ua,{children:x?Array.from({length:l.pageSize}).map((i,h)=>e.jsx(js,{children:Array.from({length:$t.length}).map((D,C)=>e.jsx(Ls,{className:"p-2",children:e.jsx(Ee,{className:"h-6 w-full"})},C))},h)):r.getRowModel().rows?.length?r.getRowModel().rows.map(i=>e.jsx(js,{"data-state":i.getIsSelected()&&"selected",className:"h-10",children:i.getVisibleCells().map(h=>e.jsx(Ls,{className:"px-2",children:vt(h.column.columnDef.cell,h.getContext())},h.id))},i.id)):e.jsx(js,{children:e.jsx(Ls,{colSpan:$t.length,className:"h-24 text-center",children:"暂无记录"})})})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"每页显示"}),e.jsxs(G,{value:`${r.getState().pagination.pageSize}`,onValueChange:i=>{r.setPageSize(Number(i))},children:[e.jsx(U,{className:"h-8 w-[70px]",children:e.jsx(Y,{placeholder:r.getState().pagination.pageSize})}),e.jsx(B,{side:"top",children:[10,20,30,40,50].map(i=>e.jsx(O,{value:`${i}`,children:i},i))})]}),e.jsx("p",{className:"text-sm font-medium",children:"条记录"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm",children:["第 ",r.getState().pagination.pageIndex+1," /"," ",r.getPageCount()," 页"]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r.previousPage(),disabled:!r.getCanPreviousPage()||x,children:e.jsx(Lm,{className:"h-4 w-4"})}),e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r.nextPage(),disabled:!r.getCanNextPage()||x,children:e.jsx($m,{className:"h-4 w-4"})})]})]})]})]})]})]})}const Am=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M5 18h4.24a1 1 0 0 0 .71-.29l6.92-6.93L19.71 8a1 1 0 0 0 0-1.42l-4.24-4.29a1 1 0 0 0-1.42 0l-2.82 2.83l-6.94 6.93a1 1 0 0 0-.29.71V17a1 1 0 0 0 1 1m9.76-13.59l2.83 2.83l-1.42 1.42l-2.83-2.83ZM6 13.17l5.93-5.93l2.83 2.83L8.83 16H6ZM21 20H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2"})}),Hm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11h-6V5a1 1 0 0 0-2 0v6H5a1 1 0 0 0 0 2h6v6a1 1 0 0 0 2 0v-6h6a1 1 0 0 0 0-2"})}),Km=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 8.94a1.3 1.3 0 0 0-.06-.27v-.09a1 1 0 0 0-.19-.28l-6-6a1 1 0 0 0-.28-.19a.3.3 0 0 0-.09 0a.9.9 0 0 0-.33-.11H10a3 3 0 0 0-3 3v1H6a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-1h1a3 3 0 0 0 3-3zm-6-3.53L17.59 8H16a1 1 0 0 1-1-1ZM15 19a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h1v7a3 3 0 0 0 3 3h5Zm4-4a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3v3a3 3 0 0 0 3 3h3Z"})}),qm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 11a1 1 0 0 0-1 1a8.05 8.05 0 1 1-2.22-5.5h-2.4a1 1 0 0 0 0 2h4.53a1 1 0 0 0 1-1V3a1 1 0 0 0-2 0v1.77A10 10 0 1 0 22 12a1 1 0 0 0-1-1"})}),Um=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9.5 10.5H12a1 1 0 0 0 0-2h-1V8a1 1 0 0 0-2 0v.55a2.5 2.5 0 0 0 .5 4.95h1a.5.5 0 0 1 0 1H8a1 1 0 0 0 0 2h1v.5a1 1 0 0 0 2 0v-.55a2.5 2.5 0 0 0-.5-4.95h-1a.5.5 0 0 1 0-1M21 12h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Z"})}),Bm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12.3 12.22A4.92 4.92 0 0 0 14 8.5a5 5 0 0 0-10 0a4.92 4.92 0 0 0 1.7 3.72A8 8 0 0 0 1 19.5a1 1 0 0 0 2 0a6 6 0 0 1 12 0a1 1 0 0 0 2 0a8 8 0 0 0-4.7-7.28M9 11.5a3 3 0 1 1 3-3a3 3 0 0 1-3 3m9.74.32A5 5 0 0 0 15 3.5a1 1 0 0 0 0 2a3 3 0 0 1 3 3a3 3 0 0 1-1.5 2.59a1 1 0 0 0-.5.84a1 1 0 0 0 .45.86l.39.26l.13.07a7 7 0 0 1 4 6.38a1 1 0 0 0 2 0a9 9 0 0 0-4.23-7.68"})}),Gm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 0 0-6.88 2.77V3a1 1 0 0 0-2 0v4.5a1 1 0 0 0 1 1h4.5a1 1 0 0 0 0-2h-2.4A8 8 0 1 1 4 12a1 1 0 0 0-2 0A10 10 0 1 0 12 2m0 6a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h2a1 1 0 0 0 0-2h-1V9a1 1 0 0 0-1-1"})}),Ym=(s,t)=>[{accessorKey:"is_admin",header:({column:a})=>e.jsx(V,{column:a,title:"管理员"}),enableSorting:!1,enableHiding:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n)),size:0},{accessorKey:"is_staff",header:({column:a})=>e.jsx(V,{column:a,title:"员工"}),enableSorting:!1,enableHiding:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n)),size:0},{accessorKey:"id",header:({column:a})=>e.jsx(V,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(L,{variant:"outline",children:a.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:a})=>e.jsx(V,{column:a,title:"邮箱"}),cell:({row:a})=>{const n=a.original.t||0,l=Date.now()/1e3-n<120,o=Math.floor(Date.now()/1e3-n);let d=l?"当前在线":n===0?"从未在线":`最后在线时间: ${re(n)}`;if(!l&&n!==0){const x=Math.floor(o/60),r=Math.floor(x/60),i=Math.floor(r/24);i>0?d+=` 离线时长: ${i}天`:r>0?d+=` 离线时长: ${r}小时`:x>0?d+=` 离线时长: ${x}分钟`:d+=` -离线时长: ${o}秒`}return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{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",l?"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:a.original.email})]})}),e.jsx(ee,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:d})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:a})=>e.jsx(I,{column:a,title:"在线设备"}),cell:({row:a})=>{const n=a.original.device_limit,l=a.original.online_count||0;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(L,{variant:"outline",className:y("min-w-[4rem] justify-center",n!==null&&l>=n?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[l," / ",n===null?"∞":n]})})}),e.jsx(ee,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:n===null?"无设备数限制":`最多可同时在线 ${n} 台设备`})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:a})=>e.jsx(I,{column:a,title:"状态"}),cell:({row:a})=>{const n=a.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(L,{className:y("min-w-20 justify-center transition-colors",n?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:Md[n]})})},enableSorting:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n))},{accessorKey:"plan_id",header:({column:a})=>e.jsx(I,{column:a,title:"订阅"}),cell:({row:a})=>e.jsx("div",{className:"min-w-[10em] break-all",children:a.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:a})=>e.jsx(I,{column:a,title:"权限组"}),cell:({row:a})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(L,{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:a.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:a})=>e.jsx(I,{column:a,title:"已用流量"}),cell:({row:a})=>{const n=zs(a.original?.total_used),l=zs(a.original?.transfer_enable),o=a.original?.total_used/a.original?.transfer_enable*100||0;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{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:n}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.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",o>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(o,100)}%`}})})]})}),e.jsx(ee,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:["总流量配额: ",l]})})]})})}},{accessorKey:"transfer_enable",header:({column:a})=>e.jsx(I,{column:a,title:"总流量"}),cell:({row:a})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:zs(a.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:a})=>e.jsx(I,{column:a,title:"到期时间"}),cell:({row:a})=>{const n=a.original.expired_at,l=Date.now()/1e3,o=n!=null&&ne.jsx(I,{column:a,title:"余额"}),cell:({row:a})=>{const n=Fs(a.original?.balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:n})]})}},{accessorKey:"commission_balance",header:({column:a})=>e.jsx(I,{column:a,title:"佣金"}),cell:({row:a})=>{const n=Fs(a.original?.commission_balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:n})]})}},{accessorKey:"created_at",header:({column:a})=>e.jsx(I,{column:a,title:"注册时间"}),cell:({row:a})=>e.jsx("div",{className:"truncate",children:re(a.original?.created_at)}),size:1e3},{id:"actions",header:({column:a})=>e.jsx(I,{column:a,className:"justify-end",title:"操作"}),cell:({row:a,table:n})=>e.jsxs(Ns,{modal:!0,children:[e.jsx(ws,{asChild:!0,children:e.jsx("div",{className:"text-center",children:e.jsx(W,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":"打开操作菜单",children:e.jsx(bt,{className:"size-4"})})})}),e.jsxs(gs,{align:"end",className:"min-w-[40px]",children:[e.jsx(he,{onSelect:l=>{l.preventDefault()},className:"p-0",children:e.jsx(Xr,{defaultValues:{...a.original,invite_user_email:a.original.invite_user?.email},refetch:s,dialogTrigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Hm,{className:"mr-2"}),"编辑"]})})}),e.jsx(he,{onSelect:l=>l.preventDefault(),className:"p-0",children:e.jsx(Ur,{defaultValues:{email:a.original.email},trigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Km,{className:"mr-2 "}),"分配订单"]})})}),e.jsx(he,{onSelect:()=>{Nt(a.original.subscribe_url)},className:"p-0",children:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(qm,{className:"mr-2"}),"复制订阅URL"]})}),e.jsx(he,{onSelect:()=>{bd({id:a.original.id}).then(({data:l})=>{l&&A.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Um,{className:"mr-2 "}),"重置UUID及订阅URL"]})}),e.jsx(he,{onSelect:()=>{},className:"p-0",children:e.jsxs(Ss,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=${a.original?.id}`,children:[e.jsx(Bm,{className:"mr-2"}),"TA的订单"]})}),e.jsx(he,{onSelect:()=>{n.setColumnFilters([{id:"invite_user_id",value:a.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Gm,{className:"mr-2 "}),"TA的邀请"]})}),e.jsx(he,{onSelect:l=>l.preventDefault(),className:"p-0",children:e.jsx(tl,{user_id:a.original?.id,dialogTrigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Ym,{className:"mr-2 "}),"TA的流量记录"]})})})]})]})}];function Jm(){const[s]=Un(),[t,a]=c.useState({}),[n,l]=c.useState({is_admin:!1,is_staff:!1}),[o,d]=c.useState([]),[x,r]=c.useState([]),[i,h]=c.useState({pageIndex:0,pageSize:20});c.useEffect(()=>{const z=s.get("email");z&&d($=>$.some(K=>K.id==="email")?$:[...$,{id:"email",value:z}])},[s]);const{refetch:T,data:C,isLoading:m}=Q({queryKey:["userList",i,o,x],queryFn:()=>pd({pageSize:i.pageSize,current:i.pageIndex+1,filter:o,sort:x})}),[w,_]=c.useState([]),[v,N]=c.useState([]);c.useEffect(()=>{Vt().then(({data:z})=>{_(z)}),Ps().then(({data:z})=>{N(z)})},[]);const P=w.map(z=>({label:z.name,value:z.id})),f=v.map(z=>({label:z.name,value:z.id})),R=Le({data:C?.data??[],columns:Wm(T),state:{sorting:x,columnVisibility:n,rowSelection:t,columnFilters:o,pagination:i},rowCount:C?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:r,onColumnFiltersChange:d,onColumnVisibilityChange:l,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),onPaginationChange:h,getSortedRowModel:Ue(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnVisibility:{commission_balance:!1,created_at:!1,is_admin:!1,is_staff:!1,permission_group:!1,plan_id:!1},columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:R,toolbar:e.jsx(Fm,{table:R,refetch:T,serverGroupList:w,permissionGroups:P,subscriptionPlans:f})})}function Qm(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"用户管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以管理用户,包括增加、删除、编辑、查询等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx("div",{className:"w-full",children:e.jsx(Jm,{})})})]})]})}const Zm=Object.freeze(Object.defineProperty({__proto__:null,default:Qm},Symbol.toStringTag,{value:"Module"}));function Xm({column:s,title:t,options:a}){const n=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(W,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(No,{className:"mr-2 h-4 w-4"}),t,n?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:n.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:n.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[n.size," selected"]}):a.filter(l=>n.has(l.value)).map(l=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:l.label},`selected-${l.value}`))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(fs,{children:[e.jsx(Ds,{placeholder:t}),e.jsxs(ps,{children:[e.jsx(Ts,{children:"No results found."}),e.jsx(Ve,{children:a.map(l=>{const o=n.has(l.value);return e.jsxs(be,{onSelect:()=>{o?n.delete(l.value):n.add(l.value);const d=Array.from(n);s?.setFilterValue(d.length?d:void 0)},children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",o?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(wo,{className:y("h-4 w-4")})}),l.icon&&e.jsx(l.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:l.label})]},`option-${l.value}`)})}),n.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(As,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const eh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function sh({table:s}){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-4",children:[e.jsx(vr,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(ra,{className:"grid w-full grid-cols-2",children:[e.jsx(et,{value:"0",children:"已开始"}),e.jsx(et,{value:"1",children:"已关闭"})]})}),s.getColumn("level")&&e.jsx(Xm,{column:s.getColumn("level"),title:"优先级",options:[{label:Js[ss.LOW],value:ss.LOW,icon:eh,color:"gray"},{label:Js[ss.MEDIUM],value:ss.MEDIUM,icon:el,color:"yellow"},{label:Js[ss.HIGH],value:ss.HIGH,icon:sl,color:"red"}]})]})})}function th(){return e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[e.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}const ah=_s("flex gap-2 max-w-[60%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),al=c.forwardRef(({className:s,variant:t,layout:a,children:n,...l},o)=>e.jsx("div",{className:y(ah({variant:t,layout:a,className:s}),"relative group"),ref:o,...l,children:c.Children.map(n,d=>c.isValidElement(d)&&typeof d.type!="string"?c.cloneElement(d,{variant:t,layout:a}):d)}));al.displayName="ChatBubble";const nh=_s("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-r-lg rounded-tl-lg",sent:"bg-primary text-primary-foreground rounded-l-lg rounded-tr-lg"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),nl=c.forwardRef(({className:s,variant:t,layout:a,isLoading:n=!1,children:l,...o},d)=>e.jsx("div",{className:y(nh({variant:t,layout:a,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:d,...o,children:n?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(th,{})}):l}));nl.displayName="ChatBubbleMessage";const rh=c.forwardRef(({variant:s,className:t,children:a,...n},l)=>e.jsx("div",{ref:l,className:y("absolute top-1/2 -translate-y-1/2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200",s==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",t),...n,children:a}));rh.displayName="ChatBubbleActionWrapper";const rl=c.forwardRef(({className:s,...t},a)=>e.jsx(vs,{autoComplete:"off",ref:a,name:"message",className:y("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",s),...t}));rl.displayName="ChatInput";const ll=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29l-4.3 4.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l4.29-4.3l4.29 4.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42Z"})}),il=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.098 12.634L13 11.423V7a1 1 0 0 0-2 0v5a1 1 0 0 0 .5.866l2.598 1.5a1 1 0 1 0 1-1.732M12 2a10 10 0 1 0 10 10A10.01 10.01 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8.01 8.01 0 0 1-8 8"})}),lh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M3.71 16.29a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21a1 1 0 0 0-.21.33a1 1 0 0 0 .21 1.09a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1 1 0 0 0 .21-1.09a1 1 0 0 0-.21-.33M7 8h14a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m-3.29 3.29a1 1 0 0 0-1.09-.21a1.2 1.2 0 0 0-.33.21a1 1 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1 1 0 0 0-.21-.33M21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2M3.71 6.29a1 1 0 0 0-.33-.21a1 1 0 0 0-1.09.21a1.2 1.2 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a1 1 0 0 0 1.09-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1.2 1.2 0 0 0-.21-.33M21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})}),ih=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9 12H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m-1-2h4a1 1 0 0 0 0-2H8a1 1 0 0 0 0 2m1 6H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m12-4h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Zm-6.44-2.83a.8.8 0 0 0-.18-.09a.6.6 0 0 0-.19-.06a1 1 0 0 0-.9.27A1.05 1.05 0 0 0 12 17a1 1 0 0 0 .07.38a1.2 1.2 0 0 0 .22.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21A1 1 0 0 0 14 17a1.05 1.05 0 0 0-.29-.71a2 2 0 0 0-.15-.12m.14-3.88a1 1 0 0 0-1.62.33A1 1 0 0 0 13 14a1 1 0 0 0 1-1a1 1 0 0 0-.08-.38a.9.9 0 0 0-.22-.33"})});function oh(){return e.jsxs("div",{className:"flex h-full flex-col space-y-4 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{className:"h-8 w-3/4"}),e.jsx(Fe,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(Fe,{className:"h-20 w-2/3"},s))})]})}function ch({ticketId:s,dialogTrigger:t}){const a=ns(),n=c.useRef(null),[l,o]=c.useState(!1),[d,x]=c.useState(""),[r,i]=c.useState(!1),{data:h,refetch:T,isLoading:C}=Q({queryKey:["ticket",s,l],queryFn:()=>l?wd(s):Promise.resolve(null),refetchInterval:l?5e3:!1,retry:3}),m=h?.data,w=(f="smooth")=>{if(n.current){const{scrollHeight:R,clientHeight:z}=n.current;n.current.scrollTo({top:R-z,behavior:f})}};c.useEffect(()=>{if(!l)return;const f=requestAnimationFrame(()=>{w("instant"),setTimeout(()=>w(),1e3)});return()=>{cancelAnimationFrame(f)}},[l,m?.messages]);const _=async()=>{const f=d.trim();!f||r||(i(!0),_d({id:s,message:f}).then(()=>{x(""),T(),w()}).finally(()=>{i(!1)}))},v=async()=>{pr(s).then(()=>{A.success("工单已关闭"),T()})},N=()=>{m?.user&&a("/finance/order?user_id="+m.user.id)},P=m?.status===Ms.CLOSED;return e.jsxs(ue,{open:l,onOpenChange:o,children:[e.jsx(Re,{asChild:!0,children:t??e.jsx(W,{variant:"outline",children:"查看工单"})}),e.jsxs(ce,{className:"flex h-[90vh] max-w-4xl flex-col gap-0 p-0",children:[e.jsx(xe,{}),C?e.jsx(oh,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col space-y-4 border-b p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:m?.subject}),e.jsx(L,{variant:P?"secondary":"default",children:P?"已关闭":"处理中"}),!P&&e.jsx(Ye,{title:"确认关闭工单",description:"关闭后将无法继续回复,是否确认关闭该工单?",confirmText:"关闭工单",variant:"destructive",onConfirm:v,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(ll,{className:"h-4 w-4"}),"关闭工单"]})})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{children:m?.user?.email})]}),e.jsx(ge,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(il,{className:"h-4 w-4"}),e.jsxs("span",{children:["创建于 ",re(m?.created_at)]})]}),e.jsx(ge,{orientation:"vertical",className:"h-4"}),e.jsx(L,{variant:"outline",children:m?.level!=null&&Js[m.level]})]})]}),m?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(Xr,{defaultValues:m.user,refetch:T,dialogTrigger:e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"用户信息",children:e.jsx(nt,{className:"h-4 w-4"})})}),e.jsx(tl,{user_id:m.user.id,dialogTrigger:e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"流量记录",children:e.jsx(lh,{className:"h-4 w-4"})})}),e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"订单记录",onClick:N,children:e.jsx(ih,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:n,className:"h-full space-y-4 overflow-y-auto p-6",children:m?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"暂无消息记录"}):m?.messages?.map(f=>e.jsx(al,{variant:f.is_me?"sent":"received",className:f.is_me?"ml-auto":"mr-auto",children:e.jsx(nl,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:f.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:re(f.created_at)})})]})})},f.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(rl,{disabled:P||r,placeholder:P?"工单已关闭":"请输入回复内容...",className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:d,onChange:f=>x(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),_())}}),e.jsx(W,{disabled:P||r||!d.trim(),onClick:_,children:r?"发送中...":"发送"})]})})]})]})]})}const dh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 4H5a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3m-.41 2l-5.88 5.88a1 1 0 0 1-1.42 0L5.41 6ZM20 17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7.41l5.88 5.88a3 3 0 0 0 4.24 0L20 7.41Z"})}),uh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.92 11.6C19.9 6.91 16.1 4 12 4s-7.9 2.91-9.92 7.6a1 1 0 0 0 0 .8C4.1 17.09 7.9 20 12 20s7.9-2.91 9.92-7.6a1 1 0 0 0 0-.8M12 18c-3.17 0-6.17-2.29-7.9-6C5.83 8.29 8.83 6 12 6s6.17 2.29 7.9 6c-1.73 3.71-4.73 6-7.9 6m0-10a4 4 0 1 0 4 4a4 4 0 0 0-4-4m0 6a2 2 0 1 1 2-2a2 2 0 0 1-2 2"})}),xh=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"工单号"}),cell:({row:t})=>e.jsx(L,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(I,{column:t,title:"主题"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(dh,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:t.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:t})=>e.jsx(I,{column:t,title:"优先级"}),cell:({row:t})=>{const a=t.getValue("level"),n=a===ss.LOW?"default":a===ss.MEDIUM?"secondary":"destructive";return e.jsx(L,{variant:n,className:"whitespace-nowrap",children:Js[a]})},filterFn:(t,a,n)=>n.includes(t.getValue(a))},{accessorKey:"status",header:({column:t})=>e.jsx(I,{column:t,title:"状态"}),cell:({row:t})=>{const a=t.getValue("status"),n=t.original.reply_status,l=a===Ms.CLOSED?zd[Ms.CLOSED]:n===0?"已回复":"待回复",o=a===Ms.CLOSED?"default":n===0?"secondary":"destructive";return e.jsx(L,{variant:o,className:"whitespace-nowrap",children:l})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(I,{column:t,title:"最后更新"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(il,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:re(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(I,{column:t,title:"创建时间"}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:re(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const a=t.original.status!==Ms.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(ch,{ticketId:t.original.id,dialogTrigger:e.jsx(W,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"查看详情",children:e.jsx(uh,{className:"h-4 w-4"})})}),a&&e.jsx(Ye,{title:"确认关闭工单",description:"关闭后将无法继续回复,是否确认关闭该工单?",confirmText:"关闭工单",variant:"destructive",onConfirm:async()=>{pr(t.original.id).then(()=>{A.success("工单已关闭"),s()})},children:e.jsx(W,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"关闭工单",children:e.jsx(ll,{className:"h-4 w-4"})})})]})}}];function mh(){const[s,t]=c.useState({}),[a,n]=c.useState({}),[l,o]=c.useState([{id:"status",value:"0"}]),[d,x]=c.useState([]),[r,i]=c.useState({pageIndex:0,pageSize:20}),{refetch:h,data:T,isLoading:C}=Q({queryKey:["orderList",r,l,d],queryFn:()=>fr({pageSize:r.pageSize,current:r.pageIndex+1,filter:l,sort:d})}),m=Le({data:T?.data??[],columns:xh(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:r},rowCount:T?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),onPaginationChange:i,getSortedRowModel:Ue(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(sh,{table:m,refetch:h}),e.jsx(Ge,{table:m,showPagination:!0})]})}function hh(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(De,{}),e.jsx(Te,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:" 工单管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以查看用户工单,包括查看、回复、关闭等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(mh,{})})]})]})}const jh=Object.freeze(Object.defineProperty({__proto__:null,default:hh},Symbol.toStringTag,{value:"Module"}));export{bh as a,ph as c,vh as g,yh as r}; +离线时长: ${o}秒`}return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:v("size-2.5 rounded-full ring-2 ring-offset-2",l?"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:a.original.email})]})}),e.jsx(ee,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:d})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:a})=>e.jsx(V,{column:a,title:"在线设备"}),cell:({row:a})=>{const n=a.original.device_limit,l=a.original.online_count||0;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(L,{variant:"outline",className:v("min-w-[4rem] justify-center",n!==null&&l>=n?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[l," / ",n===null?"∞":n]})})}),e.jsx(ee,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:n===null?"无设备数限制":`最多可同时在线 ${n} 台设备`})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:a})=>e.jsx(V,{column:a,title:"状态"}),cell:({row:a})=>{const n=a.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(L,{className:v("min-w-20 justify-center transition-colors",n?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:Od[n]})})},enableSorting:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n))},{accessorKey:"plan_id",header:({column:a})=>e.jsx(V,{column:a,title:"订阅"}),cell:({row:a})=>e.jsx("div",{className:"min-w-[10em] break-all",children:a.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:a})=>e.jsx(V,{column:a,title:"权限组"}),cell:({row:a})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(L,{variant:"outline",className:v("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:a.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:a})=>e.jsx(V,{column:a,title:"已用流量"}),cell:({row:a})=>{const n=Ye(a.original?.total_used),l=Ye(a.original?.transfer_enable),o=a.original?.total_used/a.original?.transfer_enable*100||0;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{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:n}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:v("h-full rounded-full transition-all",o>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(o,100)}%`}})})]})}),e.jsx(ee,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:["总流量配额: ",l]})})]})})}},{accessorKey:"transfer_enable",header:({column:a})=>e.jsx(V,{column:a,title:"总流量"}),cell:({row:a})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:Ye(a.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:a})=>e.jsx(V,{column:a,title:"到期时间"}),cell:({row:a})=>{const n=a.original.expired_at,l=Date.now()/1e3,o=n!=null&&ne.jsx(V,{column:a,title:"余额"}),cell:({row:a})=>{const n=zs(a.original?.balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:n})]})}},{accessorKey:"commission_balance",header:({column:a})=>e.jsx(V,{column:a,title:"佣金"}),cell:({row:a})=>{const n=zs(a.original?.commission_balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:n})]})}},{accessorKey:"created_at",header:({column:a})=>e.jsx(V,{column:a,title:"注册时间"}),cell:({row:a})=>e.jsx("div",{className:"truncate",children:re(a.original?.created_at)}),size:1e3},{id:"actions",header:({column:a})=>e.jsx(V,{column:a,className:"justify-end",title:"操作"}),cell:({row:a,table:n})=>e.jsxs(_s,{modal:!0,children:[e.jsx(Cs,{asChild:!0,children:e.jsx("div",{className:"text-center",children:e.jsx(W,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":"打开操作菜单",children:e.jsx(bt,{className:"size-4"})})})}),e.jsxs(fs,{align:"end",className:"min-w-[40px]",children:[e.jsx(me,{onSelect:l=>{l.preventDefault()},className:"p-0",children:e.jsx(Qr,{defaultValues:{...a.original,invite_user_email:a.original.invite_user?.email},refetch:s,dialogTrigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Am,{className:"mr-2"}),"编辑"]})})}),e.jsx(me,{onSelect:l=>l.preventDefault(),className:"p-0",children:e.jsx(Kr,{defaultValues:{email:a.original.email},trigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Hm,{className:"mr-2 "}),"分配订单"]})})}),e.jsx(me,{onSelect:()=>{Nt(a.original.subscribe_url)},className:"p-0",children:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Km,{className:"mr-2"}),"复制订阅URL"]})}),e.jsx(me,{onSelect:()=>{vd({id:a.original.id}).then(({data:l})=>{l&&A.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(qm,{className:"mr-2 "}),"重置UUID及订阅URL"]})}),e.jsx(me,{onSelect:()=>{},className:"p-0",children:e.jsxs(Ts,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=${a.original?.id}`,children:[e.jsx(Um,{className:"mr-2"}),"TA的订单"]})}),e.jsx(me,{onSelect:()=>{n.setColumnFilters([{id:"invite_user_id",value:a.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Bm,{className:"mr-2 "}),"TA的邀请"]})}),e.jsx(me,{onSelect:l=>l.preventDefault(),className:"p-0",children:e.jsx(el,{user_id:a.original?.id,dialogTrigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Gm,{className:"mr-2 "}),"TA的流量记录"]})})})]})]})}];function Wm(){const[s]=Un(),[t,a]=c.useState({}),[n,l]=c.useState({is_admin:!1,is_staff:!1}),[o,d]=c.useState([]),[x,r]=c.useState([]),[i,h]=c.useState({pageIndex:0,pageSize:20});c.useEffect(()=>{const z=s.get("email");z&&d($=>$.some(K=>K.id==="email")?$:[...$,{id:"email",value:z}])},[s]);const{refetch:D,data:C,isLoading:m}=Q({queryKey:["userList",i,o,x],queryFn:()=>fd({pageSize:i.pageSize,current:i.pageIndex+1,filter:o,sort:x})}),[w,_]=c.useState([]),[b,N]=c.useState([]);c.useEffect(()=>{It().then(({data:z})=>{_(z)}),Is().then(({data:z})=>{N(z)})},[]);const P=w.map(z=>({label:z.name,value:z.id})),f=b.map(z=>({label:z.name,value:z.id})),R=Me({data:C?.data??[],columns:Ym(D),state:{sorting:x,columnVisibility:n,rowSelection:t,columnFilters:o,pagination:i},rowCount:C?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:r,onColumnFiltersChange:d,onColumnVisibilityChange:l,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),onPaginationChange:h,getSortedRowModel:Ke(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnVisibility:{commission_balance:!1,created_at:!1,is_admin:!1,is_staff:!1,permission_group:!1,plan_id:!1},columnPinning:{right:["actions"]}}});return e.jsx(Ue,{table:R,toolbar:e.jsx(Em,{table:R,refetch:D,serverGroupList:w,permissionGroups:P,subscriptionPlans:f})})}function Jm(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"用户管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以管理用户,包括增加、删除、编辑、查询等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx("div",{className:"w-full",children:e.jsx(Wm,{})})})]})]})}const Qm=Object.freeze(Object.defineProperty({__proto__:null,default:Jm},Symbol.toStringTag,{value:"Module"}));function Zm({column:s,title:t,options:a}){const n=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(W,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(bo,{className:"mr-2 h-4 w-4"}),t,n?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(je,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:n.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:n.size>2?e.jsxs(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[n.size," selected"]}):a.filter(l=>n.has(l.value)).map(l=>e.jsx(L,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:l.label},`selected-${l.value}`))})]})]})}),e.jsx(qe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(ps,{children:[e.jsx(Ps,{placeholder:t}),e.jsxs(vs,{children:[e.jsx(Vs,{children:"No results found."}),e.jsx(Ve,{children:a.map(l=>{const o=n.has(l.value);return e.jsxs(be,{onSelect:()=>{o?n.delete(l.value):n.add(l.value);const d=Array.from(n);s?.setFilterValue(d.length?d:void 0)},children:[e.jsx("div",{className:v("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",o?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(yo,{className:v("h-4 w-4")})}),l.icon&&e.jsx(l.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:l.label})]},`option-${l.value}`)})}),n.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Hs,{}),e.jsx(Ve,{children:e.jsx(be,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Xm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function eh({table:s}){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-4",children:[e.jsx(fr,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(ia,{className:"grid w-full grid-cols-2",children:[e.jsx(st,{value:"0",children:"已开始"}),e.jsx(st,{value:"1",children:"已关闭"})]})}),s.getColumn("level")&&e.jsx(Zm,{column:s.getColumn("level"),title:"优先级",options:[{label:Qs[ss.LOW],value:ss.LOW,icon:Xm,color:"gray"},{label:Qs[ss.MEDIUM],value:ss.MEDIUM,icon:Zr,color:"yellow"},{label:Qs[ss.HIGH],value:ss.HIGH,icon:Xr,color:"red"}]})]})})}function sh(){return e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[e.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}const th=Ss("flex gap-2 max-w-[60%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),sl=c.forwardRef(({className:s,variant:t,layout:a,children:n,...l},o)=>e.jsx("div",{className:v(th({variant:t,layout:a,className:s}),"relative group"),ref:o,...l,children:c.Children.map(n,d=>c.isValidElement(d)&&typeof d.type!="string"?c.cloneElement(d,{variant:t,layout:a}):d)}));sl.displayName="ChatBubble";const ah=Ss("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-r-lg rounded-tl-lg",sent:"bg-primary text-primary-foreground rounded-l-lg rounded-tr-lg"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),tl=c.forwardRef(({className:s,variant:t,layout:a,isLoading:n=!1,children:l,...o},d)=>e.jsx("div",{className:v(ah({variant:t,layout:a,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:d,...o,children:n?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(sh,{})}):l}));tl.displayName="ChatBubbleMessage";const nh=c.forwardRef(({variant:s,className:t,children:a,...n},l)=>e.jsx("div",{ref:l,className:v("absolute top-1/2 -translate-y-1/2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200",s==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",t),...n,children:a}));nh.displayName="ChatBubbleActionWrapper";const al=c.forwardRef(({className:s,...t},a)=>e.jsx(bs,{autoComplete:"off",ref:a,name:"message",className:v("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",s),...t}));al.displayName="ChatInput";const nl=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29l-4.3 4.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l4.29-4.3l4.29 4.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42Z"})}),rl=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.098 12.634L13 11.423V7a1 1 0 0 0-2 0v5a1 1 0 0 0 .5.866l2.598 1.5a1 1 0 1 0 1-1.732M12 2a10 10 0 1 0 10 10A10.01 10.01 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8.01 8.01 0 0 1-8 8"})}),rh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M3.71 16.29a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21a1 1 0 0 0-.21.33a1 1 0 0 0 .21 1.09a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1 1 0 0 0 .21-1.09a1 1 0 0 0-.21-.33M7 8h14a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m-3.29 3.29a1 1 0 0 0-1.09-.21a1.2 1.2 0 0 0-.33.21a1 1 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1 1 0 0 0-.21-.33M21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2M3.71 6.29a1 1 0 0 0-.33-.21a1 1 0 0 0-1.09.21a1.2 1.2 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a1 1 0 0 0 1.09-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1.2 1.2 0 0 0-.21-.33M21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})}),lh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9 12H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m-1-2h4a1 1 0 0 0 0-2H8a1 1 0 0 0 0 2m1 6H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m12-4h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Zm-6.44-2.83a.8.8 0 0 0-.18-.09a.6.6 0 0 0-.19-.06a1 1 0 0 0-.9.27A1.05 1.05 0 0 0 12 17a1 1 0 0 0 .07.38a1.2 1.2 0 0 0 .22.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21A1 1 0 0 0 14 17a1.05 1.05 0 0 0-.29-.71a2 2 0 0 0-.15-.12m.14-3.88a1 1 0 0 0-1.62.33A1 1 0 0 0 13 14a1 1 0 0 0 1-1a1 1 0 0 0-.08-.38a.9.9 0 0 0-.22-.33"})});function ih(){return e.jsxs("div",{className:"flex h-full flex-col space-y-4 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{className:"h-8 w-3/4"}),e.jsx(Ee,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(Ee,{className:"h-20 w-2/3"},s))})]})}function oh({ticketId:s,dialogTrigger:t}){const a=ns(),n=c.useRef(null),[l,o]=c.useState(!1),[d,x]=c.useState(""),[r,i]=c.useState(!1),{data:h,refetch:D,isLoading:C}=Q({queryKey:["ticket",s,l],queryFn:()=>l?wd(s):Promise.resolve(null),refetchInterval:l?5e3:!1,retry:3}),m=h?.data,w=(f="smooth")=>{if(n.current){const{scrollHeight:R,clientHeight:z}=n.current;n.current.scrollTo({top:R-z,behavior:f})}};c.useEffect(()=>{if(!l)return;const f=requestAnimationFrame(()=>{w("instant"),setTimeout(()=>w(),1e3)});return()=>{cancelAnimationFrame(f)}},[l,m?.messages]);const _=async()=>{const f=d.trim();!f||r||(i(!0),_d({id:s,message:f}).then(()=>{x(""),D(),w()}).finally(()=>{i(!1)}))},b=async()=>{gr(s).then(()=>{A.success("工单已关闭"),D()})},N=()=>{m?.user&&a("/finance/order?user_id="+m.user.id)},P=m?.status===Os.CLOSED;return e.jsxs(ue,{open:l,onOpenChange:o,children:[e.jsx(Ie,{asChild:!0,children:t??e.jsx(W,{variant:"outline",children:"查看工单"})}),e.jsxs(ce,{className:"flex h-[90vh] max-w-4xl flex-col gap-0 p-0",children:[e.jsx(xe,{}),C?e.jsx(ih,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col space-y-4 border-b p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:m?.subject}),e.jsx(L,{variant:P?"secondary":"default",children:P?"已关闭":"处理中"}),!P&&e.jsx(Be,{title:"确认关闭工单",description:"关闭后将无法继续回复,是否确认关闭该工单?",confirmText:"关闭工单",variant:"destructive",onConfirm:b,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(nl,{className:"h-4 w-4"}),"关闭工单"]})})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(rt,{className:"h-4 w-4"}),e.jsx("span",{children:m?.user?.email})]}),e.jsx(je,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(rl,{className:"h-4 w-4"}),e.jsxs("span",{children:["创建于 ",re(m?.created_at)]})]}),e.jsx(je,{orientation:"vertical",className:"h-4"}),e.jsx(L,{variant:"outline",children:m?.level!=null&&Qs[m.level]})]})]}),m?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(Qr,{defaultValues:m.user,refetch:D,dialogTrigger:e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"用户信息",children:e.jsx(rt,{className:"h-4 w-4"})})}),e.jsx(el,{user_id:m.user.id,dialogTrigger:e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"流量记录",children:e.jsx(rh,{className:"h-4 w-4"})})}),e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"订单记录",onClick:N,children:e.jsx(lh,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:n,className:"h-full space-y-4 overflow-y-auto p-6",children:m?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"暂无消息记录"}):m?.messages?.map(f=>e.jsx(sl,{variant:f.is_me?"sent":"received",className:f.is_me?"ml-auto":"mr-auto",children:e.jsx(tl,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:f.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:re(f.created_at)})})]})})},f.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(al,{disabled:P||r,placeholder:P?"工单已关闭":"请输入回复内容...",className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:d,onChange:f=>x(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),_())}}),e.jsx(W,{disabled:P||r||!d.trim(),onClick:_,children:r?"发送中...":"发送"})]})})]})]})]})}const ch=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 4H5a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3m-.41 2l-5.88 5.88a1 1 0 0 1-1.42 0L5.41 6ZM20 17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7.41l5.88 5.88a3 3 0 0 0 4.24 0L20 7.41Z"})}),dh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.92 11.6C19.9 6.91 16.1 4 12 4s-7.9 2.91-9.92 7.6a1 1 0 0 0 0 .8C4.1 17.09 7.9 20 12 20s7.9-2.91 9.92-7.6a1 1 0 0 0 0-.8M12 18c-3.17 0-6.17-2.29-7.9-6C5.83 8.29 8.83 6 12 6s6.17 2.29 7.9 6c-1.73 3.71-4.73 6-7.9 6m0-10a4 4 0 1 0 4 4a4 4 0 0 0-4-4m0 6a2 2 0 1 1 2-2a2 2 0 0 1-2 2"})}),uh=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(V,{column:t,title:"工单号"}),cell:({row:t})=>e.jsx(L,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(V,{column:t,title:"主题"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ch,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:t.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:t})=>e.jsx(V,{column:t,title:"优先级"}),cell:({row:t})=>{const a=t.getValue("level"),n=a===ss.LOW?"default":a===ss.MEDIUM?"secondary":"destructive";return e.jsx(L,{variant:n,className:"whitespace-nowrap",children:Qs[a]})},filterFn:(t,a,n)=>n.includes(t.getValue(a))},{accessorKey:"status",header:({column:t})=>e.jsx(V,{column:t,title:"状态"}),cell:({row:t})=>{const a=t.getValue("status"),n=t.original.reply_status,l=a===Os.CLOSED?Ld[Os.CLOSED]:n===0?"已回复":"待回复",o=a===Os.CLOSED?"default":n===0?"secondary":"destructive";return e.jsx(L,{variant:o,className:"whitespace-nowrap",children:l})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(V,{column:t,title:"最后更新"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(rl,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:re(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(V,{column:t,title:"创建时间"}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:re(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(V,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const a=t.original.status!==Os.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(oh,{ticketId:t.original.id,dialogTrigger:e.jsx(W,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"查看详情",children:e.jsx(dh,{className:"h-4 w-4"})})}),a&&e.jsx(Be,{title:"确认关闭工单",description:"关闭后将无法继续回复,是否确认关闭该工单?",confirmText:"关闭工单",variant:"destructive",onConfirm:async()=>{gr(t.original.id).then(()=>{A.success("工单已关闭"),s()})},children:e.jsx(W,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"关闭工单",children:e.jsx(nl,{className:"h-4 w-4"})})})]})}}];function xh(){const[s,t]=c.useState({}),[a,n]=c.useState({}),[l,o]=c.useState([{id:"status",value:"0"}]),[d,x]=c.useState([]),[r,i]=c.useState({pageIndex:0,pageSize:20}),{refetch:h,data:D,isLoading:C}=Q({queryKey:["orderList",r,l,d],queryFn:()=>Nd({pageSize:r.pageSize,current:r.pageIndex+1,filter:l,sort:d})}),m=Me({data:D?.data??[],columns:uh(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:r},rowCount:D?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:n,getCoreRowModel:ze(),getFilteredRowModel:Ae(),getPaginationRowModel:He(),onPaginationChange:i,getSortedRowModel:Ke(),getFacetedRowModel:ls(),getFacetedUniqueValues:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(eh,{table:m,refetch:h}),e.jsx(Ue,{table:m,showPagination:!0})]})}function mh(){return e.jsxs(ye,{children:[e.jsxs(Ne,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:" 工单管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以查看用户工单,包括查看、回复、关闭等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(xh,{})})]})]})}const hh=Object.freeze(Object.defineProperty({__proto__:null,default:mh},Symbol.toStringTag,{value:"Module"}));export{vh as a,fh as c,ph as g,bh as r}; diff --git a/public/assets/admin/assets/vendor.js b/public/assets/admin/assets/vendor.js index 09b14c8..a4f85f2 100644 --- a/public/assets/admin/assets/vendor.js +++ b/public/assets/admin/assets/vendor.js @@ -213,82 +213,82 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WGe=on("ArrowUpFromLine",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** + */const WGe=on("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VGe=on("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const VGe=on("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const HGe=on("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** + */const HGe=on("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qGe=on("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** + */const qGe=on("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const KGe=on("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** + */const KGe=on("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const GGe=on("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const GGe=on("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const YGe=on("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const YGe=on("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ZGe=on("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const ZGe=on("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XGe=on("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const XGe=on("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const QGe=on("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + */const QGe=on("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const JGe=on("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const JGe=on("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eYe=on("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const eYe=on("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tYe=on("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** + */const tYe=on("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nYe=on("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** + */const nYe=on("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rYe=on("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const rYe=on("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const iYe=on("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const iYe=on("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. @@ -545,4 +545,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `:">",o};Xh.prototype.renderInline=function(e,t,n){let r="";const i=this.rules;for(let o=0,a=e.length;o=0&&(r=this.attrs[n][1]),r};nu.prototype.attrJoin=function(t,n){const r=this.attrIndex(t);r<0?this.attrPush([t,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};function GG(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}GG.prototype.Token=nu;const HVe=/\r\n?|\n/g,qVe=/\0/g;function KVe(e){let t;t=e.src.replace(HVe,` `),t=t.replace(qVe,"�"),e.src=t}function GVe(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function YVe(e){const t=e.tokens;for(let n=0,r=t.length;n\s]/i.test(e)}function XVe(e){return/^<\/a\s*>/i.test(e)}function QVe(e){const t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n=0;a--){const u=i[a];if(u.type==="link_close"){for(a--;i[a].level!==u.level&&i[a].type!=="link_open";)a--;continue}if(u.type==="html_inline"&&(ZVe(u.content)&&o>0&&o--,XVe(u.content)&&o++),!(o>0)&&u.type==="text"&&e.md.linkify.test(u.content)){const s=u.content;let l=e.md.linkify.match(s);const c=[];let d=u.level,h=0;l.length>0&&l[0].index===0&&a>0&&i[a-1].type==="text_special"&&(l=l.slice(1));for(let v=0;vh){const E=new e.Token("text","",0);E.content=s.slice(h,w),E.level=d,c.push(E)}const x=new e.Token("link_open","a",1);x.attrs=[["href",m]],x.level=d++,x.markup="linkify",x.info="auto",c.push(x);const S=new e.Token("text","",0);S.content=b,S.level=d,c.push(S);const A=new e.Token("link_close","a",-1);A.level=--d,A.markup="linkify",A.info="auto",c.push(A),h=l[v].lastIndex}if(h=0;n--){const r=e[n];r.type==="text"&&!t&&(r.content=r.content.replace(eHe,nHe)),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function iHe(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&YG.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function oHe(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(JVe.test(e.tokens[t].content)&&rHe(e.tokens[t].children),YG.test(e.tokens[t].content)&&iHe(e.tokens[t].children))}const aHe=/['"]/,mI=/['"]/g,yI="’";function xy(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function uHe(e,t){let n;const r=[];for(let i=0;i=0&&!(r[n].level<=a);n--);if(r.length=n+1,o.type!=="text")continue;let u=o.content,s=0,l=u.length;e:for(;s=0)g=u.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n--)if(e[n].content){g=e[n].content.charCodeAt(e[n].content.length-1);break}let m=32;if(s=48&&g<=57&&(h=d=!1),d&&h&&(d=b,h=w),!d&&!h){v&&(o.content=xy(o.content,c.index,yI));continue}if(h)for(n=r.length-1;n>=0;n--){let A=r[n];if(r[n].level=0;t--)e.tokens[t].type!=="inline"||!aHe.test(e.tokens[t].content)||uHe(e.tokens[t].children,e)}function lHe(e){let t,n;const r=e.tokens,i=r.length;for(let o=0;o0&&this.level++,this.tokens.push(r),r};Ru.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]};Ru.prototype.skipEmptyLines=function(t){for(let n=this.lineMax;tn;)if(!Vn(this.src.charCodeAt(--t)))return t+1;return t};Ru.prototype.skipChars=function(t,n){for(let r=this.src.length;tr;)if(n!==this.src.charCodeAt(--t))return t+1;return t};Ru.prototype.getLines=function(t,n,r,i){if(t>=n)return"";const o=new Array(n-t);for(let a=0,u=t;ur?o[a]=new Array(s-r+1).join(" ")+this.src.slice(c,d):o[a]=this.src.slice(c,d)}return o.join("")};Ru.prototype.Token=nu;const cHe=65536;function h3(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function bI(e){const t=[],n=e.length;let r=0,i=e.charCodeAt(r),o=!1,a=0,u="";for(;rn)return!1;let i=t+1;if(e.sCount[i]=4)return!1;let o=e.bMarks[i]+e.tShift[i];if(o>=e.eMarks[i])return!1;const a=e.src.charCodeAt(o++);if(a!==124&&a!==45&&a!==58||o>=e.eMarks[i])return!1;const u=e.src.charCodeAt(o++);if(u!==124&&u!==45&&u!==58&&!Vn(u)||a===45&&Vn(u))return!1;for(;o=4)return!1;l=bI(s),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();const d=l.length;if(d===0||d!==c.length)return!1;if(r)return!0;const h=e.parentType;e.parentType="table";const v=e.md.block.ruler.getRules("blockquote"),g=e.push("table_open","table",1),m=[t,0];g.map=m;const b=e.push("thead_open","thead",1);b.map=[t,t+1];const w=e.push("tr_open","tr",1);w.map=[t,t+1];for(let A=0;A=4||(l=bI(s),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),S+=d-l.length,S>cHe))break;if(i===t+2){const C=e.push("tbody_open","tbody",1);C.map=x=[t+2,0]}const E=e.push("tr_open","tr",1);E.map=[i,i+1];for(let C=0;C=4){r++,i=r;continue}break}e.line=i;const o=e.push("code_block","code",0);return o.content=e.getLines(t,i,4+e.blkIndent,!1)+` -`,o.map=[t,e.line],!0}function hHe(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>o)return!1;const a=e.src.charCodeAt(i);if(a!==126&&a!==96)return!1;let u=i;i=e.skipChars(i,a);let s=i-u;if(s<3)return!1;const l=e.src.slice(u,i),c=e.src.slice(i,o);if(a===96&&c.indexOf(String.fromCharCode(a))>=0)return!1;if(r)return!0;let d=t,h=!1;for(;d++,!(d>=n||(i=u=e.bMarks[d]+e.tShift[d],o=e.eMarks[d],i=4)&&(i=e.skipChars(i,a),!(i-u=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;const u=[],s=[],l=[],c=[],d=e.md.block.ruler.getRules("blockquote"),h=e.parentType;e.parentType="blockquote";let v=!1,g;for(g=t;g=o)break;if(e.src.charCodeAt(i++)===62&&!S){let E=e.sCount[g]+1,C,T;e.src.charCodeAt(i)===32?(i++,E++,T=!1,C=!0):e.src.charCodeAt(i)===9?(C=!0,(e.bsCount[g]+E)%4===3?(i++,E++,T=!1):T=!0):C=!1;let M=E;for(u.push(e.bMarks[g]),e.bMarks[g]=i;i=o,s.push(e.bsCount[g]),e.bsCount[g]=e.sCount[g]+1+(C?1:0),l.push(e.sCount[g]),e.sCount[g]=M-E,c.push(e.tShift[g]),e.tShift[g]=i-e.bMarks[g];continue}if(v)break;let A=!1;for(let E=0,C=d.length;E";const w=[t,0];b.map=w,e.md.block.tokenize(e,t,g);const x=e.push("blockquote_close","blockquote",-1);x.markup=">",e.lineMax=a,e.parentType=h,w[1]=e.line;for(let S=0;S=4)return!1;let o=e.bMarks[t]+e.tShift[t];const a=e.src.charCodeAt(o++);if(a!==42&&a!==45&&a!==95)return!1;let u=1;for(;o=r)return-1;let o=e.src.charCodeAt(i++);if(o<48||o>57)return-1;for(;;){if(i>=r)return-1;if(o=e.src.charCodeAt(i++),o>=48&&o<=57){if(i-n>=10)return-1;continue}if(o===41||o===46)break;return-1}return i=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&e.sCount[s]=e.blkIndent&&(c=!0);let d,h,v;if((v=wI(e,s))>=0){if(d=!0,a=e.bMarks[s]+e.tShift[s],h=Number(e.src.slice(a,v-1)),c&&h!==1)return!1}else if((v=xI(e,s))>=0)d=!1;else return!1;if(c&&e.skipSpaces(v)>=e.eMarks[s])return!1;if(r)return!0;const g=e.src.charCodeAt(v-1),m=e.tokens.length;d?(u=e.push("ordered_list_open","ol",1),h!==1&&(u.attrs=[["start",h]])):u=e.push("bullet_list_open","ul",1);const b=[s,0];u.map=b,u.markup=String.fromCharCode(g);let w=!1;const x=e.md.block.ruler.getRules("list"),S=e.parentType;for(e.parentType="list";s=i?T=1:T=E-A,T>4&&(T=1);const M=A+T;u=e.push("list_item_open","li",1),u.markup=String.fromCharCode(g);const F=[s,0];u.map=F,d&&(u.info=e.src.slice(a,v-1));const U=e.tight,H=e.tShift[s],W=e.sCount[s],ie=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=M,e.tight=!0,e.tShift[s]=C-e.bMarks[s],e.sCount[s]=E,C>=i&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,s,n,!0),(!e.tight||w)&&(l=!1),w=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=ie,e.tShift[s]=H,e.sCount[s]=W,e.tight=U,u=e.push("list_item_close","li",-1),u.markup=String.fromCharCode(g),s=e.line,F[1]=s,s>=n||e.sCount[s]=4)break;let Z=!1;for(let G=0,K=x.length;G=4||e.src.charCodeAt(i)!==91)return!1;function u(x){const S=e.lineMax;if(x>=S||e.isEmpty(x))return null;let A=!1;if(e.sCount[x]-e.blkIndent>3&&(A=!0),e.sCount[x]<0&&(A=!0),!A){const T=e.md.block.ruler.getRules("reference"),M=e.parentType;e.parentType="reference";let F=!1;for(let U=0,H=T.length;U"u"&&(e.env.references={}),typeof e.env.references[w]>"u"&&(e.env.references[w]={title:b,href:d}),e.line=a),!0):!1}const bHe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xHe="[a-zA-Z_:][a-zA-Z0-9:._-]*",wHe="[^\"'=<>`\\x00-\\x20]+",_He="'[^']*'",SHe='"[^"]*"',CHe="(?:"+wHe+"|"+_He+"|"+SHe+")",EHe="(?:\\s+"+xHe+"(?:\\s*=\\s*"+CHe+")?)",ZG="<[A-Za-z][A-Za-z0-9\\-]*"+EHe+"*\\s*\\/?>",XG="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",AHe="",PHe="<[?][\\s\\S]*?[?]>",OHe="]*>",kHe="",THe=new RegExp("^(?:"+ZG+"|"+XG+"|"+AHe+"|"+PHe+"|"+OHe+"|"+kHe+")"),MHe=new RegExp("^(?:"+ZG+"|"+XG+")"),qf=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(MHe.source+"\\s*$"),/^$/,!1]];function RHe(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let a=e.src.slice(i,o),u=0;for(;u=4)return!1;let a=e.src.charCodeAt(i);if(a!==35||i>=o)return!1;let u=1;for(a=e.src.charCodeAt(++i);a===35&&i6||ii&&Vn(e.src.charCodeAt(s-1))&&(o=s),e.line=t+1;const l=e.push("heading_open","h"+String(u),1);l.markup="########".slice(0,u),l.map=[t,e.line];const c=e.push("inline","",0);c.content=e.src.slice(i,o).trim(),c.map=[t,e.line],c.children=[];const d=e.push("heading_close","h"+String(u),-1);return d.markup="########".slice(0,u),!0}function $He(e,t,n){const r=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const i=e.parentType;e.parentType="paragraph";let o=0,a,u=t+1;for(;u3)continue;if(e.sCount[u]>=e.blkIndent){let v=e.bMarks[u]+e.tShift[u];const g=e.eMarks[u];if(v=g))){o=a===61?1:2;break}}if(e.sCount[u]<0)continue;let h=!1;for(let v=0,g=r.length;v3||e.sCount[o]<0)continue;let l=!1;for(let c=0,d=r.length;c=n||e.sCount[a]=o){e.line=n;break}const s=e.line;let l=!1;for(let c=0;c=e.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");e.tight=!u,e.isEmpty(e.line-1)&&(u=!0),a=e.line,a0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};Ng.prototype.scanDelims=function(e,t){const n=this.posMax,r=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32;let o=e;for(;o0)return!1;const n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const i=e.pending.match(LHe);if(!i)return!1;const o=i[1],a=e.md.linkify.matchAtStart(e.src.slice(n-o.length));if(!a)return!1;let u=a.url;if(u.length<=o.length)return!1;u=u.replace(/\*+$/,"");const s=e.md.normalizeLink(u);if(!e.md.validateLink(s))return!1;if(!t){e.pending=e.pending.slice(0,-o.length);const l=e.push("link_open","a",1);l.attrs=[["href",s]],l.markup="linkify",l.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(u);const d=e.push("link_close","a",-1);d.markup="linkify",d.info="auto"}return e.pos+=u.length-o.length,!0}function BHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let o=r-1;for(;o>=1&&e.pending.charCodeAt(o-1)===32;)o--;e.pending=e.pending.slice(0,o),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(n++;n?@[]^_`{|}~-".split("").forEach(function(e){rO[e.charCodeAt(0)]=1});function zHe(e,t){let n=e.pos;const r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push("hardbreak","br",0),n++;n=55296&&i<=56319&&n+1=56320&&u<=57343&&(o+=e.src[n+1],n++)}const a="\\"+o;if(!t){const u=e.push("text_special","",0);i<256&&rO[i]!==0?u.content=o:u.content=a,u.markup=a,u.info="escape"}return e.pos=n+1,!0}function UHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;const i=n;n++;const o=e.posMax;for(;n=0;r--){const i=t[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const o=t[i.end],a=r>0&&t[r-1].end===i.end+1&&t[r-1].marker===i.marker&&t[r-1].token===i.token-1&&t[i.end+1].token===o.token+1,u=String.fromCharCode(i.marker),s=e.tokens[i.token];s.type=a?"strong_open":"em_open",s.tag=a?"strong":"em",s.nesting=1,s.markup=a?u+u:u,s.content="";const l=e.tokens[o.token];l.type=a?"strong_close":"em_close",l.tag=a?"strong":"em",l.nesting=-1,l.markup=a?u+u:u,l.content="",a&&(e.tokens[t[r-1].token].content="",e.tokens[t[i.end+1].token].content="",r--)}}function qHe(e){const t=e.tokens_meta,n=e.tokens_meta.length;SI(e,e.delimiters);for(let r=0;r=d)return!1;if(s=g,i=e.md.helpers.parseLinkDestination(e.src,g,e.posMax),i.ok){for(a=e.md.normalizeLink(i.str),e.md.validateLink(a)?g=i.pos:a="",s=g;g=d||e.src.charCodeAt(g)!==41)&&(l=!0),g++}if(l){if(typeof e.env.references>"u")return!1;if(g=0?r=e.src.slice(s,g++):g=v+1):g=v+1,r||(r=e.src.slice(h,v)),o=e.env.references[n2(r)],!o)return e.pos=c,!1;a=o.href,u=o.title}if(!t){e.pos=h,e.posMax=v;const m=e.push("link_open","a",1),b=[["href",a]];m.attrs=b,u&&b.push(["title",u]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=g,e.posMax=d,!0}function GHe(e,t){let n,r,i,o,a,u,s,l,c="";const d=e.pos,h=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const v=e.pos+2,g=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(g<0)return!1;if(o=g+1,o=h)return!1;for(l=o,u=e.md.helpers.parseLinkDestination(e.src,o,e.posMax),u.ok&&(c=e.md.normalizeLink(u.str),e.md.validateLink(c)?o=u.pos:c=""),l=o;o=h||e.src.charCodeAt(o)!==41)return e.pos=d,!1;o++}else{if(typeof e.env.references>"u")return!1;if(o=0?i=e.src.slice(l,o++):o=g+1):o=g+1,i||(i=e.src.slice(v,g)),a=e.env.references[n2(i)],!a)return e.pos=d,!1;c=a.href,s=a.title}if(!t){r=e.src.slice(v,g);const m=[];e.md.inline.parse(r,e.md,e.env,m);const b=e.push("image","img",0),w=[["src",c],["alt",""]];b.attrs=w,b.children=m,b.content=r,s&&w.push(["title",s])}return e.pos=o,e.posMax=h,!0}const YHe=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,ZHe=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function XHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;const r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;const a=e.src.charCodeAt(n);if(a===60)return!1;if(a===62)break}const o=e.src.slice(r+1,n);if(ZHe.test(o)){const a=e.md.normalizeLink(o);if(!e.md.validateLink(a))return!1;if(!t){const u=e.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(o);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}if(YHe.test(o)){const a=e.md.normalizeLink("mailto:"+o);if(!e.md.validateLink(a))return!1;if(!t){const u=e.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(o);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}return!1}function QHe(e){return/^\s]/i.test(e)}function JHe(e){return/^<\/a\s*>/i.test(e)}function eqe(e){const t=e|32;return t>=97&&t<=122}function tqe(e,t){if(!e.md.options.html)return!1;const n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!eqe(i))return!1;const o=e.src.slice(r).match(THe);if(!o)return!1;if(!t){const a=e.push("html_inline","",0);a.content=o[0],QHe(a.content)&&e.linkLevel++,JHe(a.content)&&e.linkLevel--}return e.pos+=o[0].length,!0}const nqe=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,rqe=/^&([a-z][a-z0-9]{1,31});/i;function iqe(e,t){const n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){const o=e.src.slice(n).match(nqe);if(o){if(!t){const a=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),u=e.push("text_special","",0);u.content=tO(a)?ox(a):ox(65533),u.markup=o[0],u.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(rqe);if(o){const a=HG(o[0]);if(a!==o[0]){if(!t){const u=e.push("text_special","",0);u.content=a,u.markup=o[0],u.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function CI(e){const t={},n=e.length;if(!n)return;let r=0,i=-2;const o=[];for(let a=0;as;l-=o[l]+1){const d=e[l];if(d.marker===u.marker&&d.open&&d.end<0){let h=!1;if((d.close||u.open)&&(d.length+u.length)%3===0&&(d.length%3!==0||u.length%3!==0)&&(h=!0),!h){const v=l>0&&!e[l-1].open?o[l-1]+1:0;o[a]=a-l+v,o[l]=v,u.open=!1,d.end=a,d.close=!1,c=-1,i=-2;break}}}c!==-1&&(t[u.marker][(u.open?3:0)+(u.length||0)%3]=c)}}function oqe(e){const t=e.tokens_meta,n=e.tokens_meta.length;CI(e.delimiters);for(let r=0;r0&&r++,i[t].type==="text"&&t+1=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;a||e.pos++,o[t]=e.pos};Fg.prototype.tokenize=function(e){const t=this.ruler.getRules(""),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(a){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};Fg.prototype.parse=function(e,t,n,r){const i=new this.State(e,t,n,r);this.tokenize(i);const o=this.ruler2.getRules(""),a=o.length;for(let u=0;u|$))",t.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function Q6(e){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){e[r]=n[r]})}),e}function i2(e){return Object.prototype.toString.call(e)}function sqe(e){return i2(e)==="[object String]"}function lqe(e){return i2(e)==="[object Object]"}function cqe(e){return i2(e)==="[object RegExp]"}function EI(e){return i2(e)==="[object Function]"}function fqe(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const eY={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function dqe(e){return Object.keys(e||{}).reduce(function(t,n){return t||eY.hasOwnProperty(n)},!1)}const hqe={"http:":{validate:function(e,t,n){const r=e.slice(t);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){const r=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){const r=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},pqe="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",vqe="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function gqe(e){e.__index__=-1,e.__text_cache__=""}function mqe(e){return function(t,n){const r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function AI(){return function(e,t){t.normalize(e)}}function ax(e){const t=e.re=uqe(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(pqe),n.push(t.src_xn),t.src_tlds=n.join("|");function r(u){return u.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");const i=[];e.__compiled__={};function o(u,s){throw new Error('(LinkifyIt) Invalid schema "'+u+'": '+s)}Object.keys(e.__schemas__).forEach(function(u){const s=e.__schemas__[u];if(s===null)return;const l={validate:null,link:null};if(e.__compiled__[u]=l,lqe(s)){cqe(s.validate)?l.validate=mqe(s.validate):EI(s.validate)?l.validate=s.validate:o(u,s),EI(s.normalize)?l.normalize=s.normalize:s.normalize?o(u,s):l.normalize=AI();return}if(sqe(s)){i.push(u);return}o(u,s)}),i.forEach(function(u){e.__compiled__[e.__schemas__[u]]&&(e.__compiled__[u].validate=e.__compiled__[e.__schemas__[u]].validate,e.__compiled__[u].normalize=e.__compiled__[e.__schemas__[u]].normalize)}),e.__compiled__[""]={validate:null,normalize:AI()};const a=Object.keys(e.__compiled__).filter(function(u){return u.length>0&&e.__compiled__[u]}).map(fqe).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+a+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+a+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),gqe(e)}function yqe(e,t){const n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function J6(e,t){const n=new yqe(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function Uo(e,t){if(!(this instanceof Uo))return new Uo(e,t);t||dqe(e)&&(t=e,e={}),this.__opts__=Q6({},eY,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Q6({},hqe,e),this.__compiled__={},this.__tlds__=vqe,this.__tlds_replaced__=!1,this.re={},ax(this)}Uo.prototype.add=function(t,n){return this.__schemas__[t]=n,ax(this),this};Uo.prototype.set=function(t){return this.__opts__=Q6(this.__opts__,t),this};Uo.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let n,r,i,o,a,u,s,l,c;if(this.re.schema_test.test(t)){for(s=this.re.schema_search,s.lastIndex=0;(n=s.exec(t))!==null;)if(o=this.testSchemaAt(t,n[2],s.lastIndex),o){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=t.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l=0&&(i=t.match(this.re.email_fuzzy))!==null&&(a=i.index+i[1].length,u=i.index+i[0].length,(this.__index__<0||athis.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=u))),this.__index__>=0};Uo.prototype.pretest=function(t){return this.re.pretest.test(t)};Uo.prototype.testSchemaAt=function(t,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(t,r,this):0};Uo.prototype.match=function(t){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===t&&(n.push(J6(this,r)),r=this.__last_index__);let i=r?t.slice(r):t;for(;this.test(i);)n.push(J6(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};Uo.prototype.matchAtStart=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return null;const n=this.re.schema_at_start.exec(t);if(!n)return null;const r=this.testSchemaAt(t,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,J6(this,0)):null};Uo.prototype.tlds=function(t,n){return t=Array.isArray(t)?t:[t],n?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(r,i,o){return r!==o[i-1]}).reverse(),ax(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,ax(this),this)};Uo.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};Uo.prototype.onCompile=function(){};const Md=2147483647,mu=36,iO=1,Xv=26,bqe=38,xqe=700,tY=72,nY=128,rY="-",wqe=/^xn--/,_qe=/[^\0-\x7F]/,Sqe=/[\x2E\u3002\uFF0E\uFF61]/g,Cqe={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g3=mu-iO,yu=Math.floor,m3=String.fromCharCode;function Ys(e){throw new RangeError(Cqe[e])}function Eqe(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function iY(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(Sqe,".");const i=e.split("."),o=Eqe(i,t).join(".");return r+o}function oY(e){const t=[];let n=0;const r=e.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...e),Pqe=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:mu},PI=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},aY=function(e,t,n){let r=0;for(e=n?yu(e/xqe):e>>1,e+=yu(e/t);e>g3*Xv>>1;r+=mu)e=yu(e/g3);return yu(r+(g3+1)*e/(e+bqe))},uY=function(e){const t=[],n=e.length;let r=0,i=nY,o=tY,a=e.lastIndexOf(rY);a<0&&(a=0);for(let u=0;u=128&&Ys("not-basic"),t.push(e.charCodeAt(u));for(let u=a>0?a+1:0;u=n&&Ys("invalid-input");const h=Pqe(e.charCodeAt(u++));h>=mu&&Ys("invalid-input"),h>yu((Md-r)/c)&&Ys("overflow"),r+=h*c;const v=d<=o?iO:d>=o+Xv?Xv:d-o;if(hyu(Md/g)&&Ys("overflow"),c*=g}const l=t.length+1;o=aY(r-s,l,s==0),yu(r/l)>Md-i&&Ys("overflow"),i+=yu(r/l),r%=l,t.splice(r++,0,i)}return String.fromCodePoint(...t)},sY=function(e){const t=[];e=oY(e);const n=e.length;let r=nY,i=0,o=tY;for(const s of e)s<128&&t.push(m3(s));const a=t.length;let u=a;for(a&&t.push(rY);u=r&&cyu((Md-i)/l)&&Ys("overflow"),i+=(s-r)*l,r=s;for(const c of e)if(cMd&&Ys("overflow"),c===r){let d=i;for(let h=mu;;h+=mu){const v=h<=o?iO:h>=o+Xv?Xv:h-o;if(d=0))try{t.hostname=lY.toASCII(t.hostname)}catch{}return Ig(XP(t))}function Lqe(e){const t=QP(e,!0);if(t.hostname&&(!t.protocol||cY.indexOf(t.protocol)>=0))try{t.hostname=lY.toUnicode(t.hostname)}catch{}return bh(XP(t),bh.defaultChars+"%")}function Qa(e,t){if(!(this instanceof Qa))return new Qa(e,t);t||eO(e)||(t=e||{},e="default"),this.inline=new Fg,this.block=new r2,this.core=new nO,this.renderer=new Xh,this.linkify=new Uo,this.validateLink=Nqe,this.normalizeLink=Fqe,this.normalizeLinkText=Lqe,this.utils=BVe,this.helpers=t2({},VVe),this.options={},this.configure(e),t&&this.set(t)}Qa.prototype.set=function(e){return t2(this.options,e),this};Qa.prototype.configure=function(e){const t=this;if(eO(e)){const n=e;if(e=Dqe[n],!e)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this};Qa.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));const r=e.filter(function(i){return n.indexOf(i)<0});if(r.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};Qa.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));const r=e.filter(function(i){return n.indexOf(i)<0});if(r.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};Qa.prototype.use=function(e){const t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this};Qa.prototype.parse=function(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const n=new this.core.State(e,this,t);return this.core.process(n),n.tokens};Qa.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)};Qa.prototype.parseInline=function(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens};Qa.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var fY={exports:{}};(function(e){(function(t){var n=function(k){var D,$=new Float64Array(16);if(k)for(D=0;D>24&255,k[D+1]=$>>16&255,k[D+2]=$>>8&255,k[D+3]=$&255,k[D+4]=P>>24&255,k[D+5]=P>>16&255,k[D+6]=P>>8&255,k[D+7]=P&255}function m(k,D,$,P,N){var ee,ne=0;for(ee=0;ee>>8)-1}function b(k,D,$,P){return m(k,D,$,P,16)}function w(k,D,$,P){return m(k,D,$,P,32)}function x(k,D,$,P){for(var N=P[0]&255|(P[1]&255)<<8|(P[2]&255)<<16|(P[3]&255)<<24,ee=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,ne=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,he=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,Ce=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,Be=P[4]&255|(P[5]&255)<<8|(P[6]&255)<<16|(P[7]&255)<<24,He=D[0]&255|(D[1]&255)<<8|(D[2]&255)<<16|(D[3]&255)<<24,ct=D[4]&255|(D[5]&255)<<8|(D[6]&255)<<16|(D[7]&255)<<24,Ne=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,rt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=P[8]&255|(P[9]&255)<<8|(P[10]&255)<<16|(P[11]&255)<<24,At=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,vt=$[20]&255|($[21]&255)<<8|($[22]&255)<<16|($[23]&255)<<24,ht=$[24]&255|($[25]&255)<<8|($[26]&255)<<16|($[27]&255)<<24,xt=$[28]&255|($[29]&255)<<8|($[30]&255)<<16|($[31]&255)<<24,wt=P[12]&255|(P[13]&255)<<8|(P[14]&255)<<16|(P[15]&255)<<24,Je=N,st=ee,Qe=ne,Le=he,qe=Ce,Ge=Be,me=He,ve=ct,De=Ne,Oe=rt,Te=bt,ze=At,mt=vt,Nt=ht,Ft=xt,$t=wt,te,Gt=0;Gt<20;Gt+=2)te=Je+mt|0,qe^=te<<7|te>>>25,te=qe+Je|0,De^=te<<9|te>>>23,te=De+qe|0,mt^=te<<13|te>>>19,te=mt+De|0,Je^=te<<18|te>>>14,te=Ge+st|0,Oe^=te<<7|te>>>25,te=Oe+Ge|0,Nt^=te<<9|te>>>23,te=Nt+Oe|0,st^=te<<13|te>>>19,te=st+Nt|0,Ge^=te<<18|te>>>14,te=Te+me|0,Ft^=te<<7|te>>>25,te=Ft+Te|0,Qe^=te<<9|te>>>23,te=Qe+Ft|0,me^=te<<13|te>>>19,te=me+Qe|0,Te^=te<<18|te>>>14,te=$t+ze|0,Le^=te<<7|te>>>25,te=Le+$t|0,ve^=te<<9|te>>>23,te=ve+Le|0,ze^=te<<13|te>>>19,te=ze+ve|0,$t^=te<<18|te>>>14,te=Je+Le|0,st^=te<<7|te>>>25,te=st+Je|0,Qe^=te<<9|te>>>23,te=Qe+st|0,Le^=te<<13|te>>>19,te=Le+Qe|0,Je^=te<<18|te>>>14,te=Ge+qe|0,me^=te<<7|te>>>25,te=me+Ge|0,ve^=te<<9|te>>>23,te=ve+me|0,qe^=te<<13|te>>>19,te=qe+ve|0,Ge^=te<<18|te>>>14,te=Te+Oe|0,ze^=te<<7|te>>>25,te=ze+Te|0,De^=te<<9|te>>>23,te=De+ze|0,Oe^=te<<13|te>>>19,te=Oe+De|0,Te^=te<<18|te>>>14,te=$t+Ft|0,mt^=te<<7|te>>>25,te=mt+$t|0,Nt^=te<<9|te>>>23,te=Nt+mt|0,Ft^=te<<13|te>>>19,te=Ft+Nt|0,$t^=te<<18|te>>>14;Je=Je+N|0,st=st+ee|0,Qe=Qe+ne|0,Le=Le+he|0,qe=qe+Ce|0,Ge=Ge+Be|0,me=me+He|0,ve=ve+ct|0,De=De+Ne|0,Oe=Oe+rt|0,Te=Te+bt|0,ze=ze+At|0,mt=mt+vt|0,Nt=Nt+ht|0,Ft=Ft+xt|0,$t=$t+wt|0,k[0]=Je>>>0&255,k[1]=Je>>>8&255,k[2]=Je>>>16&255,k[3]=Je>>>24&255,k[4]=st>>>0&255,k[5]=st>>>8&255,k[6]=st>>>16&255,k[7]=st>>>24&255,k[8]=Qe>>>0&255,k[9]=Qe>>>8&255,k[10]=Qe>>>16&255,k[11]=Qe>>>24&255,k[12]=Le>>>0&255,k[13]=Le>>>8&255,k[14]=Le>>>16&255,k[15]=Le>>>24&255,k[16]=qe>>>0&255,k[17]=qe>>>8&255,k[18]=qe>>>16&255,k[19]=qe>>>24&255,k[20]=Ge>>>0&255,k[21]=Ge>>>8&255,k[22]=Ge>>>16&255,k[23]=Ge>>>24&255,k[24]=me>>>0&255,k[25]=me>>>8&255,k[26]=me>>>16&255,k[27]=me>>>24&255,k[28]=ve>>>0&255,k[29]=ve>>>8&255,k[30]=ve>>>16&255,k[31]=ve>>>24&255,k[32]=De>>>0&255,k[33]=De>>>8&255,k[34]=De>>>16&255,k[35]=De>>>24&255,k[36]=Oe>>>0&255,k[37]=Oe>>>8&255,k[38]=Oe>>>16&255,k[39]=Oe>>>24&255,k[40]=Te>>>0&255,k[41]=Te>>>8&255,k[42]=Te>>>16&255,k[43]=Te>>>24&255,k[44]=ze>>>0&255,k[45]=ze>>>8&255,k[46]=ze>>>16&255,k[47]=ze>>>24&255,k[48]=mt>>>0&255,k[49]=mt>>>8&255,k[50]=mt>>>16&255,k[51]=mt>>>24&255,k[52]=Nt>>>0&255,k[53]=Nt>>>8&255,k[54]=Nt>>>16&255,k[55]=Nt>>>24&255,k[56]=Ft>>>0&255,k[57]=Ft>>>8&255,k[58]=Ft>>>16&255,k[59]=Ft>>>24&255,k[60]=$t>>>0&255,k[61]=$t>>>8&255,k[62]=$t>>>16&255,k[63]=$t>>>24&255}function S(k,D,$,P){for(var N=P[0]&255|(P[1]&255)<<8|(P[2]&255)<<16|(P[3]&255)<<24,ee=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,ne=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,he=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,Ce=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,Be=P[4]&255|(P[5]&255)<<8|(P[6]&255)<<16|(P[7]&255)<<24,He=D[0]&255|(D[1]&255)<<8|(D[2]&255)<<16|(D[3]&255)<<24,ct=D[4]&255|(D[5]&255)<<8|(D[6]&255)<<16|(D[7]&255)<<24,Ne=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,rt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=P[8]&255|(P[9]&255)<<8|(P[10]&255)<<16|(P[11]&255)<<24,At=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,vt=$[20]&255|($[21]&255)<<8|($[22]&255)<<16|($[23]&255)<<24,ht=$[24]&255|($[25]&255)<<8|($[26]&255)<<16|($[27]&255)<<24,xt=$[28]&255|($[29]&255)<<8|($[30]&255)<<16|($[31]&255)<<24,wt=P[12]&255|(P[13]&255)<<8|(P[14]&255)<<16|(P[15]&255)<<24,Je=N,st=ee,Qe=ne,Le=he,qe=Ce,Ge=Be,me=He,ve=ct,De=Ne,Oe=rt,Te=bt,ze=At,mt=vt,Nt=ht,Ft=xt,$t=wt,te,Gt=0;Gt<20;Gt+=2)te=Je+mt|0,qe^=te<<7|te>>>25,te=qe+Je|0,De^=te<<9|te>>>23,te=De+qe|0,mt^=te<<13|te>>>19,te=mt+De|0,Je^=te<<18|te>>>14,te=Ge+st|0,Oe^=te<<7|te>>>25,te=Oe+Ge|0,Nt^=te<<9|te>>>23,te=Nt+Oe|0,st^=te<<13|te>>>19,te=st+Nt|0,Ge^=te<<18|te>>>14,te=Te+me|0,Ft^=te<<7|te>>>25,te=Ft+Te|0,Qe^=te<<9|te>>>23,te=Qe+Ft|0,me^=te<<13|te>>>19,te=me+Qe|0,Te^=te<<18|te>>>14,te=$t+ze|0,Le^=te<<7|te>>>25,te=Le+$t|0,ve^=te<<9|te>>>23,te=ve+Le|0,ze^=te<<13|te>>>19,te=ze+ve|0,$t^=te<<18|te>>>14,te=Je+Le|0,st^=te<<7|te>>>25,te=st+Je|0,Qe^=te<<9|te>>>23,te=Qe+st|0,Le^=te<<13|te>>>19,te=Le+Qe|0,Je^=te<<18|te>>>14,te=Ge+qe|0,me^=te<<7|te>>>25,te=me+Ge|0,ve^=te<<9|te>>>23,te=ve+me|0,qe^=te<<13|te>>>19,te=qe+ve|0,Ge^=te<<18|te>>>14,te=Te+Oe|0,ze^=te<<7|te>>>25,te=ze+Te|0,De^=te<<9|te>>>23,te=De+ze|0,Oe^=te<<13|te>>>19,te=Oe+De|0,Te^=te<<18|te>>>14,te=$t+Ft|0,mt^=te<<7|te>>>25,te=mt+$t|0,Nt^=te<<9|te>>>23,te=Nt+mt|0,Ft^=te<<13|te>>>19,te=Ft+Nt|0,$t^=te<<18|te>>>14;k[0]=Je>>>0&255,k[1]=Je>>>8&255,k[2]=Je>>>16&255,k[3]=Je>>>24&255,k[4]=Ge>>>0&255,k[5]=Ge>>>8&255,k[6]=Ge>>>16&255,k[7]=Ge>>>24&255,k[8]=Te>>>0&255,k[9]=Te>>>8&255,k[10]=Te>>>16&255,k[11]=Te>>>24&255,k[12]=$t>>>0&255,k[13]=$t>>>8&255,k[14]=$t>>>16&255,k[15]=$t>>>24&255,k[16]=me>>>0&255,k[17]=me>>>8&255,k[18]=me>>>16&255,k[19]=me>>>24&255,k[20]=ve>>>0&255,k[21]=ve>>>8&255,k[22]=ve>>>16&255,k[23]=ve>>>24&255,k[24]=De>>>0&255,k[25]=De>>>8&255,k[26]=De>>>16&255,k[27]=De>>>24&255,k[28]=Oe>>>0&255,k[29]=Oe>>>8&255,k[30]=Oe>>>16&255,k[31]=Oe>>>24&255}function A(k,D,$,P){x(k,D,$,P)}function E(k,D,$,P){S(k,D,$,P)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T(k,D,$,P,N,ee,ne){var he=new Uint8Array(16),Ce=new Uint8Array(64),Be,He;for(He=0;He<16;He++)he[He]=0;for(He=0;He<8;He++)he[He]=ee[He];for(;N>=64;){for(A(Ce,he,ne,C),He=0;He<64;He++)k[D+He]=$[P+He]^Ce[He];for(Be=1,He=8;He<16;He++)Be=Be+(he[He]&255)|0,he[He]=Be&255,Be>>>=8;N-=64,D+=64,P+=64}if(N>0)for(A(Ce,he,ne,C),He=0;He=64;){for(A(ne,ee,N,C),Ce=0;Ce<64;Ce++)k[D+Ce]=ne[Ce];for(he=1,Ce=8;Ce<16;Ce++)he=he+(ee[Ce]&255)|0,ee[Ce]=he&255,he>>>=8;$-=64,D+=64}if($>0)for(A(ne,ee,N,C),Ce=0;Ce<$;Ce++)k[D+Ce]=ne[Ce];return 0}function F(k,D,$,P,N){var ee=new Uint8Array(32);E(ee,P,N,C);for(var ne=new Uint8Array(8),he=0;he<8;he++)ne[he]=P[he+16];return M(k,D,$,ne,ee)}function U(k,D,$,P,N,ee,ne){var he=new Uint8Array(32);E(he,ee,ne,C);for(var Ce=new Uint8Array(8),Be=0;Be<8;Be++)Ce[Be]=ee[Be+16];return T(k,D,$,P,N,Ce,he)}var H=function(k){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var D,$,P,N,ee,ne,he,Ce;D=k[0]&255|(k[1]&255)<<8,this.r[0]=D&8191,$=k[2]&255|(k[3]&255)<<8,this.r[1]=(D>>>13|$<<3)&8191,P=k[4]&255|(k[5]&255)<<8,this.r[2]=($>>>10|P<<6)&7939,N=k[6]&255|(k[7]&255)<<8,this.r[3]=(P>>>7|N<<9)&8191,ee=k[8]&255|(k[9]&255)<<8,this.r[4]=(N>>>4|ee<<12)&255,this.r[5]=ee>>>1&8190,ne=k[10]&255|(k[11]&255)<<8,this.r[6]=(ee>>>14|ne<<2)&8191,he=k[12]&255|(k[13]&255)<<8,this.r[7]=(ne>>>11|he<<5)&8065,Ce=k[14]&255|(k[15]&255)<<8,this.r[8]=(he>>>8|Ce<<8)&8191,this.r[9]=Ce>>>5&127,this.pad[0]=k[16]&255|(k[17]&255)<<8,this.pad[1]=k[18]&255|(k[19]&255)<<8,this.pad[2]=k[20]&255|(k[21]&255)<<8,this.pad[3]=k[22]&255|(k[23]&255)<<8,this.pad[4]=k[24]&255|(k[25]&255)<<8,this.pad[5]=k[26]&255|(k[27]&255)<<8,this.pad[6]=k[28]&255|(k[29]&255)<<8,this.pad[7]=k[30]&255|(k[31]&255)<<8};H.prototype.blocks=function(k,D,$){for(var P=this.fin?0:2048,N,ee,ne,he,Ce,Be,He,ct,Ne,rt,bt,At,vt,ht,xt,wt,Je,st,Qe,Le=this.h[0],qe=this.h[1],Ge=this.h[2],me=this.h[3],ve=this.h[4],De=this.h[5],Oe=this.h[6],Te=this.h[7],ze=this.h[8],mt=this.h[9],Nt=this.r[0],Ft=this.r[1],$t=this.r[2],te=this.r[3],Gt=this.r[4],an=this.r[5],un=this.r[6],Lt=this.r[7],sn=this.r[8],tn=this.r[9];$>=16;)N=k[D+0]&255|(k[D+1]&255)<<8,Le+=N&8191,ee=k[D+2]&255|(k[D+3]&255)<<8,qe+=(N>>>13|ee<<3)&8191,ne=k[D+4]&255|(k[D+5]&255)<<8,Ge+=(ee>>>10|ne<<6)&8191,he=k[D+6]&255|(k[D+7]&255)<<8,me+=(ne>>>7|he<<9)&8191,Ce=k[D+8]&255|(k[D+9]&255)<<8,ve+=(he>>>4|Ce<<12)&8191,De+=Ce>>>1&8191,Be=k[D+10]&255|(k[D+11]&255)<<8,Oe+=(Ce>>>14|Be<<2)&8191,He=k[D+12]&255|(k[D+13]&255)<<8,Te+=(Be>>>11|He<<5)&8191,ct=k[D+14]&255|(k[D+15]&255)<<8,ze+=(He>>>8|ct<<8)&8191,mt+=ct>>>5|P,Ne=0,rt=Ne,rt+=Le*Nt,rt+=qe*(5*tn),rt+=Ge*(5*sn),rt+=me*(5*Lt),rt+=ve*(5*un),Ne=rt>>>13,rt&=8191,rt+=De*(5*an),rt+=Oe*(5*Gt),rt+=Te*(5*te),rt+=ze*(5*$t),rt+=mt*(5*Ft),Ne+=rt>>>13,rt&=8191,bt=Ne,bt+=Le*Ft,bt+=qe*Nt,bt+=Ge*(5*tn),bt+=me*(5*sn),bt+=ve*(5*Lt),Ne=bt>>>13,bt&=8191,bt+=De*(5*un),bt+=Oe*(5*an),bt+=Te*(5*Gt),bt+=ze*(5*te),bt+=mt*(5*$t),Ne+=bt>>>13,bt&=8191,At=Ne,At+=Le*$t,At+=qe*Ft,At+=Ge*Nt,At+=me*(5*tn),At+=ve*(5*sn),Ne=At>>>13,At&=8191,At+=De*(5*Lt),At+=Oe*(5*un),At+=Te*(5*an),At+=ze*(5*Gt),At+=mt*(5*te),Ne+=At>>>13,At&=8191,vt=Ne,vt+=Le*te,vt+=qe*$t,vt+=Ge*Ft,vt+=me*Nt,vt+=ve*(5*tn),Ne=vt>>>13,vt&=8191,vt+=De*(5*sn),vt+=Oe*(5*Lt),vt+=Te*(5*un),vt+=ze*(5*an),vt+=mt*(5*Gt),Ne+=vt>>>13,vt&=8191,ht=Ne,ht+=Le*Gt,ht+=qe*te,ht+=Ge*$t,ht+=me*Ft,ht+=ve*Nt,Ne=ht>>>13,ht&=8191,ht+=De*(5*tn),ht+=Oe*(5*sn),ht+=Te*(5*Lt),ht+=ze*(5*un),ht+=mt*(5*an),Ne+=ht>>>13,ht&=8191,xt=Ne,xt+=Le*an,xt+=qe*Gt,xt+=Ge*te,xt+=me*$t,xt+=ve*Ft,Ne=xt>>>13,xt&=8191,xt+=De*Nt,xt+=Oe*(5*tn),xt+=Te*(5*sn),xt+=ze*(5*Lt),xt+=mt*(5*un),Ne+=xt>>>13,xt&=8191,wt=Ne,wt+=Le*un,wt+=qe*an,wt+=Ge*Gt,wt+=me*te,wt+=ve*$t,Ne=wt>>>13,wt&=8191,wt+=De*Ft,wt+=Oe*Nt,wt+=Te*(5*tn),wt+=ze*(5*sn),wt+=mt*(5*Lt),Ne+=wt>>>13,wt&=8191,Je=Ne,Je+=Le*Lt,Je+=qe*un,Je+=Ge*an,Je+=me*Gt,Je+=ve*te,Ne=Je>>>13,Je&=8191,Je+=De*$t,Je+=Oe*Ft,Je+=Te*Nt,Je+=ze*(5*tn),Je+=mt*(5*sn),Ne+=Je>>>13,Je&=8191,st=Ne,st+=Le*sn,st+=qe*Lt,st+=Ge*un,st+=me*an,st+=ve*Gt,Ne=st>>>13,st&=8191,st+=De*te,st+=Oe*$t,st+=Te*Ft,st+=ze*Nt,st+=mt*(5*tn),Ne+=st>>>13,st&=8191,Qe=Ne,Qe+=Le*tn,Qe+=qe*sn,Qe+=Ge*Lt,Qe+=me*un,Qe+=ve*an,Ne=Qe>>>13,Qe&=8191,Qe+=De*Gt,Qe+=Oe*te,Qe+=Te*$t,Qe+=ze*Ft,Qe+=mt*Nt,Ne+=Qe>>>13,Qe&=8191,Ne=(Ne<<2)+Ne|0,Ne=Ne+rt|0,rt=Ne&8191,Ne=Ne>>>13,bt+=Ne,Le=rt,qe=bt,Ge=At,me=vt,ve=ht,De=xt,Oe=wt,Te=Je,ze=st,mt=Qe,D+=16,$-=16;this.h[0]=Le,this.h[1]=qe,this.h[2]=Ge,this.h[3]=me,this.h[4]=ve,this.h[5]=De,this.h[6]=Oe,this.h[7]=Te,this.h[8]=ze,this.h[9]=mt},H.prototype.finish=function(k,D){var $=new Uint16Array(10),P,N,ee,ne;if(this.leftover){for(ne=this.leftover,this.buffer[ne++]=1;ne<16;ne++)this.buffer[ne]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(P=this.h[1]>>>13,this.h[1]&=8191,ne=2;ne<10;ne++)this.h[ne]+=P,P=this.h[ne]>>>13,this.h[ne]&=8191;for(this.h[0]+=P*5,P=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=P,P=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=P,$[0]=this.h[0]+5,P=$[0]>>>13,$[0]&=8191,ne=1;ne<10;ne++)$[ne]=this.h[ne]+P,P=$[ne]>>>13,$[ne]&=8191;for($[9]-=8192,N=(P^1)-1,ne=0;ne<10;ne++)$[ne]&=N;for(N=~N,ne=0;ne<10;ne++)this.h[ne]=this.h[ne]&N|$[ne];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,ee=this.h[0]+this.pad[0],this.h[0]=ee&65535,ne=1;ne<8;ne++)ee=(this.h[ne]+this.pad[ne]|0)+(ee>>>16)|0,this.h[ne]=ee&65535;k[D+0]=this.h[0]>>>0&255,k[D+1]=this.h[0]>>>8&255,k[D+2]=this.h[1]>>>0&255,k[D+3]=this.h[1]>>>8&255,k[D+4]=this.h[2]>>>0&255,k[D+5]=this.h[2]>>>8&255,k[D+6]=this.h[3]>>>0&255,k[D+7]=this.h[3]>>>8&255,k[D+8]=this.h[4]>>>0&255,k[D+9]=this.h[4]>>>8&255,k[D+10]=this.h[5]>>>0&255,k[D+11]=this.h[5]>>>8&255,k[D+12]=this.h[6]>>>0&255,k[D+13]=this.h[6]>>>8&255,k[D+14]=this.h[7]>>>0&255,k[D+15]=this.h[7]>>>8&255},H.prototype.update=function(k,D,$){var P,N;if(this.leftover){for(N=16-this.leftover,N>$&&(N=$),P=0;P=16&&(N=$-$%16,this.blocks(k,D,N),D+=N,$-=N),$){for(P=0;P<$;P++)this.buffer[this.leftover+P]=k[D+P];this.leftover+=$}};function W(k,D,$,P,N,ee){var ne=new H(ee);return ne.update($,P,N),ne.finish(k,D),0}function ie(k,D,$,P,N,ee){var ne=new Uint8Array(16);return W(ne,0,$,P,N,ee),b(k,D,ne,0)}function Z(k,D,$,P,N){var ee;if($<32)return-1;for(U(k,0,D,0,$,P,N),W(k,16,k,32,$-32,k),ee=0;ee<16;ee++)k[ee]=0;return 0}function G(k,D,$,P,N){var ee,ne=new Uint8Array(32);if($<32||(F(ne,0,32,P,N),ie(D,16,D,32,$-32,ne)!==0))return-1;for(U(k,0,D,0,$,P,N),ee=0;ee<32;ee++)k[ee]=0;return 0}function K(k,D){var $;for($=0;$<16;$++)k[$]=D[$]|0}function V(k){var D,$,P=1;for(D=0;D<16;D++)$=k[D]+P+65535,P=Math.floor($/65536),k[D]=$-P*65536;k[0]+=P-1+37*(P-1)}function B(k,D,$){for(var P,N=~($-1),ee=0;ee<16;ee++)P=N&(k[ee]^D[ee]),k[ee]^=P,D[ee]^=P}function q(k,D){var $,P,N,ee=n(),ne=n();for($=0;$<16;$++)ne[$]=D[$];for(V(ne),V(ne),V(ne),P=0;P<2;P++){for(ee[0]=ne[0]-65517,$=1;$<15;$++)ee[$]=ne[$]-65535-(ee[$-1]>>16&1),ee[$-1]&=65535;ee[15]=ne[15]-32767-(ee[14]>>16&1),N=ee[15]>>16&1,ee[14]&=65535,B(ne,ee,1-N)}for($=0;$<16;$++)k[2*$]=ne[$]&255,k[2*$+1]=ne[$]>>8}function Y(k,D){var $=new Uint8Array(32),P=new Uint8Array(32);return q($,k),q(P,D),w($,0,P,0)}function ue(k){var D=new Uint8Array(32);return q(D,k),D[0]&1}function Q(k,D){var $;for($=0;$<16;$++)k[$]=D[2*$]+(D[2*$+1]<<8);k[15]&=32767}function J(k,D,$){for(var P=0;P<16;P++)k[P]=D[P]+$[P]}function se(k,D,$){for(var P=0;P<16;P++)k[P]=D[P]-$[P]}function de(k,D,$){var P,N,ee=0,ne=0,he=0,Ce=0,Be=0,He=0,ct=0,Ne=0,rt=0,bt=0,At=0,vt=0,ht=0,xt=0,wt=0,Je=0,st=0,Qe=0,Le=0,qe=0,Ge=0,me=0,ve=0,De=0,Oe=0,Te=0,ze=0,mt=0,Nt=0,Ft=0,$t=0,te=$[0],Gt=$[1],an=$[2],un=$[3],Lt=$[4],sn=$[5],tn=$[6],Kn=$[7],vn=$[8],On=$[9],Gn=$[10],Yn=$[11],xr=$[12],$r=$[13],Ir=$[14],Nr=$[15];P=D[0],ee+=P*te,ne+=P*Gt,he+=P*an,Ce+=P*un,Be+=P*Lt,He+=P*sn,ct+=P*tn,Ne+=P*Kn,rt+=P*vn,bt+=P*On,At+=P*Gn,vt+=P*Yn,ht+=P*xr,xt+=P*$r,wt+=P*Ir,Je+=P*Nr,P=D[1],ne+=P*te,he+=P*Gt,Ce+=P*an,Be+=P*un,He+=P*Lt,ct+=P*sn,Ne+=P*tn,rt+=P*Kn,bt+=P*vn,At+=P*On,vt+=P*Gn,ht+=P*Yn,xt+=P*xr,wt+=P*$r,Je+=P*Ir,st+=P*Nr,P=D[2],he+=P*te,Ce+=P*Gt,Be+=P*an,He+=P*un,ct+=P*Lt,Ne+=P*sn,rt+=P*tn,bt+=P*Kn,At+=P*vn,vt+=P*On,ht+=P*Gn,xt+=P*Yn,wt+=P*xr,Je+=P*$r,st+=P*Ir,Qe+=P*Nr,P=D[3],Ce+=P*te,Be+=P*Gt,He+=P*an,ct+=P*un,Ne+=P*Lt,rt+=P*sn,bt+=P*tn,At+=P*Kn,vt+=P*vn,ht+=P*On,xt+=P*Gn,wt+=P*Yn,Je+=P*xr,st+=P*$r,Qe+=P*Ir,Le+=P*Nr,P=D[4],Be+=P*te,He+=P*Gt,ct+=P*an,Ne+=P*un,rt+=P*Lt,bt+=P*sn,At+=P*tn,vt+=P*Kn,ht+=P*vn,xt+=P*On,wt+=P*Gn,Je+=P*Yn,st+=P*xr,Qe+=P*$r,Le+=P*Ir,qe+=P*Nr,P=D[5],He+=P*te,ct+=P*Gt,Ne+=P*an,rt+=P*un,bt+=P*Lt,At+=P*sn,vt+=P*tn,ht+=P*Kn,xt+=P*vn,wt+=P*On,Je+=P*Gn,st+=P*Yn,Qe+=P*xr,Le+=P*$r,qe+=P*Ir,Ge+=P*Nr,P=D[6],ct+=P*te,Ne+=P*Gt,rt+=P*an,bt+=P*un,At+=P*Lt,vt+=P*sn,ht+=P*tn,xt+=P*Kn,wt+=P*vn,Je+=P*On,st+=P*Gn,Qe+=P*Yn,Le+=P*xr,qe+=P*$r,Ge+=P*Ir,me+=P*Nr,P=D[7],Ne+=P*te,rt+=P*Gt,bt+=P*an,At+=P*un,vt+=P*Lt,ht+=P*sn,xt+=P*tn,wt+=P*Kn,Je+=P*vn,st+=P*On,Qe+=P*Gn,Le+=P*Yn,qe+=P*xr,Ge+=P*$r,me+=P*Ir,ve+=P*Nr,P=D[8],rt+=P*te,bt+=P*Gt,At+=P*an,vt+=P*un,ht+=P*Lt,xt+=P*sn,wt+=P*tn,Je+=P*Kn,st+=P*vn,Qe+=P*On,Le+=P*Gn,qe+=P*Yn,Ge+=P*xr,me+=P*$r,ve+=P*Ir,De+=P*Nr,P=D[9],bt+=P*te,At+=P*Gt,vt+=P*an,ht+=P*un,xt+=P*Lt,wt+=P*sn,Je+=P*tn,st+=P*Kn,Qe+=P*vn,Le+=P*On,qe+=P*Gn,Ge+=P*Yn,me+=P*xr,ve+=P*$r,De+=P*Ir,Oe+=P*Nr,P=D[10],At+=P*te,vt+=P*Gt,ht+=P*an,xt+=P*un,wt+=P*Lt,Je+=P*sn,st+=P*tn,Qe+=P*Kn,Le+=P*vn,qe+=P*On,Ge+=P*Gn,me+=P*Yn,ve+=P*xr,De+=P*$r,Oe+=P*Ir,Te+=P*Nr,P=D[11],vt+=P*te,ht+=P*Gt,xt+=P*an,wt+=P*un,Je+=P*Lt,st+=P*sn,Qe+=P*tn,Le+=P*Kn,qe+=P*vn,Ge+=P*On,me+=P*Gn,ve+=P*Yn,De+=P*xr,Oe+=P*$r,Te+=P*Ir,ze+=P*Nr,P=D[12],ht+=P*te,xt+=P*Gt,wt+=P*an,Je+=P*un,st+=P*Lt,Qe+=P*sn,Le+=P*tn,qe+=P*Kn,Ge+=P*vn,me+=P*On,ve+=P*Gn,De+=P*Yn,Oe+=P*xr,Te+=P*$r,ze+=P*Ir,mt+=P*Nr,P=D[13],xt+=P*te,wt+=P*Gt,Je+=P*an,st+=P*un,Qe+=P*Lt,Le+=P*sn,qe+=P*tn,Ge+=P*Kn,me+=P*vn,ve+=P*On,De+=P*Gn,Oe+=P*Yn,Te+=P*xr,ze+=P*$r,mt+=P*Ir,Nt+=P*Nr,P=D[14],wt+=P*te,Je+=P*Gt,st+=P*an,Qe+=P*un,Le+=P*Lt,qe+=P*sn,Ge+=P*tn,me+=P*Kn,ve+=P*vn,De+=P*On,Oe+=P*Gn,Te+=P*Yn,ze+=P*xr,mt+=P*$r,Nt+=P*Ir,Ft+=P*Nr,P=D[15],Je+=P*te,st+=P*Gt,Qe+=P*an,Le+=P*un,qe+=P*Lt,Ge+=P*sn,me+=P*tn,ve+=P*Kn,De+=P*vn,Oe+=P*On,Te+=P*Gn,ze+=P*Yn,mt+=P*xr,Nt+=P*$r,Ft+=P*Ir,$t+=P*Nr,ee+=38*st,ne+=38*Qe,he+=38*Le,Ce+=38*qe,Be+=38*Ge,He+=38*me,ct+=38*ve,Ne+=38*De,rt+=38*Oe,bt+=38*Te,At+=38*ze,vt+=38*mt,ht+=38*Nt,xt+=38*Ft,wt+=38*$t,N=1,P=ee+N+65535,N=Math.floor(P/65536),ee=P-N*65536,P=ne+N+65535,N=Math.floor(P/65536),ne=P-N*65536,P=he+N+65535,N=Math.floor(P/65536),he=P-N*65536,P=Ce+N+65535,N=Math.floor(P/65536),Ce=P-N*65536,P=Be+N+65535,N=Math.floor(P/65536),Be=P-N*65536,P=He+N+65535,N=Math.floor(P/65536),He=P-N*65536,P=ct+N+65535,N=Math.floor(P/65536),ct=P-N*65536,P=Ne+N+65535,N=Math.floor(P/65536),Ne=P-N*65536,P=rt+N+65535,N=Math.floor(P/65536),rt=P-N*65536,P=bt+N+65535,N=Math.floor(P/65536),bt=P-N*65536,P=At+N+65535,N=Math.floor(P/65536),At=P-N*65536,P=vt+N+65535,N=Math.floor(P/65536),vt=P-N*65536,P=ht+N+65535,N=Math.floor(P/65536),ht=P-N*65536,P=xt+N+65535,N=Math.floor(P/65536),xt=P-N*65536,P=wt+N+65535,N=Math.floor(P/65536),wt=P-N*65536,P=Je+N+65535,N=Math.floor(P/65536),Je=P-N*65536,ee+=N-1+37*(N-1),N=1,P=ee+N+65535,N=Math.floor(P/65536),ee=P-N*65536,P=ne+N+65535,N=Math.floor(P/65536),ne=P-N*65536,P=he+N+65535,N=Math.floor(P/65536),he=P-N*65536,P=Ce+N+65535,N=Math.floor(P/65536),Ce=P-N*65536,P=Be+N+65535,N=Math.floor(P/65536),Be=P-N*65536,P=He+N+65535,N=Math.floor(P/65536),He=P-N*65536,P=ct+N+65535,N=Math.floor(P/65536),ct=P-N*65536,P=Ne+N+65535,N=Math.floor(P/65536),Ne=P-N*65536,P=rt+N+65535,N=Math.floor(P/65536),rt=P-N*65536,P=bt+N+65535,N=Math.floor(P/65536),bt=P-N*65536,P=At+N+65535,N=Math.floor(P/65536),At=P-N*65536,P=vt+N+65535,N=Math.floor(P/65536),vt=P-N*65536,P=ht+N+65535,N=Math.floor(P/65536),ht=P-N*65536,P=xt+N+65535,N=Math.floor(P/65536),xt=P-N*65536,P=wt+N+65535,N=Math.floor(P/65536),wt=P-N*65536,P=Je+N+65535,N=Math.floor(P/65536),Je=P-N*65536,ee+=N-1+37*(N-1),k[0]=ee,k[1]=ne,k[2]=he,k[3]=Ce,k[4]=Be,k[5]=He,k[6]=ct,k[7]=Ne,k[8]=rt,k[9]=bt,k[10]=At,k[11]=vt,k[12]=ht,k[13]=xt,k[14]=wt,k[15]=Je}function Se(k,D){de(k,D,D)}function ge(k,D){var $=n(),P;for(P=0;P<16;P++)$[P]=D[P];for(P=253;P>=0;P--)Se($,$),P!==2&&P!==4&&de($,$,D);for(P=0;P<16;P++)k[P]=$[P]}function Ze(k,D){var $=n(),P;for(P=0;P<16;P++)$[P]=D[P];for(P=250;P>=0;P--)Se($,$),P!==1&&de($,$,D);for(P=0;P<16;P++)k[P]=$[P]}function Pe(k,D,$){var P=new Uint8Array(32),N=new Float64Array(80),ee,ne,he=n(),Ce=n(),Be=n(),He=n(),ct=n(),Ne=n();for(ne=0;ne<31;ne++)P[ne]=D[ne];for(P[31]=D[31]&127|64,P[0]&=248,Q(N,$),ne=0;ne<16;ne++)Ce[ne]=N[ne],He[ne]=he[ne]=Be[ne]=0;for(he[0]=He[0]=1,ne=254;ne>=0;--ne)ee=P[ne>>>3]>>>(ne&7)&1,B(he,Ce,ee),B(Be,He,ee),J(ct,he,Be),se(he,he,Be),J(Be,Ce,He),se(Ce,Ce,He),Se(He,ct),Se(Ne,he),de(he,Be,he),de(Be,Ce,ct),J(ct,he,Be),se(he,he,Be),Se(Ce,he),se(Be,He,Ne),de(he,Be,s),J(he,he,He),de(Be,Be,he),de(he,He,Ne),de(He,Ce,N),Se(Ce,ct),B(he,Ce,ee),B(Be,He,ee);for(ne=0;ne<16;ne++)N[ne+16]=he[ne],N[ne+32]=Be[ne],N[ne+48]=Ce[ne],N[ne+64]=He[ne];var rt=N.subarray(32),bt=N.subarray(16);return ge(rt,rt),de(bt,bt,rt),q(k,bt),0}function Fe(k,D){return Pe(k,D,o)}function $e(k,D){return r(D,32),Fe(k,D)}function be(k,D,$){var P=new Uint8Array(32);return Pe(P,$,D),E(k,i,P,C)}var yt=Z,lt=G;function It(k,D,$,P,N,ee){var ne=new Uint8Array(32);return be(ne,N,ee),yt(k,D,$,P,ne)}function mn(k,D,$,P,N,ee){var ne=new Uint8Array(32);return be(ne,N,ee),lt(k,D,$,P,ne)}var en=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function re(k,D,$,P){for(var N=new Int32Array(16),ee=new Int32Array(16),ne,he,Ce,Be,He,ct,Ne,rt,bt,At,vt,ht,xt,wt,Je,st,Qe,Le,qe,Ge,me,ve,De,Oe,Te,ze,mt=k[0],Nt=k[1],Ft=k[2],$t=k[3],te=k[4],Gt=k[5],an=k[6],un=k[7],Lt=D[0],sn=D[1],tn=D[2],Kn=D[3],vn=D[4],On=D[5],Gn=D[6],Yn=D[7],xr=0;P>=128;){for(qe=0;qe<16;qe++)Ge=8*qe+xr,N[qe]=$[Ge+0]<<24|$[Ge+1]<<16|$[Ge+2]<<8|$[Ge+3],ee[qe]=$[Ge+4]<<24|$[Ge+5]<<16|$[Ge+6]<<8|$[Ge+7];for(qe=0;qe<80;qe++)if(ne=mt,he=Nt,Ce=Ft,Be=$t,He=te,ct=Gt,Ne=an,rt=un,bt=Lt,At=sn,vt=tn,ht=Kn,xt=vn,wt=On,Je=Gn,st=Yn,me=un,ve=Yn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=(te>>>14|vn<<18)^(te>>>18|vn<<14)^(vn>>>9|te<<23),ve=(vn>>>14|te<<18)^(vn>>>18|te<<14)^(te>>>9|vn<<23),De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=te&Gt^~te&an,ve=vn&On^~vn&Gn,De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=en[qe*2],ve=en[qe*2+1],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=N[qe%16],ve=ee[qe%16],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,Qe=Te&65535|ze<<16,Le=De&65535|Oe<<16,me=Qe,ve=Le,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=(mt>>>28|Lt<<4)^(Lt>>>2|mt<<30)^(Lt>>>7|mt<<25),ve=(Lt>>>28|mt<<4)^(mt>>>2|Lt<<30)^(mt>>>7|Lt<<25),De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=mt&Nt^mt&Ft^Nt&Ft,ve=Lt&sn^Lt&tn^sn&tn,De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,rt=Te&65535|ze<<16,st=De&65535|Oe<<16,me=Be,ve=ht,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=Qe,ve=Le,De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,Be=Te&65535|ze<<16,ht=De&65535|Oe<<16,Nt=ne,Ft=he,$t=Ce,te=Be,Gt=He,an=ct,un=Ne,mt=rt,sn=bt,tn=At,Kn=vt,vn=ht,On=xt,Gn=wt,Yn=Je,Lt=st,qe%16===15)for(Ge=0;Ge<16;Ge++)me=N[Ge],ve=ee[Ge],De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=N[(Ge+9)%16],ve=ee[(Ge+9)%16],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Qe=N[(Ge+1)%16],Le=ee[(Ge+1)%16],me=(Qe>>>1|Le<<31)^(Qe>>>8|Le<<24)^Qe>>>7,ve=(Le>>>1|Qe<<31)^(Le>>>8|Qe<<24)^(Le>>>7|Qe<<25),De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Qe=N[(Ge+14)%16],Le=ee[(Ge+14)%16],me=(Qe>>>19|Le<<13)^(Le>>>29|Qe<<3)^Qe>>>6,ve=(Le>>>19|Qe<<13)^(Qe>>>29|Le<<3)^(Le>>>6|Qe<<26),De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,N[Ge]=Te&65535|ze<<16,ee[Ge]=De&65535|Oe<<16;me=mt,ve=Lt,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[0],ve=D[0],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[0]=mt=Te&65535|ze<<16,D[0]=Lt=De&65535|Oe<<16,me=Nt,ve=sn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[1],ve=D[1],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[1]=Nt=Te&65535|ze<<16,D[1]=sn=De&65535|Oe<<16,me=Ft,ve=tn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[2],ve=D[2],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[2]=Ft=Te&65535|ze<<16,D[2]=tn=De&65535|Oe<<16,me=$t,ve=Kn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[3],ve=D[3],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[3]=$t=Te&65535|ze<<16,D[3]=Kn=De&65535|Oe<<16,me=te,ve=vn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[4],ve=D[4],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[4]=te=Te&65535|ze<<16,D[4]=vn=De&65535|Oe<<16,me=Gt,ve=On,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[5],ve=D[5],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[5]=Gt=Te&65535|ze<<16,D[5]=On=De&65535|Oe<<16,me=an,ve=Gn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[6],ve=D[6],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[6]=an=Te&65535|ze<<16,D[6]=Gn=De&65535|Oe<<16,me=un,ve=Yn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[7],ve=D[7],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[7]=un=Te&65535|ze<<16,D[7]=Yn=De&65535|Oe<<16,xr+=128,P-=128}return P}function pe(k,D,$){var P=new Int32Array(8),N=new Int32Array(8),ee=new Uint8Array(256),ne,he=$;for(P[0]=1779033703,P[1]=3144134277,P[2]=1013904242,P[3]=2773480762,P[4]=1359893119,P[5]=2600822924,P[6]=528734635,P[7]=1541459225,N[0]=4089235720,N[1]=2227873595,N[2]=4271175723,N[3]=1595750129,N[4]=2917565137,N[5]=725511199,N[6]=4215389547,N[7]=327033209,re(P,N,D,$),$%=128,ne=0;ne<$;ne++)ee[ne]=D[he-$+ne];for(ee[$]=128,$=256-128*($<112?1:0),ee[$-9]=0,g(ee,$-8,he/536870912|0,he<<3),re(P,N,ee,$),ne=0;ne<8;ne++)g(k,8*ne,P[ne],N[ne]);return 0}function ye(k,D){var $=n(),P=n(),N=n(),ee=n(),ne=n(),he=n(),Ce=n(),Be=n(),He=n();se($,k[1],k[0]),se(He,D[1],D[0]),de($,$,He),J(P,k[0],k[1]),J(He,D[0],D[1]),de(P,P,He),de(N,k[3],D[3]),de(N,N,c),de(ee,k[2],D[2]),J(ee,ee,ee),se(ne,P,$),se(he,ee,N),J(Ce,ee,N),J(Be,P,$),de(k[0],ne,he),de(k[1],Be,Ce),de(k[2],Ce,he),de(k[3],ne,Be)}function Ue(k,D,$){var P;for(P=0;P<4;P++)B(k[P],D[P],$)}function je(k,D){var $=n(),P=n(),N=n();ge(N,D[2]),de($,D[0],N),de(P,D[1],N),q(k,P),k[31]^=ue($)<<7}function ke(k,D,$){var P,N;for(K(k[0],a),K(k[1],u),K(k[2],u),K(k[3],a),N=255;N>=0;--N)P=$[N/8|0]>>(N&7)&1,Ue(k,D,P),ye(D,k),ye(k,k),Ue(k,D,P)}function nt(k,D){var $=[n(),n(),n(),n()];K($[0],d),K($[1],h),K($[2],u),de($[3],d,h),ke(k,$,D)}function gt(k,D,$){var P=new Uint8Array(64),N=[n(),n(),n(),n()],ee;for($||r(D,32),pe(P,D,32),P[0]&=248,P[31]&=127,P[31]|=64,nt(N,P),je(k,N),ee=0;ee<32;ee++)D[ee+32]=k[ee];return 0}var bn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Vt(k,D){var $,P,N,ee;for(P=63;P>=32;--P){for($=0,N=P-32,ee=P-12;N>4)*bn[N],$=D[N]>>8,D[N]&=255;for(N=0;N<32;N++)D[N]-=$*bn[N];for(P=0;P<32;P++)D[P+1]+=D[P]>>8,k[P]=D[P]&255}function xn(k){var D=new Float64Array(64),$;for($=0;$<64;$++)D[$]=k[$];for($=0;$<64;$++)k[$]=0;Vt(k,D)}function Ii(k,D,$,P){var N=new Uint8Array(64),ee=new Uint8Array(64),ne=new Uint8Array(64),he,Ce,Be=new Float64Array(64),He=[n(),n(),n(),n()];pe(N,P,32),N[0]&=248,N[31]&=127,N[31]|=64;var ct=$+64;for(he=0;he<$;he++)k[64+he]=D[he];for(he=0;he<32;he++)k[32+he]=N[32+he];for(pe(ne,k.subarray(32),$+32),xn(ne),nt(He,ne),je(k,He),he=32;he<64;he++)k[he]=P[he];for(pe(ee,k,$+64),xn(ee),he=0;he<64;he++)Be[he]=0;for(he=0;he<32;he++)Be[he]=ne[he];for(he=0;he<32;he++)for(Ce=0;Ce<32;Ce++)Be[he+Ce]+=ee[he]*N[Ce];return Vt(k.subarray(32),Be),ct}function br(k,D){var $=n(),P=n(),N=n(),ee=n(),ne=n(),he=n(),Ce=n();return K(k[2],u),Q(k[1],D),Se(N,k[1]),de(ee,N,l),se(N,N,k[2]),J(ee,k[2],ee),Se(ne,ee),Se(he,ne),de(Ce,he,ne),de($,Ce,N),de($,$,ee),Ze($,$),de($,$,N),de($,$,ee),de($,$,ee),de(k[0],$,ee),Se(P,k[0]),de(P,P,ee),Y(P,N)&&de(k[0],k[0],v),Se(P,k[0]),de(P,P,ee),Y(P,N)?-1:(ue(k[0])===D[31]>>7&&se(k[0],a,k[0]),de(k[3],k[0],k[1]),0)}function yi(k,D,$,P){var N,ee=new Uint8Array(32),ne=new Uint8Array(64),he=[n(),n(),n(),n()],Ce=[n(),n(),n(),n()];if($<64||br(Ce,P))return-1;for(N=0;N<$;N++)k[N]=D[N];for(N=0;N<32;N++)k[N+32]=P[N];if(pe(ne,k,$),xn(ne),ke(he,Ce,ne),nt(Ce,D.subarray(32)),ye(he,Ce),je(ee,he),$-=64,w(D,0,ee,0)){for(N=0;N<$;N++)k[N]=0;return-1}for(N=0;N<$;N++)k[N]=D[N+64];return $}var ar=32,ui=24,bi=32,Rr=16,Yi=32,go=32,xi=32,Dr=32,wa=32,_t=ui,dn=bi,wn=Rr,qn=64,ur=32,Xr=64,mo=32,ql=64;t.lowlevel={crypto_core_hsalsa20:E,crypto_stream_xor:U,crypto_stream:F,crypto_stream_salsa20_xor:T,crypto_stream_salsa20:M,crypto_onetimeauth:W,crypto_onetimeauth_verify:ie,crypto_verify_16:b,crypto_verify_32:w,crypto_secretbox:Z,crypto_secretbox_open:G,crypto_scalarmult:Pe,crypto_scalarmult_base:Fe,crypto_box_beforenm:be,crypto_box_afternm:yt,crypto_box:It,crypto_box_open:mn,crypto_box_keypair:$e,crypto_hash:pe,crypto_sign:Ii,crypto_sign_keypair:gt,crypto_sign_open:yi,crypto_secretbox_KEYBYTES:ar,crypto_secretbox_NONCEBYTES:ui,crypto_secretbox_ZEROBYTES:bi,crypto_secretbox_BOXZEROBYTES:Rr,crypto_scalarmult_BYTES:Yi,crypto_scalarmult_SCALARBYTES:go,crypto_box_PUBLICKEYBYTES:xi,crypto_box_SECRETKEYBYTES:Dr,crypto_box_BEFORENMBYTES:wa,crypto_box_NONCEBYTES:_t,crypto_box_ZEROBYTES:dn,crypto_box_BOXZEROBYTES:wn,crypto_sign_BYTES:qn,crypto_sign_PUBLICKEYBYTES:ur,crypto_sign_SECRETKEYBYTES:Xr,crypto_sign_SEEDBYTES:mo,crypto_hash_BYTES:ql,gf:n,D:l,L:bn,pack25519:q,unpack25519:Q,M:de,A:J,S:Se,Z:se,pow2523:Ze,add:ye,set25519:K,modL:Vt,scalarmult:ke,scalarbase:nt};function yf(k,D){if(k.length!==ar)throw new Error("bad key size");if(D.length!==ui)throw new Error("bad nonce size")}function oe(k,D){if(k.length!==xi)throw new Error("bad public key size");if(D.length!==Dr)throw new Error("bad secret key size")}function le(){for(var k=0;k=0},t.sign.keyPair=function(){var k=new Uint8Array(ur),D=new Uint8Array(Xr);return gt(k,D),{publicKey:k,secretKey:D}},t.sign.keyPair.fromSecretKey=function(k){if(le(k),k.length!==Xr)throw new Error("bad secret key size");for(var D=new Uint8Array(ur),$=0;$"u"?typeof Buffer.from<"u"?(t.encodeBase64=function(r){return Buffer.from(r).toString("base64")},t.decodeBase64=function(r){return n(r),new Uint8Array(Array.prototype.slice.call(Buffer.from(r,"base64"),0))}):(t.encodeBase64=function(r){return new Buffer(r).toString("base64")},t.decodeBase64=function(r){return n(r),new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0))}):(t.encodeBase64=function(r){var i,o=[],a=r.length;for(i=0;i{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:a,disabled:u,value:s="on",onCheckedChange:l,form:c,...d}=e,[h,v]=y.useState(null),g=Kt(t,A=>v(A)),m=y.useRef(!1),b=h?c||!!h.closest("form"):!0,[w=!1,x]=Ga({prop:i,defaultProp:o,onChange:l}),S=y.useRef(w);return y.useEffect(()=>{const A=h?.form;if(A){const E=()=>x(S.current);return A.addEventListener("reset",E),()=>A.removeEventListener("reset",E)}},[h,x]),I.jsxs(Bqe,{scope:n,state:w,disabled:u,children:[I.jsx(pt.button,{type:"button",role:"checkbox","aria-checked":bl(w)?"mixed":w,"aria-required":a,"data-state":gY(w),"data-disabled":u?"":void 0,disabled:u,value:s,...d,ref:g,onKeyDown:Ye(e.onKeyDown,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:Ye(e.onClick,A=>{x(E=>bl(E)?!0:!E),b&&(m.current=A.isPropagationStopped(),m.current||A.stopPropagation())})}),b&&I.jsx(Uqe,{control:h,bubbles:!m.current,name:r,value:s,checked:w,required:a,disabled:u,form:c,style:{transform:"translateX(-100%)"},defaultChecked:bl(o)?!1:o})]})});hY.displayName=oO;var pY="CheckboxIndicator",vY=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=zqe(pY,n);return I.jsx(Gr,{present:r||bl(o.state)||o.state===!0,children:I.jsx(pt.span,{"data-state":gY(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});vY.displayName=pY;var Uqe=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,a=y.useRef(null),u=pP(n),s=jA(t);y.useEffect(()=>{const c=a.current,d=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(d,"checked").set;if(u!==n&&v){const g=new Event("click",{bubbles:r});c.indeterminate=bl(n),v.call(c,bl(n)?!1:n),c.dispatchEvent(g)}},[u,n,r]);const l=y.useRef(bl(n)?!1:n);return I.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??l.current,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function bl(e){return e==="indeterminate"}function gY(e){return bl(e)?"indeterminate":e?"checked":"unchecked"}var FZe=hY,LZe=vY;export{CGe as $,cpe as A,IKe as B,UKe as C,hpe as D,ppe as E,zKe as F,xB as G,nGe as H,vKe as I,gpe as J,fpe as K,dpe as L,uKe as M,vGe as N,Vqe as O,Yqe as P,NKe as Q,j as R,Sl as S,vpe as T,Lpe as U,jpe as V,kGe as W,JKe as X,TGe as Y,xGe as Z,wGe as _,Qqe as a,VYe as a$,EGe as a0,PGe as a1,YKe as a2,AGe as a3,iGe as a4,SGe as a5,OGe as a6,yGe as a7,bGe as a8,_Ge as a9,LGe as aA,sGe as aB,pYe as aC,bKe as aD,EKe as aE,SYe as aF,CYe as aG,EYe as aH,Xqe as aI,TYe as aJ,MYe as aK,RYe as aL,kYe as aM,$Ye as aN,NYe as aO,IYe as aP,FYe as aQ,XKe as aR,qYe as aS,eGe as aT,KYe as aU,LYe as aV,jYe as aW,BYe as aX,UYe as aY,WYe as aZ,HYe as a_,RGe as aa,NGe as ab,DGe as ac,$Ge as ad,Kqe as ae,oKe as af,lKe as ag,CKe as ah,eKe as ai,cKe as aj,xKe as ak,sKe as al,pKe as am,SKe as an,_Ke as ao,gKe as ap,wKe as aq,iKe as ar,nKe as as,fKe as at,kKe as au,OKe as av,AKe as aw,TKe as ax,yKe as ay,aKe as az,ig as b,kZe as b$,GYe as b0,zYe as b1,XYe as b2,QKe as b3,tZe as b4,nZe as b5,JYe as b6,eZe as b7,qS as b8,jKe as b9,VGe as bA,zGe as bB,YYe as bC,Ui as bD,lZe as bE,cZe as bF,lYe as bG,gYe as bH,hYe as bI,iYe as bJ,JGe as bK,QGe as bL,fZe as bM,rKe as bN,PKe as bO,mKe as bP,tKe as bQ,hZe as bR,pZe as bS,BKe as bT,oGe as bU,aGe as bV,wZe as bW,SZe as bX,eYe as bY,UGe as bZ,OZe as b_,mf as ba,KGe as bb,AYe as bc,PYe as bd,cP as be,fP as bf,oIe as bg,Yu as bh,vf as bi,Gh as bj,ZYe as bk,cYe as bl,qGe as bm,BGe as bn,HGe as bo,WGe as bp,xYe as bq,yYe as br,oZe as bs,aZe as bt,uZe as bu,ZBe as bv,nze as bw,rZe as bx,fYe as by,jGe as bz,fn as c,RZe as c0,DZe as c1,TZe as c2,MZe as c3,EZe as c4,AZe as c5,PZe as c6,uGe as c7,cGe as c8,mYe as c9,LZe as cA,tGe as cB,hGe as cC,ZKe as cD,rGe as cE,dGe as cF,aYe as cG,Gqe as cH,YGe as cI,HBe as cJ,lGe as cK,tYe as cL,GGe as cM,_Ze as ca,vZe as cb,yZe as cc,bZe as cd,xZe as ce,bYe as cf,sYe as cg,ZGe as ch,XGe as ci,wYe as cj,Qa as ck,yr as cl,uYe as cm,gZe as cn,mZe as co,fGe as cp,Gc as cq,$Ze as cr,IZe as cs,IGe as ct,vYe as cu,nYe as cv,oYe as cw,dYe as cx,rYe as cy,FZe as cz,Hqe as d,Kr as e,$Ke as f,RKe as g,DKe as h,MKe as i,I as j,yk as k,LKe as l,qqe as m,qKe as n,mA as o,hKe as p,dKe as q,y as r,GKe as s,Jqe as t,JF as u,KKe as v,Zqe as w,WKe as x,HKe as y,VKe as z}; +`,o.map=[t,e.line],!0}function hHe(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>o)return!1;const a=e.src.charCodeAt(i);if(a!==126&&a!==96)return!1;let u=i;i=e.skipChars(i,a);let s=i-u;if(s<3)return!1;const l=e.src.slice(u,i),c=e.src.slice(i,o);if(a===96&&c.indexOf(String.fromCharCode(a))>=0)return!1;if(r)return!0;let d=t,h=!1;for(;d++,!(d>=n||(i=u=e.bMarks[d]+e.tShift[d],o=e.eMarks[d],i=4)&&(i=e.skipChars(i,a),!(i-u=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;const u=[],s=[],l=[],c=[],d=e.md.block.ruler.getRules("blockquote"),h=e.parentType;e.parentType="blockquote";let v=!1,g;for(g=t;g=o)break;if(e.src.charCodeAt(i++)===62&&!S){let E=e.sCount[g]+1,C,T;e.src.charCodeAt(i)===32?(i++,E++,T=!1,C=!0):e.src.charCodeAt(i)===9?(C=!0,(e.bsCount[g]+E)%4===3?(i++,E++,T=!1):T=!0):C=!1;let M=E;for(u.push(e.bMarks[g]),e.bMarks[g]=i;i=o,s.push(e.bsCount[g]),e.bsCount[g]=e.sCount[g]+1+(C?1:0),l.push(e.sCount[g]),e.sCount[g]=M-E,c.push(e.tShift[g]),e.tShift[g]=i-e.bMarks[g];continue}if(v)break;let A=!1;for(let E=0,C=d.length;E";const w=[t,0];b.map=w,e.md.block.tokenize(e,t,g);const x=e.push("blockquote_close","blockquote",-1);x.markup=">",e.lineMax=a,e.parentType=h,w[1]=e.line;for(let S=0;S=4)return!1;let o=e.bMarks[t]+e.tShift[t];const a=e.src.charCodeAt(o++);if(a!==42&&a!==45&&a!==95)return!1;let u=1;for(;o=r)return-1;let o=e.src.charCodeAt(i++);if(o<48||o>57)return-1;for(;;){if(i>=r)return-1;if(o=e.src.charCodeAt(i++),o>=48&&o<=57){if(i-n>=10)return-1;continue}if(o===41||o===46)break;return-1}return i=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&e.sCount[s]=e.blkIndent&&(c=!0);let d,h,v;if((v=wI(e,s))>=0){if(d=!0,a=e.bMarks[s]+e.tShift[s],h=Number(e.src.slice(a,v-1)),c&&h!==1)return!1}else if((v=xI(e,s))>=0)d=!1;else return!1;if(c&&e.skipSpaces(v)>=e.eMarks[s])return!1;if(r)return!0;const g=e.src.charCodeAt(v-1),m=e.tokens.length;d?(u=e.push("ordered_list_open","ol",1),h!==1&&(u.attrs=[["start",h]])):u=e.push("bullet_list_open","ul",1);const b=[s,0];u.map=b,u.markup=String.fromCharCode(g);let w=!1;const x=e.md.block.ruler.getRules("list"),S=e.parentType;for(e.parentType="list";s=i?T=1:T=E-A,T>4&&(T=1);const M=A+T;u=e.push("list_item_open","li",1),u.markup=String.fromCharCode(g);const F=[s,0];u.map=F,d&&(u.info=e.src.slice(a,v-1));const U=e.tight,H=e.tShift[s],W=e.sCount[s],ie=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=M,e.tight=!0,e.tShift[s]=C-e.bMarks[s],e.sCount[s]=E,C>=i&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,s,n,!0),(!e.tight||w)&&(l=!1),w=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=ie,e.tShift[s]=H,e.sCount[s]=W,e.tight=U,u=e.push("list_item_close","li",-1),u.markup=String.fromCharCode(g),s=e.line,F[1]=s,s>=n||e.sCount[s]=4)break;let Z=!1;for(let G=0,K=x.length;G=4||e.src.charCodeAt(i)!==91)return!1;function u(x){const S=e.lineMax;if(x>=S||e.isEmpty(x))return null;let A=!1;if(e.sCount[x]-e.blkIndent>3&&(A=!0),e.sCount[x]<0&&(A=!0),!A){const T=e.md.block.ruler.getRules("reference"),M=e.parentType;e.parentType="reference";let F=!1;for(let U=0,H=T.length;U"u"&&(e.env.references={}),typeof e.env.references[w]>"u"&&(e.env.references[w]={title:b,href:d}),e.line=a),!0):!1}const bHe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xHe="[a-zA-Z_:][a-zA-Z0-9:._-]*",wHe="[^\"'=<>`\\x00-\\x20]+",_He="'[^']*'",SHe='"[^"]*"',CHe="(?:"+wHe+"|"+_He+"|"+SHe+")",EHe="(?:\\s+"+xHe+"(?:\\s*=\\s*"+CHe+")?)",ZG="<[A-Za-z][A-Za-z0-9\\-]*"+EHe+"*\\s*\\/?>",XG="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",AHe="",PHe="<[?][\\s\\S]*?[?]>",OHe="]*>",kHe="",THe=new RegExp("^(?:"+ZG+"|"+XG+"|"+AHe+"|"+PHe+"|"+OHe+"|"+kHe+")"),MHe=new RegExp("^(?:"+ZG+"|"+XG+")"),qf=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(MHe.source+"\\s*$"),/^$/,!1]];function RHe(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let a=e.src.slice(i,o),u=0;for(;u=4)return!1;let a=e.src.charCodeAt(i);if(a!==35||i>=o)return!1;let u=1;for(a=e.src.charCodeAt(++i);a===35&&i6||ii&&Vn(e.src.charCodeAt(s-1))&&(o=s),e.line=t+1;const l=e.push("heading_open","h"+String(u),1);l.markup="########".slice(0,u),l.map=[t,e.line];const c=e.push("inline","",0);c.content=e.src.slice(i,o).trim(),c.map=[t,e.line],c.children=[];const d=e.push("heading_close","h"+String(u),-1);return d.markup="########".slice(0,u),!0}function $He(e,t,n){const r=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const i=e.parentType;e.parentType="paragraph";let o=0,a,u=t+1;for(;u3)continue;if(e.sCount[u]>=e.blkIndent){let v=e.bMarks[u]+e.tShift[u];const g=e.eMarks[u];if(v=g))){o=a===61?1:2;break}}if(e.sCount[u]<0)continue;let h=!1;for(let v=0,g=r.length;v3||e.sCount[o]<0)continue;let l=!1;for(let c=0,d=r.length;c=n||e.sCount[a]=o){e.line=n;break}const s=e.line;let l=!1;for(let c=0;c=e.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");e.tight=!u,e.isEmpty(e.line-1)&&(u=!0),a=e.line,a0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};Ng.prototype.scanDelims=function(e,t){const n=this.posMax,r=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32;let o=e;for(;o0)return!1;const n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const i=e.pending.match(LHe);if(!i)return!1;const o=i[1],a=e.md.linkify.matchAtStart(e.src.slice(n-o.length));if(!a)return!1;let u=a.url;if(u.length<=o.length)return!1;u=u.replace(/\*+$/,"");const s=e.md.normalizeLink(u);if(!e.md.validateLink(s))return!1;if(!t){e.pending=e.pending.slice(0,-o.length);const l=e.push("link_open","a",1);l.attrs=[["href",s]],l.markup="linkify",l.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(u);const d=e.push("link_close","a",-1);d.markup="linkify",d.info="auto"}return e.pos+=u.length-o.length,!0}function BHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let o=r-1;for(;o>=1&&e.pending.charCodeAt(o-1)===32;)o--;e.pending=e.pending.slice(0,o),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(n++;n?@[]^_`{|}~-".split("").forEach(function(e){rO[e.charCodeAt(0)]=1});function zHe(e,t){let n=e.pos;const r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push("hardbreak","br",0),n++;n=55296&&i<=56319&&n+1=56320&&u<=57343&&(o+=e.src[n+1],n++)}const a="\\"+o;if(!t){const u=e.push("text_special","",0);i<256&&rO[i]!==0?u.content=o:u.content=a,u.markup=a,u.info="escape"}return e.pos=n+1,!0}function UHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;const i=n;n++;const o=e.posMax;for(;n=0;r--){const i=t[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const o=t[i.end],a=r>0&&t[r-1].end===i.end+1&&t[r-1].marker===i.marker&&t[r-1].token===i.token-1&&t[i.end+1].token===o.token+1,u=String.fromCharCode(i.marker),s=e.tokens[i.token];s.type=a?"strong_open":"em_open",s.tag=a?"strong":"em",s.nesting=1,s.markup=a?u+u:u,s.content="";const l=e.tokens[o.token];l.type=a?"strong_close":"em_close",l.tag=a?"strong":"em",l.nesting=-1,l.markup=a?u+u:u,l.content="",a&&(e.tokens[t[r-1].token].content="",e.tokens[t[i.end+1].token].content="",r--)}}function qHe(e){const t=e.tokens_meta,n=e.tokens_meta.length;SI(e,e.delimiters);for(let r=0;r=d)return!1;if(s=g,i=e.md.helpers.parseLinkDestination(e.src,g,e.posMax),i.ok){for(a=e.md.normalizeLink(i.str),e.md.validateLink(a)?g=i.pos:a="",s=g;g=d||e.src.charCodeAt(g)!==41)&&(l=!0),g++}if(l){if(typeof e.env.references>"u")return!1;if(g=0?r=e.src.slice(s,g++):g=v+1):g=v+1,r||(r=e.src.slice(h,v)),o=e.env.references[n2(r)],!o)return e.pos=c,!1;a=o.href,u=o.title}if(!t){e.pos=h,e.posMax=v;const m=e.push("link_open","a",1),b=[["href",a]];m.attrs=b,u&&b.push(["title",u]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=g,e.posMax=d,!0}function GHe(e,t){let n,r,i,o,a,u,s,l,c="";const d=e.pos,h=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const v=e.pos+2,g=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(g<0)return!1;if(o=g+1,o=h)return!1;for(l=o,u=e.md.helpers.parseLinkDestination(e.src,o,e.posMax),u.ok&&(c=e.md.normalizeLink(u.str),e.md.validateLink(c)?o=u.pos:c=""),l=o;o=h||e.src.charCodeAt(o)!==41)return e.pos=d,!1;o++}else{if(typeof e.env.references>"u")return!1;if(o=0?i=e.src.slice(l,o++):o=g+1):o=g+1,i||(i=e.src.slice(v,g)),a=e.env.references[n2(i)],!a)return e.pos=d,!1;c=a.href,s=a.title}if(!t){r=e.src.slice(v,g);const m=[];e.md.inline.parse(r,e.md,e.env,m);const b=e.push("image","img",0),w=[["src",c],["alt",""]];b.attrs=w,b.children=m,b.content=r,s&&w.push(["title",s])}return e.pos=o,e.posMax=h,!0}const YHe=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,ZHe=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function XHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;const r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;const a=e.src.charCodeAt(n);if(a===60)return!1;if(a===62)break}const o=e.src.slice(r+1,n);if(ZHe.test(o)){const a=e.md.normalizeLink(o);if(!e.md.validateLink(a))return!1;if(!t){const u=e.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(o);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}if(YHe.test(o)){const a=e.md.normalizeLink("mailto:"+o);if(!e.md.validateLink(a))return!1;if(!t){const u=e.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(o);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}return!1}function QHe(e){return/^\s]/i.test(e)}function JHe(e){return/^<\/a\s*>/i.test(e)}function eqe(e){const t=e|32;return t>=97&&t<=122}function tqe(e,t){if(!e.md.options.html)return!1;const n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!eqe(i))return!1;const o=e.src.slice(r).match(THe);if(!o)return!1;if(!t){const a=e.push("html_inline","",0);a.content=o[0],QHe(a.content)&&e.linkLevel++,JHe(a.content)&&e.linkLevel--}return e.pos+=o[0].length,!0}const nqe=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,rqe=/^&([a-z][a-z0-9]{1,31});/i;function iqe(e,t){const n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){const o=e.src.slice(n).match(nqe);if(o){if(!t){const a=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),u=e.push("text_special","",0);u.content=tO(a)?ox(a):ox(65533),u.markup=o[0],u.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(rqe);if(o){const a=HG(o[0]);if(a!==o[0]){if(!t){const u=e.push("text_special","",0);u.content=a,u.markup=o[0],u.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function CI(e){const t={},n=e.length;if(!n)return;let r=0,i=-2;const o=[];for(let a=0;as;l-=o[l]+1){const d=e[l];if(d.marker===u.marker&&d.open&&d.end<0){let h=!1;if((d.close||u.open)&&(d.length+u.length)%3===0&&(d.length%3!==0||u.length%3!==0)&&(h=!0),!h){const v=l>0&&!e[l-1].open?o[l-1]+1:0;o[a]=a-l+v,o[l]=v,u.open=!1,d.end=a,d.close=!1,c=-1,i=-2;break}}}c!==-1&&(t[u.marker][(u.open?3:0)+(u.length||0)%3]=c)}}function oqe(e){const t=e.tokens_meta,n=e.tokens_meta.length;CI(e.delimiters);for(let r=0;r0&&r++,i[t].type==="text"&&t+1=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;a||e.pos++,o[t]=e.pos};Fg.prototype.tokenize=function(e){const t=this.ruler.getRules(""),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(a){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};Fg.prototype.parse=function(e,t,n,r){const i=new this.State(e,t,n,r);this.tokenize(i);const o=this.ruler2.getRules(""),a=o.length;for(let u=0;u|$))",t.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function Q6(e){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){e[r]=n[r]})}),e}function i2(e){return Object.prototype.toString.call(e)}function sqe(e){return i2(e)==="[object String]"}function lqe(e){return i2(e)==="[object Object]"}function cqe(e){return i2(e)==="[object RegExp]"}function EI(e){return i2(e)==="[object Function]"}function fqe(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const eY={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function dqe(e){return Object.keys(e||{}).reduce(function(t,n){return t||eY.hasOwnProperty(n)},!1)}const hqe={"http:":{validate:function(e,t,n){const r=e.slice(t);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){const r=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){const r=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},pqe="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",vqe="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function gqe(e){e.__index__=-1,e.__text_cache__=""}function mqe(e){return function(t,n){const r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function AI(){return function(e,t){t.normalize(e)}}function ax(e){const t=e.re=uqe(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(pqe),n.push(t.src_xn),t.src_tlds=n.join("|");function r(u){return u.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");const i=[];e.__compiled__={};function o(u,s){throw new Error('(LinkifyIt) Invalid schema "'+u+'": '+s)}Object.keys(e.__schemas__).forEach(function(u){const s=e.__schemas__[u];if(s===null)return;const l={validate:null,link:null};if(e.__compiled__[u]=l,lqe(s)){cqe(s.validate)?l.validate=mqe(s.validate):EI(s.validate)?l.validate=s.validate:o(u,s),EI(s.normalize)?l.normalize=s.normalize:s.normalize?o(u,s):l.normalize=AI();return}if(sqe(s)){i.push(u);return}o(u,s)}),i.forEach(function(u){e.__compiled__[e.__schemas__[u]]&&(e.__compiled__[u].validate=e.__compiled__[e.__schemas__[u]].validate,e.__compiled__[u].normalize=e.__compiled__[e.__schemas__[u]].normalize)}),e.__compiled__[""]={validate:null,normalize:AI()};const a=Object.keys(e.__compiled__).filter(function(u){return u.length>0&&e.__compiled__[u]}).map(fqe).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+a+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+a+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),gqe(e)}function yqe(e,t){const n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function J6(e,t){const n=new yqe(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function Uo(e,t){if(!(this instanceof Uo))return new Uo(e,t);t||dqe(e)&&(t=e,e={}),this.__opts__=Q6({},eY,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Q6({},hqe,e),this.__compiled__={},this.__tlds__=vqe,this.__tlds_replaced__=!1,this.re={},ax(this)}Uo.prototype.add=function(t,n){return this.__schemas__[t]=n,ax(this),this};Uo.prototype.set=function(t){return this.__opts__=Q6(this.__opts__,t),this};Uo.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let n,r,i,o,a,u,s,l,c;if(this.re.schema_test.test(t)){for(s=this.re.schema_search,s.lastIndex=0;(n=s.exec(t))!==null;)if(o=this.testSchemaAt(t,n[2],s.lastIndex),o){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=t.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l=0&&(i=t.match(this.re.email_fuzzy))!==null&&(a=i.index+i[1].length,u=i.index+i[0].length,(this.__index__<0||athis.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=u))),this.__index__>=0};Uo.prototype.pretest=function(t){return this.re.pretest.test(t)};Uo.prototype.testSchemaAt=function(t,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(t,r,this):0};Uo.prototype.match=function(t){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===t&&(n.push(J6(this,r)),r=this.__last_index__);let i=r?t.slice(r):t;for(;this.test(i);)n.push(J6(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};Uo.prototype.matchAtStart=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return null;const n=this.re.schema_at_start.exec(t);if(!n)return null;const r=this.testSchemaAt(t,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,J6(this,0)):null};Uo.prototype.tlds=function(t,n){return t=Array.isArray(t)?t:[t],n?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(r,i,o){return r!==o[i-1]}).reverse(),ax(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,ax(this),this)};Uo.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};Uo.prototype.onCompile=function(){};const Md=2147483647,mu=36,iO=1,Xv=26,bqe=38,xqe=700,tY=72,nY=128,rY="-",wqe=/^xn--/,_qe=/[^\0-\x7F]/,Sqe=/[\x2E\u3002\uFF0E\uFF61]/g,Cqe={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g3=mu-iO,yu=Math.floor,m3=String.fromCharCode;function Ys(e){throw new RangeError(Cqe[e])}function Eqe(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function iY(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(Sqe,".");const i=e.split("."),o=Eqe(i,t).join(".");return r+o}function oY(e){const t=[];let n=0;const r=e.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...e),Pqe=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:mu},PI=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},aY=function(e,t,n){let r=0;for(e=n?yu(e/xqe):e>>1,e+=yu(e/t);e>g3*Xv>>1;r+=mu)e=yu(e/g3);return yu(r+(g3+1)*e/(e+bqe))},uY=function(e){const t=[],n=e.length;let r=0,i=nY,o=tY,a=e.lastIndexOf(rY);a<0&&(a=0);for(let u=0;u=128&&Ys("not-basic"),t.push(e.charCodeAt(u));for(let u=a>0?a+1:0;u=n&&Ys("invalid-input");const h=Pqe(e.charCodeAt(u++));h>=mu&&Ys("invalid-input"),h>yu((Md-r)/c)&&Ys("overflow"),r+=h*c;const v=d<=o?iO:d>=o+Xv?Xv:d-o;if(hyu(Md/g)&&Ys("overflow"),c*=g}const l=t.length+1;o=aY(r-s,l,s==0),yu(r/l)>Md-i&&Ys("overflow"),i+=yu(r/l),r%=l,t.splice(r++,0,i)}return String.fromCodePoint(...t)},sY=function(e){const t=[];e=oY(e);const n=e.length;let r=nY,i=0,o=tY;for(const s of e)s<128&&t.push(m3(s));const a=t.length;let u=a;for(a&&t.push(rY);u=r&&cyu((Md-i)/l)&&Ys("overflow"),i+=(s-r)*l,r=s;for(const c of e)if(cMd&&Ys("overflow"),c===r){let d=i;for(let h=mu;;h+=mu){const v=h<=o?iO:h>=o+Xv?Xv:h-o;if(d=0))try{t.hostname=lY.toASCII(t.hostname)}catch{}return Ig(XP(t))}function Lqe(e){const t=QP(e,!0);if(t.hostname&&(!t.protocol||cY.indexOf(t.protocol)>=0))try{t.hostname=lY.toUnicode(t.hostname)}catch{}return bh(XP(t),bh.defaultChars+"%")}function Qa(e,t){if(!(this instanceof Qa))return new Qa(e,t);t||eO(e)||(t=e||{},e="default"),this.inline=new Fg,this.block=new r2,this.core=new nO,this.renderer=new Xh,this.linkify=new Uo,this.validateLink=Nqe,this.normalizeLink=Fqe,this.normalizeLinkText=Lqe,this.utils=BVe,this.helpers=t2({},VVe),this.options={},this.configure(e),t&&this.set(t)}Qa.prototype.set=function(e){return t2(this.options,e),this};Qa.prototype.configure=function(e){const t=this;if(eO(e)){const n=e;if(e=Dqe[n],!e)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this};Qa.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));const r=e.filter(function(i){return n.indexOf(i)<0});if(r.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};Qa.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));const r=e.filter(function(i){return n.indexOf(i)<0});if(r.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};Qa.prototype.use=function(e){const t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this};Qa.prototype.parse=function(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const n=new this.core.State(e,this,t);return this.core.process(n),n.tokens};Qa.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)};Qa.prototype.parseInline=function(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens};Qa.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var fY={exports:{}};(function(e){(function(t){var n=function(k){var D,$=new Float64Array(16);if(k)for(D=0;D>24&255,k[D+1]=$>>16&255,k[D+2]=$>>8&255,k[D+3]=$&255,k[D+4]=P>>24&255,k[D+5]=P>>16&255,k[D+6]=P>>8&255,k[D+7]=P&255}function m(k,D,$,P,N){var ee,ne=0;for(ee=0;ee>>8)-1}function b(k,D,$,P){return m(k,D,$,P,16)}function w(k,D,$,P){return m(k,D,$,P,32)}function x(k,D,$,P){for(var N=P[0]&255|(P[1]&255)<<8|(P[2]&255)<<16|(P[3]&255)<<24,ee=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,ne=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,he=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,Ce=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,Be=P[4]&255|(P[5]&255)<<8|(P[6]&255)<<16|(P[7]&255)<<24,He=D[0]&255|(D[1]&255)<<8|(D[2]&255)<<16|(D[3]&255)<<24,ct=D[4]&255|(D[5]&255)<<8|(D[6]&255)<<16|(D[7]&255)<<24,Ne=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,rt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=P[8]&255|(P[9]&255)<<8|(P[10]&255)<<16|(P[11]&255)<<24,At=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,vt=$[20]&255|($[21]&255)<<8|($[22]&255)<<16|($[23]&255)<<24,ht=$[24]&255|($[25]&255)<<8|($[26]&255)<<16|($[27]&255)<<24,xt=$[28]&255|($[29]&255)<<8|($[30]&255)<<16|($[31]&255)<<24,wt=P[12]&255|(P[13]&255)<<8|(P[14]&255)<<16|(P[15]&255)<<24,Je=N,st=ee,Qe=ne,Le=he,qe=Ce,Ge=Be,me=He,ve=ct,De=Ne,Oe=rt,Te=bt,ze=At,mt=vt,Nt=ht,Ft=xt,$t=wt,te,Gt=0;Gt<20;Gt+=2)te=Je+mt|0,qe^=te<<7|te>>>25,te=qe+Je|0,De^=te<<9|te>>>23,te=De+qe|0,mt^=te<<13|te>>>19,te=mt+De|0,Je^=te<<18|te>>>14,te=Ge+st|0,Oe^=te<<7|te>>>25,te=Oe+Ge|0,Nt^=te<<9|te>>>23,te=Nt+Oe|0,st^=te<<13|te>>>19,te=st+Nt|0,Ge^=te<<18|te>>>14,te=Te+me|0,Ft^=te<<7|te>>>25,te=Ft+Te|0,Qe^=te<<9|te>>>23,te=Qe+Ft|0,me^=te<<13|te>>>19,te=me+Qe|0,Te^=te<<18|te>>>14,te=$t+ze|0,Le^=te<<7|te>>>25,te=Le+$t|0,ve^=te<<9|te>>>23,te=ve+Le|0,ze^=te<<13|te>>>19,te=ze+ve|0,$t^=te<<18|te>>>14,te=Je+Le|0,st^=te<<7|te>>>25,te=st+Je|0,Qe^=te<<9|te>>>23,te=Qe+st|0,Le^=te<<13|te>>>19,te=Le+Qe|0,Je^=te<<18|te>>>14,te=Ge+qe|0,me^=te<<7|te>>>25,te=me+Ge|0,ve^=te<<9|te>>>23,te=ve+me|0,qe^=te<<13|te>>>19,te=qe+ve|0,Ge^=te<<18|te>>>14,te=Te+Oe|0,ze^=te<<7|te>>>25,te=ze+Te|0,De^=te<<9|te>>>23,te=De+ze|0,Oe^=te<<13|te>>>19,te=Oe+De|0,Te^=te<<18|te>>>14,te=$t+Ft|0,mt^=te<<7|te>>>25,te=mt+$t|0,Nt^=te<<9|te>>>23,te=Nt+mt|0,Ft^=te<<13|te>>>19,te=Ft+Nt|0,$t^=te<<18|te>>>14;Je=Je+N|0,st=st+ee|0,Qe=Qe+ne|0,Le=Le+he|0,qe=qe+Ce|0,Ge=Ge+Be|0,me=me+He|0,ve=ve+ct|0,De=De+Ne|0,Oe=Oe+rt|0,Te=Te+bt|0,ze=ze+At|0,mt=mt+vt|0,Nt=Nt+ht|0,Ft=Ft+xt|0,$t=$t+wt|0,k[0]=Je>>>0&255,k[1]=Je>>>8&255,k[2]=Je>>>16&255,k[3]=Je>>>24&255,k[4]=st>>>0&255,k[5]=st>>>8&255,k[6]=st>>>16&255,k[7]=st>>>24&255,k[8]=Qe>>>0&255,k[9]=Qe>>>8&255,k[10]=Qe>>>16&255,k[11]=Qe>>>24&255,k[12]=Le>>>0&255,k[13]=Le>>>8&255,k[14]=Le>>>16&255,k[15]=Le>>>24&255,k[16]=qe>>>0&255,k[17]=qe>>>8&255,k[18]=qe>>>16&255,k[19]=qe>>>24&255,k[20]=Ge>>>0&255,k[21]=Ge>>>8&255,k[22]=Ge>>>16&255,k[23]=Ge>>>24&255,k[24]=me>>>0&255,k[25]=me>>>8&255,k[26]=me>>>16&255,k[27]=me>>>24&255,k[28]=ve>>>0&255,k[29]=ve>>>8&255,k[30]=ve>>>16&255,k[31]=ve>>>24&255,k[32]=De>>>0&255,k[33]=De>>>8&255,k[34]=De>>>16&255,k[35]=De>>>24&255,k[36]=Oe>>>0&255,k[37]=Oe>>>8&255,k[38]=Oe>>>16&255,k[39]=Oe>>>24&255,k[40]=Te>>>0&255,k[41]=Te>>>8&255,k[42]=Te>>>16&255,k[43]=Te>>>24&255,k[44]=ze>>>0&255,k[45]=ze>>>8&255,k[46]=ze>>>16&255,k[47]=ze>>>24&255,k[48]=mt>>>0&255,k[49]=mt>>>8&255,k[50]=mt>>>16&255,k[51]=mt>>>24&255,k[52]=Nt>>>0&255,k[53]=Nt>>>8&255,k[54]=Nt>>>16&255,k[55]=Nt>>>24&255,k[56]=Ft>>>0&255,k[57]=Ft>>>8&255,k[58]=Ft>>>16&255,k[59]=Ft>>>24&255,k[60]=$t>>>0&255,k[61]=$t>>>8&255,k[62]=$t>>>16&255,k[63]=$t>>>24&255}function S(k,D,$,P){for(var N=P[0]&255|(P[1]&255)<<8|(P[2]&255)<<16|(P[3]&255)<<24,ee=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,ne=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,he=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,Ce=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,Be=P[4]&255|(P[5]&255)<<8|(P[6]&255)<<16|(P[7]&255)<<24,He=D[0]&255|(D[1]&255)<<8|(D[2]&255)<<16|(D[3]&255)<<24,ct=D[4]&255|(D[5]&255)<<8|(D[6]&255)<<16|(D[7]&255)<<24,Ne=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,rt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=P[8]&255|(P[9]&255)<<8|(P[10]&255)<<16|(P[11]&255)<<24,At=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,vt=$[20]&255|($[21]&255)<<8|($[22]&255)<<16|($[23]&255)<<24,ht=$[24]&255|($[25]&255)<<8|($[26]&255)<<16|($[27]&255)<<24,xt=$[28]&255|($[29]&255)<<8|($[30]&255)<<16|($[31]&255)<<24,wt=P[12]&255|(P[13]&255)<<8|(P[14]&255)<<16|(P[15]&255)<<24,Je=N,st=ee,Qe=ne,Le=he,qe=Ce,Ge=Be,me=He,ve=ct,De=Ne,Oe=rt,Te=bt,ze=At,mt=vt,Nt=ht,Ft=xt,$t=wt,te,Gt=0;Gt<20;Gt+=2)te=Je+mt|0,qe^=te<<7|te>>>25,te=qe+Je|0,De^=te<<9|te>>>23,te=De+qe|0,mt^=te<<13|te>>>19,te=mt+De|0,Je^=te<<18|te>>>14,te=Ge+st|0,Oe^=te<<7|te>>>25,te=Oe+Ge|0,Nt^=te<<9|te>>>23,te=Nt+Oe|0,st^=te<<13|te>>>19,te=st+Nt|0,Ge^=te<<18|te>>>14,te=Te+me|0,Ft^=te<<7|te>>>25,te=Ft+Te|0,Qe^=te<<9|te>>>23,te=Qe+Ft|0,me^=te<<13|te>>>19,te=me+Qe|0,Te^=te<<18|te>>>14,te=$t+ze|0,Le^=te<<7|te>>>25,te=Le+$t|0,ve^=te<<9|te>>>23,te=ve+Le|0,ze^=te<<13|te>>>19,te=ze+ve|0,$t^=te<<18|te>>>14,te=Je+Le|0,st^=te<<7|te>>>25,te=st+Je|0,Qe^=te<<9|te>>>23,te=Qe+st|0,Le^=te<<13|te>>>19,te=Le+Qe|0,Je^=te<<18|te>>>14,te=Ge+qe|0,me^=te<<7|te>>>25,te=me+Ge|0,ve^=te<<9|te>>>23,te=ve+me|0,qe^=te<<13|te>>>19,te=qe+ve|0,Ge^=te<<18|te>>>14,te=Te+Oe|0,ze^=te<<7|te>>>25,te=ze+Te|0,De^=te<<9|te>>>23,te=De+ze|0,Oe^=te<<13|te>>>19,te=Oe+De|0,Te^=te<<18|te>>>14,te=$t+Ft|0,mt^=te<<7|te>>>25,te=mt+$t|0,Nt^=te<<9|te>>>23,te=Nt+mt|0,Ft^=te<<13|te>>>19,te=Ft+Nt|0,$t^=te<<18|te>>>14;k[0]=Je>>>0&255,k[1]=Je>>>8&255,k[2]=Je>>>16&255,k[3]=Je>>>24&255,k[4]=Ge>>>0&255,k[5]=Ge>>>8&255,k[6]=Ge>>>16&255,k[7]=Ge>>>24&255,k[8]=Te>>>0&255,k[9]=Te>>>8&255,k[10]=Te>>>16&255,k[11]=Te>>>24&255,k[12]=$t>>>0&255,k[13]=$t>>>8&255,k[14]=$t>>>16&255,k[15]=$t>>>24&255,k[16]=me>>>0&255,k[17]=me>>>8&255,k[18]=me>>>16&255,k[19]=me>>>24&255,k[20]=ve>>>0&255,k[21]=ve>>>8&255,k[22]=ve>>>16&255,k[23]=ve>>>24&255,k[24]=De>>>0&255,k[25]=De>>>8&255,k[26]=De>>>16&255,k[27]=De>>>24&255,k[28]=Oe>>>0&255,k[29]=Oe>>>8&255,k[30]=Oe>>>16&255,k[31]=Oe>>>24&255}function A(k,D,$,P){x(k,D,$,P)}function E(k,D,$,P){S(k,D,$,P)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T(k,D,$,P,N,ee,ne){var he=new Uint8Array(16),Ce=new Uint8Array(64),Be,He;for(He=0;He<16;He++)he[He]=0;for(He=0;He<8;He++)he[He]=ee[He];for(;N>=64;){for(A(Ce,he,ne,C),He=0;He<64;He++)k[D+He]=$[P+He]^Ce[He];for(Be=1,He=8;He<16;He++)Be=Be+(he[He]&255)|0,he[He]=Be&255,Be>>>=8;N-=64,D+=64,P+=64}if(N>0)for(A(Ce,he,ne,C),He=0;He=64;){for(A(ne,ee,N,C),Ce=0;Ce<64;Ce++)k[D+Ce]=ne[Ce];for(he=1,Ce=8;Ce<16;Ce++)he=he+(ee[Ce]&255)|0,ee[Ce]=he&255,he>>>=8;$-=64,D+=64}if($>0)for(A(ne,ee,N,C),Ce=0;Ce<$;Ce++)k[D+Ce]=ne[Ce];return 0}function F(k,D,$,P,N){var ee=new Uint8Array(32);E(ee,P,N,C);for(var ne=new Uint8Array(8),he=0;he<8;he++)ne[he]=P[he+16];return M(k,D,$,ne,ee)}function U(k,D,$,P,N,ee,ne){var he=new Uint8Array(32);E(he,ee,ne,C);for(var Ce=new Uint8Array(8),Be=0;Be<8;Be++)Ce[Be]=ee[Be+16];return T(k,D,$,P,N,Ce,he)}var H=function(k){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var D,$,P,N,ee,ne,he,Ce;D=k[0]&255|(k[1]&255)<<8,this.r[0]=D&8191,$=k[2]&255|(k[3]&255)<<8,this.r[1]=(D>>>13|$<<3)&8191,P=k[4]&255|(k[5]&255)<<8,this.r[2]=($>>>10|P<<6)&7939,N=k[6]&255|(k[7]&255)<<8,this.r[3]=(P>>>7|N<<9)&8191,ee=k[8]&255|(k[9]&255)<<8,this.r[4]=(N>>>4|ee<<12)&255,this.r[5]=ee>>>1&8190,ne=k[10]&255|(k[11]&255)<<8,this.r[6]=(ee>>>14|ne<<2)&8191,he=k[12]&255|(k[13]&255)<<8,this.r[7]=(ne>>>11|he<<5)&8065,Ce=k[14]&255|(k[15]&255)<<8,this.r[8]=(he>>>8|Ce<<8)&8191,this.r[9]=Ce>>>5&127,this.pad[0]=k[16]&255|(k[17]&255)<<8,this.pad[1]=k[18]&255|(k[19]&255)<<8,this.pad[2]=k[20]&255|(k[21]&255)<<8,this.pad[3]=k[22]&255|(k[23]&255)<<8,this.pad[4]=k[24]&255|(k[25]&255)<<8,this.pad[5]=k[26]&255|(k[27]&255)<<8,this.pad[6]=k[28]&255|(k[29]&255)<<8,this.pad[7]=k[30]&255|(k[31]&255)<<8};H.prototype.blocks=function(k,D,$){for(var P=this.fin?0:2048,N,ee,ne,he,Ce,Be,He,ct,Ne,rt,bt,At,vt,ht,xt,wt,Je,st,Qe,Le=this.h[0],qe=this.h[1],Ge=this.h[2],me=this.h[3],ve=this.h[4],De=this.h[5],Oe=this.h[6],Te=this.h[7],ze=this.h[8],mt=this.h[9],Nt=this.r[0],Ft=this.r[1],$t=this.r[2],te=this.r[3],Gt=this.r[4],an=this.r[5],un=this.r[6],Lt=this.r[7],sn=this.r[8],tn=this.r[9];$>=16;)N=k[D+0]&255|(k[D+1]&255)<<8,Le+=N&8191,ee=k[D+2]&255|(k[D+3]&255)<<8,qe+=(N>>>13|ee<<3)&8191,ne=k[D+4]&255|(k[D+5]&255)<<8,Ge+=(ee>>>10|ne<<6)&8191,he=k[D+6]&255|(k[D+7]&255)<<8,me+=(ne>>>7|he<<9)&8191,Ce=k[D+8]&255|(k[D+9]&255)<<8,ve+=(he>>>4|Ce<<12)&8191,De+=Ce>>>1&8191,Be=k[D+10]&255|(k[D+11]&255)<<8,Oe+=(Ce>>>14|Be<<2)&8191,He=k[D+12]&255|(k[D+13]&255)<<8,Te+=(Be>>>11|He<<5)&8191,ct=k[D+14]&255|(k[D+15]&255)<<8,ze+=(He>>>8|ct<<8)&8191,mt+=ct>>>5|P,Ne=0,rt=Ne,rt+=Le*Nt,rt+=qe*(5*tn),rt+=Ge*(5*sn),rt+=me*(5*Lt),rt+=ve*(5*un),Ne=rt>>>13,rt&=8191,rt+=De*(5*an),rt+=Oe*(5*Gt),rt+=Te*(5*te),rt+=ze*(5*$t),rt+=mt*(5*Ft),Ne+=rt>>>13,rt&=8191,bt=Ne,bt+=Le*Ft,bt+=qe*Nt,bt+=Ge*(5*tn),bt+=me*(5*sn),bt+=ve*(5*Lt),Ne=bt>>>13,bt&=8191,bt+=De*(5*un),bt+=Oe*(5*an),bt+=Te*(5*Gt),bt+=ze*(5*te),bt+=mt*(5*$t),Ne+=bt>>>13,bt&=8191,At=Ne,At+=Le*$t,At+=qe*Ft,At+=Ge*Nt,At+=me*(5*tn),At+=ve*(5*sn),Ne=At>>>13,At&=8191,At+=De*(5*Lt),At+=Oe*(5*un),At+=Te*(5*an),At+=ze*(5*Gt),At+=mt*(5*te),Ne+=At>>>13,At&=8191,vt=Ne,vt+=Le*te,vt+=qe*$t,vt+=Ge*Ft,vt+=me*Nt,vt+=ve*(5*tn),Ne=vt>>>13,vt&=8191,vt+=De*(5*sn),vt+=Oe*(5*Lt),vt+=Te*(5*un),vt+=ze*(5*an),vt+=mt*(5*Gt),Ne+=vt>>>13,vt&=8191,ht=Ne,ht+=Le*Gt,ht+=qe*te,ht+=Ge*$t,ht+=me*Ft,ht+=ve*Nt,Ne=ht>>>13,ht&=8191,ht+=De*(5*tn),ht+=Oe*(5*sn),ht+=Te*(5*Lt),ht+=ze*(5*un),ht+=mt*(5*an),Ne+=ht>>>13,ht&=8191,xt=Ne,xt+=Le*an,xt+=qe*Gt,xt+=Ge*te,xt+=me*$t,xt+=ve*Ft,Ne=xt>>>13,xt&=8191,xt+=De*Nt,xt+=Oe*(5*tn),xt+=Te*(5*sn),xt+=ze*(5*Lt),xt+=mt*(5*un),Ne+=xt>>>13,xt&=8191,wt=Ne,wt+=Le*un,wt+=qe*an,wt+=Ge*Gt,wt+=me*te,wt+=ve*$t,Ne=wt>>>13,wt&=8191,wt+=De*Ft,wt+=Oe*Nt,wt+=Te*(5*tn),wt+=ze*(5*sn),wt+=mt*(5*Lt),Ne+=wt>>>13,wt&=8191,Je=Ne,Je+=Le*Lt,Je+=qe*un,Je+=Ge*an,Je+=me*Gt,Je+=ve*te,Ne=Je>>>13,Je&=8191,Je+=De*$t,Je+=Oe*Ft,Je+=Te*Nt,Je+=ze*(5*tn),Je+=mt*(5*sn),Ne+=Je>>>13,Je&=8191,st=Ne,st+=Le*sn,st+=qe*Lt,st+=Ge*un,st+=me*an,st+=ve*Gt,Ne=st>>>13,st&=8191,st+=De*te,st+=Oe*$t,st+=Te*Ft,st+=ze*Nt,st+=mt*(5*tn),Ne+=st>>>13,st&=8191,Qe=Ne,Qe+=Le*tn,Qe+=qe*sn,Qe+=Ge*Lt,Qe+=me*un,Qe+=ve*an,Ne=Qe>>>13,Qe&=8191,Qe+=De*Gt,Qe+=Oe*te,Qe+=Te*$t,Qe+=ze*Ft,Qe+=mt*Nt,Ne+=Qe>>>13,Qe&=8191,Ne=(Ne<<2)+Ne|0,Ne=Ne+rt|0,rt=Ne&8191,Ne=Ne>>>13,bt+=Ne,Le=rt,qe=bt,Ge=At,me=vt,ve=ht,De=xt,Oe=wt,Te=Je,ze=st,mt=Qe,D+=16,$-=16;this.h[0]=Le,this.h[1]=qe,this.h[2]=Ge,this.h[3]=me,this.h[4]=ve,this.h[5]=De,this.h[6]=Oe,this.h[7]=Te,this.h[8]=ze,this.h[9]=mt},H.prototype.finish=function(k,D){var $=new Uint16Array(10),P,N,ee,ne;if(this.leftover){for(ne=this.leftover,this.buffer[ne++]=1;ne<16;ne++)this.buffer[ne]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(P=this.h[1]>>>13,this.h[1]&=8191,ne=2;ne<10;ne++)this.h[ne]+=P,P=this.h[ne]>>>13,this.h[ne]&=8191;for(this.h[0]+=P*5,P=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=P,P=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=P,$[0]=this.h[0]+5,P=$[0]>>>13,$[0]&=8191,ne=1;ne<10;ne++)$[ne]=this.h[ne]+P,P=$[ne]>>>13,$[ne]&=8191;for($[9]-=8192,N=(P^1)-1,ne=0;ne<10;ne++)$[ne]&=N;for(N=~N,ne=0;ne<10;ne++)this.h[ne]=this.h[ne]&N|$[ne];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,ee=this.h[0]+this.pad[0],this.h[0]=ee&65535,ne=1;ne<8;ne++)ee=(this.h[ne]+this.pad[ne]|0)+(ee>>>16)|0,this.h[ne]=ee&65535;k[D+0]=this.h[0]>>>0&255,k[D+1]=this.h[0]>>>8&255,k[D+2]=this.h[1]>>>0&255,k[D+3]=this.h[1]>>>8&255,k[D+4]=this.h[2]>>>0&255,k[D+5]=this.h[2]>>>8&255,k[D+6]=this.h[3]>>>0&255,k[D+7]=this.h[3]>>>8&255,k[D+8]=this.h[4]>>>0&255,k[D+9]=this.h[4]>>>8&255,k[D+10]=this.h[5]>>>0&255,k[D+11]=this.h[5]>>>8&255,k[D+12]=this.h[6]>>>0&255,k[D+13]=this.h[6]>>>8&255,k[D+14]=this.h[7]>>>0&255,k[D+15]=this.h[7]>>>8&255},H.prototype.update=function(k,D,$){var P,N;if(this.leftover){for(N=16-this.leftover,N>$&&(N=$),P=0;P=16&&(N=$-$%16,this.blocks(k,D,N),D+=N,$-=N),$){for(P=0;P<$;P++)this.buffer[this.leftover+P]=k[D+P];this.leftover+=$}};function W(k,D,$,P,N,ee){var ne=new H(ee);return ne.update($,P,N),ne.finish(k,D),0}function ie(k,D,$,P,N,ee){var ne=new Uint8Array(16);return W(ne,0,$,P,N,ee),b(k,D,ne,0)}function Z(k,D,$,P,N){var ee;if($<32)return-1;for(U(k,0,D,0,$,P,N),W(k,16,k,32,$-32,k),ee=0;ee<16;ee++)k[ee]=0;return 0}function G(k,D,$,P,N){var ee,ne=new Uint8Array(32);if($<32||(F(ne,0,32,P,N),ie(D,16,D,32,$-32,ne)!==0))return-1;for(U(k,0,D,0,$,P,N),ee=0;ee<32;ee++)k[ee]=0;return 0}function K(k,D){var $;for($=0;$<16;$++)k[$]=D[$]|0}function V(k){var D,$,P=1;for(D=0;D<16;D++)$=k[D]+P+65535,P=Math.floor($/65536),k[D]=$-P*65536;k[0]+=P-1+37*(P-1)}function B(k,D,$){for(var P,N=~($-1),ee=0;ee<16;ee++)P=N&(k[ee]^D[ee]),k[ee]^=P,D[ee]^=P}function q(k,D){var $,P,N,ee=n(),ne=n();for($=0;$<16;$++)ne[$]=D[$];for(V(ne),V(ne),V(ne),P=0;P<2;P++){for(ee[0]=ne[0]-65517,$=1;$<15;$++)ee[$]=ne[$]-65535-(ee[$-1]>>16&1),ee[$-1]&=65535;ee[15]=ne[15]-32767-(ee[14]>>16&1),N=ee[15]>>16&1,ee[14]&=65535,B(ne,ee,1-N)}for($=0;$<16;$++)k[2*$]=ne[$]&255,k[2*$+1]=ne[$]>>8}function Y(k,D){var $=new Uint8Array(32),P=new Uint8Array(32);return q($,k),q(P,D),w($,0,P,0)}function ue(k){var D=new Uint8Array(32);return q(D,k),D[0]&1}function Q(k,D){var $;for($=0;$<16;$++)k[$]=D[2*$]+(D[2*$+1]<<8);k[15]&=32767}function J(k,D,$){for(var P=0;P<16;P++)k[P]=D[P]+$[P]}function se(k,D,$){for(var P=0;P<16;P++)k[P]=D[P]-$[P]}function de(k,D,$){var P,N,ee=0,ne=0,he=0,Ce=0,Be=0,He=0,ct=0,Ne=0,rt=0,bt=0,At=0,vt=0,ht=0,xt=0,wt=0,Je=0,st=0,Qe=0,Le=0,qe=0,Ge=0,me=0,ve=0,De=0,Oe=0,Te=0,ze=0,mt=0,Nt=0,Ft=0,$t=0,te=$[0],Gt=$[1],an=$[2],un=$[3],Lt=$[4],sn=$[5],tn=$[6],Kn=$[7],vn=$[8],On=$[9],Gn=$[10],Yn=$[11],xr=$[12],$r=$[13],Ir=$[14],Nr=$[15];P=D[0],ee+=P*te,ne+=P*Gt,he+=P*an,Ce+=P*un,Be+=P*Lt,He+=P*sn,ct+=P*tn,Ne+=P*Kn,rt+=P*vn,bt+=P*On,At+=P*Gn,vt+=P*Yn,ht+=P*xr,xt+=P*$r,wt+=P*Ir,Je+=P*Nr,P=D[1],ne+=P*te,he+=P*Gt,Ce+=P*an,Be+=P*un,He+=P*Lt,ct+=P*sn,Ne+=P*tn,rt+=P*Kn,bt+=P*vn,At+=P*On,vt+=P*Gn,ht+=P*Yn,xt+=P*xr,wt+=P*$r,Je+=P*Ir,st+=P*Nr,P=D[2],he+=P*te,Ce+=P*Gt,Be+=P*an,He+=P*un,ct+=P*Lt,Ne+=P*sn,rt+=P*tn,bt+=P*Kn,At+=P*vn,vt+=P*On,ht+=P*Gn,xt+=P*Yn,wt+=P*xr,Je+=P*$r,st+=P*Ir,Qe+=P*Nr,P=D[3],Ce+=P*te,Be+=P*Gt,He+=P*an,ct+=P*un,Ne+=P*Lt,rt+=P*sn,bt+=P*tn,At+=P*Kn,vt+=P*vn,ht+=P*On,xt+=P*Gn,wt+=P*Yn,Je+=P*xr,st+=P*$r,Qe+=P*Ir,Le+=P*Nr,P=D[4],Be+=P*te,He+=P*Gt,ct+=P*an,Ne+=P*un,rt+=P*Lt,bt+=P*sn,At+=P*tn,vt+=P*Kn,ht+=P*vn,xt+=P*On,wt+=P*Gn,Je+=P*Yn,st+=P*xr,Qe+=P*$r,Le+=P*Ir,qe+=P*Nr,P=D[5],He+=P*te,ct+=P*Gt,Ne+=P*an,rt+=P*un,bt+=P*Lt,At+=P*sn,vt+=P*tn,ht+=P*Kn,xt+=P*vn,wt+=P*On,Je+=P*Gn,st+=P*Yn,Qe+=P*xr,Le+=P*$r,qe+=P*Ir,Ge+=P*Nr,P=D[6],ct+=P*te,Ne+=P*Gt,rt+=P*an,bt+=P*un,At+=P*Lt,vt+=P*sn,ht+=P*tn,xt+=P*Kn,wt+=P*vn,Je+=P*On,st+=P*Gn,Qe+=P*Yn,Le+=P*xr,qe+=P*$r,Ge+=P*Ir,me+=P*Nr,P=D[7],Ne+=P*te,rt+=P*Gt,bt+=P*an,At+=P*un,vt+=P*Lt,ht+=P*sn,xt+=P*tn,wt+=P*Kn,Je+=P*vn,st+=P*On,Qe+=P*Gn,Le+=P*Yn,qe+=P*xr,Ge+=P*$r,me+=P*Ir,ve+=P*Nr,P=D[8],rt+=P*te,bt+=P*Gt,At+=P*an,vt+=P*un,ht+=P*Lt,xt+=P*sn,wt+=P*tn,Je+=P*Kn,st+=P*vn,Qe+=P*On,Le+=P*Gn,qe+=P*Yn,Ge+=P*xr,me+=P*$r,ve+=P*Ir,De+=P*Nr,P=D[9],bt+=P*te,At+=P*Gt,vt+=P*an,ht+=P*un,xt+=P*Lt,wt+=P*sn,Je+=P*tn,st+=P*Kn,Qe+=P*vn,Le+=P*On,qe+=P*Gn,Ge+=P*Yn,me+=P*xr,ve+=P*$r,De+=P*Ir,Oe+=P*Nr,P=D[10],At+=P*te,vt+=P*Gt,ht+=P*an,xt+=P*un,wt+=P*Lt,Je+=P*sn,st+=P*tn,Qe+=P*Kn,Le+=P*vn,qe+=P*On,Ge+=P*Gn,me+=P*Yn,ve+=P*xr,De+=P*$r,Oe+=P*Ir,Te+=P*Nr,P=D[11],vt+=P*te,ht+=P*Gt,xt+=P*an,wt+=P*un,Je+=P*Lt,st+=P*sn,Qe+=P*tn,Le+=P*Kn,qe+=P*vn,Ge+=P*On,me+=P*Gn,ve+=P*Yn,De+=P*xr,Oe+=P*$r,Te+=P*Ir,ze+=P*Nr,P=D[12],ht+=P*te,xt+=P*Gt,wt+=P*an,Je+=P*un,st+=P*Lt,Qe+=P*sn,Le+=P*tn,qe+=P*Kn,Ge+=P*vn,me+=P*On,ve+=P*Gn,De+=P*Yn,Oe+=P*xr,Te+=P*$r,ze+=P*Ir,mt+=P*Nr,P=D[13],xt+=P*te,wt+=P*Gt,Je+=P*an,st+=P*un,Qe+=P*Lt,Le+=P*sn,qe+=P*tn,Ge+=P*Kn,me+=P*vn,ve+=P*On,De+=P*Gn,Oe+=P*Yn,Te+=P*xr,ze+=P*$r,mt+=P*Ir,Nt+=P*Nr,P=D[14],wt+=P*te,Je+=P*Gt,st+=P*an,Qe+=P*un,Le+=P*Lt,qe+=P*sn,Ge+=P*tn,me+=P*Kn,ve+=P*vn,De+=P*On,Oe+=P*Gn,Te+=P*Yn,ze+=P*xr,mt+=P*$r,Nt+=P*Ir,Ft+=P*Nr,P=D[15],Je+=P*te,st+=P*Gt,Qe+=P*an,Le+=P*un,qe+=P*Lt,Ge+=P*sn,me+=P*tn,ve+=P*Kn,De+=P*vn,Oe+=P*On,Te+=P*Gn,ze+=P*Yn,mt+=P*xr,Nt+=P*$r,Ft+=P*Ir,$t+=P*Nr,ee+=38*st,ne+=38*Qe,he+=38*Le,Ce+=38*qe,Be+=38*Ge,He+=38*me,ct+=38*ve,Ne+=38*De,rt+=38*Oe,bt+=38*Te,At+=38*ze,vt+=38*mt,ht+=38*Nt,xt+=38*Ft,wt+=38*$t,N=1,P=ee+N+65535,N=Math.floor(P/65536),ee=P-N*65536,P=ne+N+65535,N=Math.floor(P/65536),ne=P-N*65536,P=he+N+65535,N=Math.floor(P/65536),he=P-N*65536,P=Ce+N+65535,N=Math.floor(P/65536),Ce=P-N*65536,P=Be+N+65535,N=Math.floor(P/65536),Be=P-N*65536,P=He+N+65535,N=Math.floor(P/65536),He=P-N*65536,P=ct+N+65535,N=Math.floor(P/65536),ct=P-N*65536,P=Ne+N+65535,N=Math.floor(P/65536),Ne=P-N*65536,P=rt+N+65535,N=Math.floor(P/65536),rt=P-N*65536,P=bt+N+65535,N=Math.floor(P/65536),bt=P-N*65536,P=At+N+65535,N=Math.floor(P/65536),At=P-N*65536,P=vt+N+65535,N=Math.floor(P/65536),vt=P-N*65536,P=ht+N+65535,N=Math.floor(P/65536),ht=P-N*65536,P=xt+N+65535,N=Math.floor(P/65536),xt=P-N*65536,P=wt+N+65535,N=Math.floor(P/65536),wt=P-N*65536,P=Je+N+65535,N=Math.floor(P/65536),Je=P-N*65536,ee+=N-1+37*(N-1),N=1,P=ee+N+65535,N=Math.floor(P/65536),ee=P-N*65536,P=ne+N+65535,N=Math.floor(P/65536),ne=P-N*65536,P=he+N+65535,N=Math.floor(P/65536),he=P-N*65536,P=Ce+N+65535,N=Math.floor(P/65536),Ce=P-N*65536,P=Be+N+65535,N=Math.floor(P/65536),Be=P-N*65536,P=He+N+65535,N=Math.floor(P/65536),He=P-N*65536,P=ct+N+65535,N=Math.floor(P/65536),ct=P-N*65536,P=Ne+N+65535,N=Math.floor(P/65536),Ne=P-N*65536,P=rt+N+65535,N=Math.floor(P/65536),rt=P-N*65536,P=bt+N+65535,N=Math.floor(P/65536),bt=P-N*65536,P=At+N+65535,N=Math.floor(P/65536),At=P-N*65536,P=vt+N+65535,N=Math.floor(P/65536),vt=P-N*65536,P=ht+N+65535,N=Math.floor(P/65536),ht=P-N*65536,P=xt+N+65535,N=Math.floor(P/65536),xt=P-N*65536,P=wt+N+65535,N=Math.floor(P/65536),wt=P-N*65536,P=Je+N+65535,N=Math.floor(P/65536),Je=P-N*65536,ee+=N-1+37*(N-1),k[0]=ee,k[1]=ne,k[2]=he,k[3]=Ce,k[4]=Be,k[5]=He,k[6]=ct,k[7]=Ne,k[8]=rt,k[9]=bt,k[10]=At,k[11]=vt,k[12]=ht,k[13]=xt,k[14]=wt,k[15]=Je}function Se(k,D){de(k,D,D)}function ge(k,D){var $=n(),P;for(P=0;P<16;P++)$[P]=D[P];for(P=253;P>=0;P--)Se($,$),P!==2&&P!==4&&de($,$,D);for(P=0;P<16;P++)k[P]=$[P]}function Ze(k,D){var $=n(),P;for(P=0;P<16;P++)$[P]=D[P];for(P=250;P>=0;P--)Se($,$),P!==1&&de($,$,D);for(P=0;P<16;P++)k[P]=$[P]}function Pe(k,D,$){var P=new Uint8Array(32),N=new Float64Array(80),ee,ne,he=n(),Ce=n(),Be=n(),He=n(),ct=n(),Ne=n();for(ne=0;ne<31;ne++)P[ne]=D[ne];for(P[31]=D[31]&127|64,P[0]&=248,Q(N,$),ne=0;ne<16;ne++)Ce[ne]=N[ne],He[ne]=he[ne]=Be[ne]=0;for(he[0]=He[0]=1,ne=254;ne>=0;--ne)ee=P[ne>>>3]>>>(ne&7)&1,B(he,Ce,ee),B(Be,He,ee),J(ct,he,Be),se(he,he,Be),J(Be,Ce,He),se(Ce,Ce,He),Se(He,ct),Se(Ne,he),de(he,Be,he),de(Be,Ce,ct),J(ct,he,Be),se(he,he,Be),Se(Ce,he),se(Be,He,Ne),de(he,Be,s),J(he,he,He),de(Be,Be,he),de(he,He,Ne),de(He,Ce,N),Se(Ce,ct),B(he,Ce,ee),B(Be,He,ee);for(ne=0;ne<16;ne++)N[ne+16]=he[ne],N[ne+32]=Be[ne],N[ne+48]=Ce[ne],N[ne+64]=He[ne];var rt=N.subarray(32),bt=N.subarray(16);return ge(rt,rt),de(bt,bt,rt),q(k,bt),0}function Fe(k,D){return Pe(k,D,o)}function $e(k,D){return r(D,32),Fe(k,D)}function be(k,D,$){var P=new Uint8Array(32);return Pe(P,$,D),E(k,i,P,C)}var yt=Z,lt=G;function It(k,D,$,P,N,ee){var ne=new Uint8Array(32);return be(ne,N,ee),yt(k,D,$,P,ne)}function mn(k,D,$,P,N,ee){var ne=new Uint8Array(32);return be(ne,N,ee),lt(k,D,$,P,ne)}var en=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function re(k,D,$,P){for(var N=new Int32Array(16),ee=new Int32Array(16),ne,he,Ce,Be,He,ct,Ne,rt,bt,At,vt,ht,xt,wt,Je,st,Qe,Le,qe,Ge,me,ve,De,Oe,Te,ze,mt=k[0],Nt=k[1],Ft=k[2],$t=k[3],te=k[4],Gt=k[5],an=k[6],un=k[7],Lt=D[0],sn=D[1],tn=D[2],Kn=D[3],vn=D[4],On=D[5],Gn=D[6],Yn=D[7],xr=0;P>=128;){for(qe=0;qe<16;qe++)Ge=8*qe+xr,N[qe]=$[Ge+0]<<24|$[Ge+1]<<16|$[Ge+2]<<8|$[Ge+3],ee[qe]=$[Ge+4]<<24|$[Ge+5]<<16|$[Ge+6]<<8|$[Ge+7];for(qe=0;qe<80;qe++)if(ne=mt,he=Nt,Ce=Ft,Be=$t,He=te,ct=Gt,Ne=an,rt=un,bt=Lt,At=sn,vt=tn,ht=Kn,xt=vn,wt=On,Je=Gn,st=Yn,me=un,ve=Yn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=(te>>>14|vn<<18)^(te>>>18|vn<<14)^(vn>>>9|te<<23),ve=(vn>>>14|te<<18)^(vn>>>18|te<<14)^(te>>>9|vn<<23),De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=te&Gt^~te&an,ve=vn&On^~vn&Gn,De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=en[qe*2],ve=en[qe*2+1],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=N[qe%16],ve=ee[qe%16],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,Qe=Te&65535|ze<<16,Le=De&65535|Oe<<16,me=Qe,ve=Le,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=(mt>>>28|Lt<<4)^(Lt>>>2|mt<<30)^(Lt>>>7|mt<<25),ve=(Lt>>>28|mt<<4)^(mt>>>2|Lt<<30)^(mt>>>7|Lt<<25),De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=mt&Nt^mt&Ft^Nt&Ft,ve=Lt&sn^Lt&tn^sn&tn,De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,rt=Te&65535|ze<<16,st=De&65535|Oe<<16,me=Be,ve=ht,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=Qe,ve=Le,De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,Be=Te&65535|ze<<16,ht=De&65535|Oe<<16,Nt=ne,Ft=he,$t=Ce,te=Be,Gt=He,an=ct,un=Ne,mt=rt,sn=bt,tn=At,Kn=vt,vn=ht,On=xt,Gn=wt,Yn=Je,Lt=st,qe%16===15)for(Ge=0;Ge<16;Ge++)me=N[Ge],ve=ee[Ge],De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=N[(Ge+9)%16],ve=ee[(Ge+9)%16],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Qe=N[(Ge+1)%16],Le=ee[(Ge+1)%16],me=(Qe>>>1|Le<<31)^(Qe>>>8|Le<<24)^Qe>>>7,ve=(Le>>>1|Qe<<31)^(Le>>>8|Qe<<24)^(Le>>>7|Qe<<25),De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Qe=N[(Ge+14)%16],Le=ee[(Ge+14)%16],me=(Qe>>>19|Le<<13)^(Le>>>29|Qe<<3)^Qe>>>6,ve=(Le>>>19|Qe<<13)^(Qe>>>29|Le<<3)^(Le>>>6|Qe<<26),De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,N[Ge]=Te&65535|ze<<16,ee[Ge]=De&65535|Oe<<16;me=mt,ve=Lt,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[0],ve=D[0],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[0]=mt=Te&65535|ze<<16,D[0]=Lt=De&65535|Oe<<16,me=Nt,ve=sn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[1],ve=D[1],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[1]=Nt=Te&65535|ze<<16,D[1]=sn=De&65535|Oe<<16,me=Ft,ve=tn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[2],ve=D[2],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[2]=Ft=Te&65535|ze<<16,D[2]=tn=De&65535|Oe<<16,me=$t,ve=Kn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[3],ve=D[3],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[3]=$t=Te&65535|ze<<16,D[3]=Kn=De&65535|Oe<<16,me=te,ve=vn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[4],ve=D[4],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[4]=te=Te&65535|ze<<16,D[4]=vn=De&65535|Oe<<16,me=Gt,ve=On,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[5],ve=D[5],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[5]=Gt=Te&65535|ze<<16,D[5]=On=De&65535|Oe<<16,me=an,ve=Gn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[6],ve=D[6],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[6]=an=Te&65535|ze<<16,D[6]=Gn=De&65535|Oe<<16,me=un,ve=Yn,De=ve&65535,Oe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[7],ve=D[7],De+=ve&65535,Oe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Oe+=De>>>16,Te+=Oe>>>16,ze+=Te>>>16,k[7]=un=Te&65535|ze<<16,D[7]=Yn=De&65535|Oe<<16,xr+=128,P-=128}return P}function pe(k,D,$){var P=new Int32Array(8),N=new Int32Array(8),ee=new Uint8Array(256),ne,he=$;for(P[0]=1779033703,P[1]=3144134277,P[2]=1013904242,P[3]=2773480762,P[4]=1359893119,P[5]=2600822924,P[6]=528734635,P[7]=1541459225,N[0]=4089235720,N[1]=2227873595,N[2]=4271175723,N[3]=1595750129,N[4]=2917565137,N[5]=725511199,N[6]=4215389547,N[7]=327033209,re(P,N,D,$),$%=128,ne=0;ne<$;ne++)ee[ne]=D[he-$+ne];for(ee[$]=128,$=256-128*($<112?1:0),ee[$-9]=0,g(ee,$-8,he/536870912|0,he<<3),re(P,N,ee,$),ne=0;ne<8;ne++)g(k,8*ne,P[ne],N[ne]);return 0}function ye(k,D){var $=n(),P=n(),N=n(),ee=n(),ne=n(),he=n(),Ce=n(),Be=n(),He=n();se($,k[1],k[0]),se(He,D[1],D[0]),de($,$,He),J(P,k[0],k[1]),J(He,D[0],D[1]),de(P,P,He),de(N,k[3],D[3]),de(N,N,c),de(ee,k[2],D[2]),J(ee,ee,ee),se(ne,P,$),se(he,ee,N),J(Ce,ee,N),J(Be,P,$),de(k[0],ne,he),de(k[1],Be,Ce),de(k[2],Ce,he),de(k[3],ne,Be)}function Ue(k,D,$){var P;for(P=0;P<4;P++)B(k[P],D[P],$)}function je(k,D){var $=n(),P=n(),N=n();ge(N,D[2]),de($,D[0],N),de(P,D[1],N),q(k,P),k[31]^=ue($)<<7}function ke(k,D,$){var P,N;for(K(k[0],a),K(k[1],u),K(k[2],u),K(k[3],a),N=255;N>=0;--N)P=$[N/8|0]>>(N&7)&1,Ue(k,D,P),ye(D,k),ye(k,k),Ue(k,D,P)}function nt(k,D){var $=[n(),n(),n(),n()];K($[0],d),K($[1],h),K($[2],u),de($[3],d,h),ke(k,$,D)}function gt(k,D,$){var P=new Uint8Array(64),N=[n(),n(),n(),n()],ee;for($||r(D,32),pe(P,D,32),P[0]&=248,P[31]&=127,P[31]|=64,nt(N,P),je(k,N),ee=0;ee<32;ee++)D[ee+32]=k[ee];return 0}var bn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Vt(k,D){var $,P,N,ee;for(P=63;P>=32;--P){for($=0,N=P-32,ee=P-12;N>4)*bn[N],$=D[N]>>8,D[N]&=255;for(N=0;N<32;N++)D[N]-=$*bn[N];for(P=0;P<32;P++)D[P+1]+=D[P]>>8,k[P]=D[P]&255}function xn(k){var D=new Float64Array(64),$;for($=0;$<64;$++)D[$]=k[$];for($=0;$<64;$++)k[$]=0;Vt(k,D)}function Ii(k,D,$,P){var N=new Uint8Array(64),ee=new Uint8Array(64),ne=new Uint8Array(64),he,Ce,Be=new Float64Array(64),He=[n(),n(),n(),n()];pe(N,P,32),N[0]&=248,N[31]&=127,N[31]|=64;var ct=$+64;for(he=0;he<$;he++)k[64+he]=D[he];for(he=0;he<32;he++)k[32+he]=N[32+he];for(pe(ne,k.subarray(32),$+32),xn(ne),nt(He,ne),je(k,He),he=32;he<64;he++)k[he]=P[he];for(pe(ee,k,$+64),xn(ee),he=0;he<64;he++)Be[he]=0;for(he=0;he<32;he++)Be[he]=ne[he];for(he=0;he<32;he++)for(Ce=0;Ce<32;Ce++)Be[he+Ce]+=ee[he]*N[Ce];return Vt(k.subarray(32),Be),ct}function br(k,D){var $=n(),P=n(),N=n(),ee=n(),ne=n(),he=n(),Ce=n();return K(k[2],u),Q(k[1],D),Se(N,k[1]),de(ee,N,l),se(N,N,k[2]),J(ee,k[2],ee),Se(ne,ee),Se(he,ne),de(Ce,he,ne),de($,Ce,N),de($,$,ee),Ze($,$),de($,$,N),de($,$,ee),de($,$,ee),de(k[0],$,ee),Se(P,k[0]),de(P,P,ee),Y(P,N)&&de(k[0],k[0],v),Se(P,k[0]),de(P,P,ee),Y(P,N)?-1:(ue(k[0])===D[31]>>7&&se(k[0],a,k[0]),de(k[3],k[0],k[1]),0)}function yi(k,D,$,P){var N,ee=new Uint8Array(32),ne=new Uint8Array(64),he=[n(),n(),n(),n()],Ce=[n(),n(),n(),n()];if($<64||br(Ce,P))return-1;for(N=0;N<$;N++)k[N]=D[N];for(N=0;N<32;N++)k[N+32]=P[N];if(pe(ne,k,$),xn(ne),ke(he,Ce,ne),nt(Ce,D.subarray(32)),ye(he,Ce),je(ee,he),$-=64,w(D,0,ee,0)){for(N=0;N<$;N++)k[N]=0;return-1}for(N=0;N<$;N++)k[N]=D[N+64];return $}var ar=32,ui=24,bi=32,Rr=16,Yi=32,go=32,xi=32,Dr=32,wa=32,_t=ui,dn=bi,wn=Rr,qn=64,ur=32,Xr=64,mo=32,ql=64;t.lowlevel={crypto_core_hsalsa20:E,crypto_stream_xor:U,crypto_stream:F,crypto_stream_salsa20_xor:T,crypto_stream_salsa20:M,crypto_onetimeauth:W,crypto_onetimeauth_verify:ie,crypto_verify_16:b,crypto_verify_32:w,crypto_secretbox:Z,crypto_secretbox_open:G,crypto_scalarmult:Pe,crypto_scalarmult_base:Fe,crypto_box_beforenm:be,crypto_box_afternm:yt,crypto_box:It,crypto_box_open:mn,crypto_box_keypair:$e,crypto_hash:pe,crypto_sign:Ii,crypto_sign_keypair:gt,crypto_sign_open:yi,crypto_secretbox_KEYBYTES:ar,crypto_secretbox_NONCEBYTES:ui,crypto_secretbox_ZEROBYTES:bi,crypto_secretbox_BOXZEROBYTES:Rr,crypto_scalarmult_BYTES:Yi,crypto_scalarmult_SCALARBYTES:go,crypto_box_PUBLICKEYBYTES:xi,crypto_box_SECRETKEYBYTES:Dr,crypto_box_BEFORENMBYTES:wa,crypto_box_NONCEBYTES:_t,crypto_box_ZEROBYTES:dn,crypto_box_BOXZEROBYTES:wn,crypto_sign_BYTES:qn,crypto_sign_PUBLICKEYBYTES:ur,crypto_sign_SECRETKEYBYTES:Xr,crypto_sign_SEEDBYTES:mo,crypto_hash_BYTES:ql,gf:n,D:l,L:bn,pack25519:q,unpack25519:Q,M:de,A:J,S:Se,Z:se,pow2523:Ze,add:ye,set25519:K,modL:Vt,scalarmult:ke,scalarbase:nt};function yf(k,D){if(k.length!==ar)throw new Error("bad key size");if(D.length!==ui)throw new Error("bad nonce size")}function oe(k,D){if(k.length!==xi)throw new Error("bad public key size");if(D.length!==Dr)throw new Error("bad secret key size")}function le(){for(var k=0;k=0},t.sign.keyPair=function(){var k=new Uint8Array(ur),D=new Uint8Array(Xr);return gt(k,D),{publicKey:k,secretKey:D}},t.sign.keyPair.fromSecretKey=function(k){if(le(k),k.length!==Xr)throw new Error("bad secret key size");for(var D=new Uint8Array(ur),$=0;$"u"?typeof Buffer.from<"u"?(t.encodeBase64=function(r){return Buffer.from(r).toString("base64")},t.decodeBase64=function(r){return n(r),new Uint8Array(Array.prototype.slice.call(Buffer.from(r,"base64"),0))}):(t.encodeBase64=function(r){return new Buffer(r).toString("base64")},t.decodeBase64=function(r){return n(r),new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0))}):(t.encodeBase64=function(r){var i,o=[],a=r.length;for(i=0;i{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:a,disabled:u,value:s="on",onCheckedChange:l,form:c,...d}=e,[h,v]=y.useState(null),g=Kt(t,A=>v(A)),m=y.useRef(!1),b=h?c||!!h.closest("form"):!0,[w=!1,x]=Ga({prop:i,defaultProp:o,onChange:l}),S=y.useRef(w);return y.useEffect(()=>{const A=h?.form;if(A){const E=()=>x(S.current);return A.addEventListener("reset",E),()=>A.removeEventListener("reset",E)}},[h,x]),I.jsxs(Bqe,{scope:n,state:w,disabled:u,children:[I.jsx(pt.button,{type:"button",role:"checkbox","aria-checked":bl(w)?"mixed":w,"aria-required":a,"data-state":gY(w),"data-disabled":u?"":void 0,disabled:u,value:s,...d,ref:g,onKeyDown:Ye(e.onKeyDown,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:Ye(e.onClick,A=>{x(E=>bl(E)?!0:!E),b&&(m.current=A.isPropagationStopped(),m.current||A.stopPropagation())})}),b&&I.jsx(Uqe,{control:h,bubbles:!m.current,name:r,value:s,checked:w,required:a,disabled:u,form:c,style:{transform:"translateX(-100%)"},defaultChecked:bl(o)?!1:o})]})});hY.displayName=oO;var pY="CheckboxIndicator",vY=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=zqe(pY,n);return I.jsx(Gr,{present:r||bl(o.state)||o.state===!0,children:I.jsx(pt.span,{"data-state":gY(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});vY.displayName=pY;var Uqe=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,a=y.useRef(null),u=pP(n),s=jA(t);y.useEffect(()=>{const c=a.current,d=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(d,"checked").set;if(u!==n&&v){const g=new Event("click",{bubbles:r});c.indeterminate=bl(n),v.call(c,bl(n)?!1:n),c.dispatchEvent(g)}},[u,n,r]);const l=y.useRef(bl(n)?!1:n);return I.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??l.current,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function bl(e){return e==="indeterminate"}function gY(e){return bl(e)?"indeterminate":e?"checked":"unchecked"}var FZe=hY,LZe=vY;export{CGe as $,cpe as A,IKe as B,UKe as C,hpe as D,ppe as E,zKe as F,xB as G,nGe as H,vKe as I,gpe as J,fpe as K,dpe as L,uKe as M,vGe as N,Vqe as O,Yqe as P,NKe as Q,j as R,Sl as S,vpe as T,Lpe as U,jpe as V,kGe as W,JKe as X,TGe as Y,xGe as Z,wGe as _,Qqe as a,VYe as a$,EGe as a0,PGe as a1,YKe as a2,AGe as a3,iGe as a4,SGe as a5,OGe as a6,yGe as a7,bGe as a8,_Ge as a9,LGe as aA,sGe as aB,pYe as aC,bKe as aD,EKe as aE,SYe as aF,CYe as aG,EYe as aH,Xqe as aI,TYe as aJ,MYe as aK,RYe as aL,kYe as aM,$Ye as aN,NYe as aO,IYe as aP,FYe as aQ,XKe as aR,qYe as aS,eGe as aT,KYe as aU,LYe as aV,jYe as aW,BYe as aX,UYe as aY,WYe as aZ,HYe as a_,RGe as aa,NGe as ab,DGe as ac,$Ge as ad,Kqe as ae,oKe as af,lKe as ag,CKe as ah,eKe as ai,cKe as aj,xKe as ak,sKe as al,pKe as am,SKe as an,_Ke as ao,gKe as ap,wKe as aq,iKe as ar,nKe as as,fKe as at,kKe as au,OKe as av,AKe as aw,TKe as ax,yKe as ay,aKe as az,ig as b,OZe as b$,GYe as b0,zYe as b1,XYe as b2,QKe as b3,tZe as b4,nZe as b5,JYe as b6,eZe as b7,qS as b8,jKe as b9,jGe as bA,WGe as bB,zGe as bC,YYe as bD,Ui as bE,lZe as bF,cZe as bG,lYe as bH,gYe as bI,hYe as bJ,rYe as bK,QGe as bL,XGe as bM,fZe as bN,rKe as bO,PKe as bP,mKe as bQ,tKe as bR,hZe as bS,pZe as bT,BKe as bU,oGe as bV,aGe as bW,wZe as bX,SZe as bY,JGe as bZ,UGe as b_,mf as ba,qGe as bb,AYe as bc,PYe as bd,cP as be,fP as bf,oIe as bg,Yu as bh,vf as bi,Gh as bj,ZYe as bk,BGe as bl,VGe as bm,cYe as bn,HGe as bo,xYe as bp,bYe as bq,iYe as br,yYe as bs,oZe as bt,aZe as bu,uZe as bv,ZBe as bw,nze as bx,rZe as by,fYe as bz,fn as c,kZe as c0,RZe as c1,DZe as c2,TZe as c3,MZe as c4,EZe as c5,AZe as c6,PZe as c7,uGe as c8,cGe as c9,LZe as cA,tGe as cB,hGe as cC,ZKe as cD,rGe as cE,dGe as cF,aYe as cG,Gqe as cH,GGe as cI,HBe as cJ,lGe as cK,eYe as cL,KGe as cM,mYe as ca,_Ze as cb,vZe as cc,yZe as cd,bZe as ce,xZe as cf,sYe as cg,YGe as ch,ZGe as ci,wYe as cj,Qa as ck,yr as cl,uYe as cm,gZe as cn,mZe as co,fGe as cp,Gc as cq,$Ze as cr,IZe as cs,IGe as ct,vYe as cu,tYe as cv,oYe as cw,dYe as cx,nYe as cy,FZe as cz,Hqe as d,Kr as e,$Ke as f,RKe as g,DKe as h,MKe as i,I as j,yk as k,LKe as l,qqe as m,qKe as n,mA as o,hKe as p,dKe as q,y as r,GKe as s,Jqe as t,JF as u,KKe as v,Zqe as w,WKe as x,HKe as y,VKe as z}; diff --git a/resources/lang/en-US.json b/resources/lang/en-US.json index 3007aa9..1007453 100644 --- a/resources/lang/en-US.json +++ b/resources/lang/en-US.json @@ -95,5 +95,23 @@ "Sending frequently, please try again later": "Sending frequently, please try again later", "Current product is sold out": "Current product is sold out", "There are too many password errors, please try again after :minute minutes.": "There are too many password errors, please try again after :minute minutes.", - "Reset failed, Please try again later": "Reset failed, Please try again later" + "Reset failed, Please try again later": "Reset failed, Please try again later", + "Subscribe": "Subscribe", + "User Information": "User Information", + "Username": "Username", + "Status": "Status", + "Active": "Active", + "Inactive": "Inactive", + "Data Used": "Data Used", + "Data Limit": "Data Limit", + "Expiration Date": "Expiration Date", + "Reset In": "Reset In", + "Days": "Days", + "Subscription Link": "Subscription Link", + "Copy": "Copy", + "Copied": "Copied", + "QR Code": "QR Code", + "Unlimited": "Unlimited", + "Device Limit": "Device Limit", + "Devices": "Devices" } diff --git a/resources/lang/zh-CN.json b/resources/lang/zh-CN.json index 6d11779..b6a4251 100644 --- a/resources/lang/zh-CN.json +++ b/resources/lang/zh-CN.json @@ -95,5 +95,23 @@ "Sending frequently, please try again later": "发送频繁,请稍后再试", "Current product is sold out": "当前商品已售罄", "There are too many password errors, please try again after :minute minutes.": "密码错误次数过多,请 :minute 分钟后再试", - "Reset failed, Please try again later": "重置失败,请稍后再试" + "Reset failed, Please try again later": "重置失败,请稍后再试", + "Subscribe": "订阅信息", + "User Information": "用户信息", + "Username": "用户名", + "Status": "状态", + "Active": "正常", + "Inactive": "未激活", + "Data Used": "已用流量", + "Data Limit": "流量限制", + "Expiration Date": "到期时间", + "Reset In": "距离重置", + "Days": "天", + "Subscription Link": "订阅链接", + "Copy": "复制", + "Copied": "已复制", + "QR Code": "二维码", + "Unlimited": "长期有效", + "Device Limit": "设备限制", + "Devices": "台设备" } diff --git a/resources/lang/zh-TW.json b/resources/lang/zh-TW.json index eff5f58..c83473e 100644 --- a/resources/lang/zh-TW.json +++ b/resources/lang/zh-TW.json @@ -95,5 +95,23 @@ "Sending frequently, please try again later": "發送頻繁,請稍後再試", "Current product is sold out": "當前商品已售罄", "There are too many password errors, please try again after :minute minutes.": "密碼錯誤次數過多,請 :minute 分鐘後再試", - "Reset failed, Please try again later": "重置失敗,請稍後再試" + "Reset failed, Please try again later": "重置失敗,請稍後再試", + "Subscribe": "訂閱資訊", + "User Information": "用戶資訊", + "Username": "用戶名", + "Status": "狀態", + "Active": "正常", + "Inactive": "未啟用", + "Data Used": "已用流量", + "Data Limit": "流量限制", + "Expiration Date": "到期時間", + "Reset In": "距離重置", + "Days": "天", + "Subscription Link": "訂閱連結", + "Copy": "複製", + "Copied": "已複製", + "QR Code": "二維碼", + "Unlimited": "長期有效", + "Device Limit": "設備限制", + "Devices": "台設備" } diff --git a/resources/views/client/subscribe.blade.php b/resources/views/client/subscribe.blade.php new file mode 100644 index 0000000..9895b77 --- /dev/null +++ b/resources/views/client/subscribe.blade.php @@ -0,0 +1,296 @@ + + + + + + + {{ __('Subscribe') }} + + + + +
+

{{ __('User Information') }}

+ +
+
+
{{ __('Username') }}
+
{{ $username }}
+
+ +
+
{{ __('Status') }}
+
+ + {{ $status === 'active' ? __('Active') : __('Inactive') }} + +
+
+ +
+
{{ __('Data Used') }}
+
{{ $data_used }}
+
+ +
+
{{ __('Data Limit') }}
+
{{ $data_limit }}
+
+ +
+
{{ __('Expiration Date') }}
+
{{ $expired_date }}
+
+ + @if (isset($device_limit)) +
+
{{ __('Device Limit') }}
+
{{ $device_limit }} {{ __('Devices') }}
+
+ @endif + + @if ($reset_day) +
+
{{ __('Reset In') }}
+
{{ $reset_day }} {{ __('Days') }}
+
+ @endif +
+ + +
+ + + + +