From a3700ad685b79d102c60b964eedf4f94538691fa Mon Sep 17 00:00:00 2001 From: xboard Date: Sat, 24 May 2025 12:31:18 +0800 Subject: [PATCH] feat: Add node load submission and display functionality - Implemented node load status submission in UniProxyController with dynamic cache expiration based on server push interval. - Added log filtering capability in the admin panel for better log management and analysis. --- .../V1/Server/UniProxyController.php | 44 +++++++++ .../Controllers/V2/Admin/SystemController.php | 17 +++- app/Http/Routes/V1/ServerRoute.php | 1 + app/Models/Server.php | 15 +++ app/Services/ServerService.php | 3 +- app/Services/UpdateService.php | 2 +- app/Utils/CacheKey.php | 94 +++++++++---------- public/assets/admin/assets/index.css | 2 +- public/assets/admin/assets/index.js | 28 +++--- public/assets/admin/assets/vendor.js | 12 +-- public/assets/admin/locales/en-US.js | 36 ++++++- public/assets/admin/locales/ko-KR.js | 55 +++++++++++ public/assets/admin/locales/zh-CN.js | 36 ++++++- 13 files changed, 270 insertions(+), 75 deletions(-) diff --git a/app/Http/Controllers/V1/Server/UniProxyController.php b/app/Http/Controllers/V1/Server/UniProxyController.php index fd8158c..ff81a9f 100644 --- a/app/Http/Controllers/V1/Server/UniProxyController.php +++ b/app/Http/Controllers/V1/Server/UniProxyController.php @@ -211,4 +211,48 @@ class UniProxyController extends Controller $this->userOnlineService->updateAliveData($data, $node->type, $node->id); return response()->json(['data' => true]); } + + // 提交节点负载状态 + public function status(Request $request): JsonResponse + { + $node = $request->input('node_info'); + + $data = $request->validate([ + 'cpu' => 'required|numeric|min:0|max:100', + 'mem.total' => 'required|integer|min:0', + 'mem.used' => 'required|integer|min:0', + 'swap.total' => 'required|integer|min:0', + 'swap.used' => 'required|integer|min:0', + 'disk.total' => 'required|integer|min:0', + 'disk.used' => 'required|integer|min:0', + ]); + + $nodeType = $node->type; + $nodeId = $node->id; + + $statusData = [ + 'cpu' => (float) $data['cpu'], + 'mem' => [ + 'total' => (int) $data['mem']['total'], + 'used' => (int) $data['mem']['used'], + ], + 'swap' => [ + 'total' => (int) $data['swap']['total'], + 'used' => (int) $data['swap']['used'], + ], + 'disk' => [ + 'total' => (int) $data['disk']['total'], + 'used' => (int) $data['disk']['used'], + ], + 'updated_at' => now()->timestamp, + ]; + + $cacheTime = max(300, (int) admin_setting('server_push_interval', 60) * 3); + cache([ + CacheKey::get('SERVER_' . strtoupper($nodeType) . '_LOAD_STATUS', $nodeId) => $statusData, + CacheKey::get('SERVER_' . strtoupper($nodeType) . '_LAST_LOAD_AT', $nodeId) => now()->timestamp, + ], $cacheTime); + + return response()->json(['data' => true, "code" => 0, "message" => "success"]); + } } diff --git a/app/Http/Controllers/V2/Admin/SystemController.php b/app/Http/Controllers/V2/Admin/SystemController.php index f7ba63e..2fc83b5 100644 --- a/app/Http/Controllers/V2/Admin/SystemController.php +++ b/app/Http/Controllers/V2/Admin/SystemController.php @@ -128,11 +128,26 @@ class SystemController extends Controller { $current = $request->input('current') ? $request->input('current') : 1; $pageSize = $request->input('page_size') >= 10 ? $request->input('page_size') : 10; + $level = $request->input('level'); + $keyword = $request->input('keyword'); + $builder = LogModel::orderBy('created_at', 'DESC') - ->setFilterAllowKeys('level'); + ->when($level, function ($query) use ($level) { + return $query->where('level', strtoupper($level)); + }) + ->when($keyword, function ($query) use ($keyword) { + return $query->where(function ($q) use ($keyword) { + $q->where('data', 'like', '%' . $keyword . '%') + ->orWhere('context', 'like', '%' . $keyword . '%') + ->orWhere('title', 'like', '%' . $keyword . '%') + ->orWhere('uri', 'like', '%' . $keyword . '%'); + }); + }); + $total = $builder->count(); $res = $builder->forPage($current, $pageSize) ->get(); + return response([ 'data' => $res, 'total' => $total diff --git a/app/Http/Routes/V1/ServerRoute.php b/app/Http/Routes/V1/ServerRoute.php index 29973dc..42f7b22 100644 --- a/app/Http/Routes/V1/ServerRoute.php +++ b/app/Http/Routes/V1/ServerRoute.php @@ -23,6 +23,7 @@ class ServerRoute $route->post('push', [UniProxyController::class, 'push']); $route->post('alive', [UniProxyController::class, 'alive']); $route->get('alivelist', [UniProxyController::class, 'alivelist']); + $route->post('status', [UniProxyController::class, 'status']); }); $router->group([ 'prefix' => 'ShadowsocksTidalab', diff --git a/app/Models/Server.php b/app/Models/Server.php index e034c16..84ddfcf 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -47,6 +47,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute; * @property int|null $u 上行流量 * @property int|null $d 下行流量 * @property int|null $total 总流量 + * @property-read array|null $load_status 负载状态(包含CPU、内存、交换区、磁盘信息) */ class Server extends Model { @@ -432,4 +433,18 @@ class Server extends Model } ); } + + /** + * 负载状态访问器 + */ + protected function loadStatus(): Attribute + { + return Attribute::make( + get: function () { + $type = strtoupper($this->type); + $serverId = $this->parent_id ?: $this->id; + return Cache::get(CacheKey::get("SERVER_{$type}_LOAD_STATUS", $serverId)); + } + ); + } } diff --git a/app/Services/ServerService.php b/app/Services/ServerService.php index b079f95..87160d9 100644 --- a/app/Services/ServerService.php +++ b/app/Services/ServerService.php @@ -25,7 +25,8 @@ class ServerService 'online', 'is_online', 'available_status', - 'cache_key' + 'cache_key', + 'load_status' ]); } diff --git a/app/Services/UpdateService.php b/app/Services/UpdateService.php index cd8e8a6..2406d3c 100644 --- a/app/Services/UpdateService.php +++ b/app/Services/UpdateService.php @@ -40,7 +40,7 @@ class UpdateService list($date, $hash) = explode(':', trim($result->output())); Cache::forever(self::CACHE_VERSION_DATE, $date); Cache::forever(self::CACHE_VERSION, substr($hash, 0, 7)); - Log::info('Version cache updated: ' . $date . '-' . substr($hash, 0, 7)); + // Log::info('Version cache updated: ' . $date . '-' . substr($hash, 0, 7)); return; } } catch (\Exception $e) { diff --git a/app/Utils/CacheKey.php b/app/Utils/CacheKey.php index b67d7af..30f5656 100644 --- a/app/Utils/CacheKey.php +++ b/app/Utils/CacheKey.php @@ -4,53 +4,10 @@ namespace App\Utils; class CacheKey { - const KEYS = [ + // 核心缓存键定义 + const CORE_KEYS = [ 'EMAIL_VERIFY_CODE' => '邮箱验证码', 'LAST_SEND_EMAIL_VERIFY_TIMESTAMP' => '最后一次发送邮箱验证码时间', - 'SERVER_VMESS_ONLINE_USER' => '节点在线用户', - 'MULTI_SERVER_VMESS_ONLINE_USER' => '节点多服务器在线用户', - 'SERVER_VMESS_LAST_CHECK_AT' => '节点最后检查时间', - 'SERVER_VMESS_LAST_PUSH_AT' => '节点最后推送时间', - 'SERVER_TROJAN_ONLINE_USER' => 'trojan节点在线用户', - 'MULTI_SERVER_TROJAN_ONLINE_USER' => 'trojan节点多服务器在线用户', - 'SERVER_TROJAN_LAST_CHECK_AT' => 'trojan节点最后检查时间', - 'SERVER_TROJAN_LAST_PUSH_AT' => 'trojan节点最后推送时间', - 'SERVER_SHADOWSOCKS_ONLINE_USER' => 'ss节点在线用户', - 'MULTI_SERVER_SHADOWSOCKS_ONLINE_USER' => 'ss节点多服务器在线用户', - 'SERVER_SHADOWSOCKS_LAST_CHECK_AT' => 'ss节点最后检查时间', - 'SERVER_SHADOWSOCKS_LAST_PUSH_AT' => 'ss节点最后推送时间', - 'SERVER_HYSTERIA_ONLINE_USER' => 'hysteria节点在线用户', - 'MULTI_SERVER_HYSTERIA_ONLINE_USER' => 'hysteria节点多服务器在线用户', - 'SERVER_HYSTERIA_LAST_CHECK_AT' => 'hysteria节点最后检查时间', - 'SERVER_HYSTERIA_LAST_PUSH_AT' => 'hysteria节点最后推送时间', - 'SERVER_VLESS_ONLINE_USER' => 'vless节点在线用户', - 'MULTI_SERVER_VLESS_ONLINE_USER' => 'vless节点多服务器在线用户', - 'SERVER_VLESS_LAST_CHECK_AT' => 'vless节点最后检查时间', - 'SERVER_VLESS_LAST_PUSH_AT' => 'vless节点最后推送时间', - 'SERVER_TUIC_ONLINE_USER' => 'TUIC节点在线用户', - 'MULTI_SERVER_TUIC_ONLINE_USER' => 'TUIC节点多服务器在线用户', - 'SERVER_TUIC_LAST_CHECK_AT' => 'TUIC节点最后检查时间', - 'SERVER_TUIC_LAST_PUSH_AT' => 'TUIC节点最后推送时间', - 'SERVER_ANYTLS_ONLINE_USER' => 'ANYTLS节点在线用户', - 'MULTI_SERVER_ANYTLS_ONLINE_USER' => 'ANYTLS节点多服务器在线用户', - 'SERVER_ANYTLS_LAST_CHECK_AT' => 'ANYTLS节点最后检查时间', - 'SERVER_ANYTLS_LAST_PUSH_AT' => 'ANYTLS节点最后推送时间', - 'SERVER_SOCKS_ONLINE_USER' => 'socks节点在线用户', - 'MULTI_SERVER_SOCKS_ONLINE_USER' => 'socks节点多服务器在线用户', - 'SERVER_SOCKS_LAST_CHECK_AT' => 'socks节点最后检查时间', - 'SERVER_SOCKS_LAST_PUSH_AT' => 'socks节点最后推送时间', - 'SERVER_NAIVE_ONLINE_USER' => 'naive节点在线用户', - 'MULTI_SERVER_NAIVE_ONLINE_USER' => 'naive节点多服务器在线用户', - 'SERVER_NAIVE_LAST_CHECK_AT' => 'naive节点最后检查时间', - 'SERVER_NAIVE_LAST_PUSH_AT' => 'naive节点最后推送时间', - 'SERVER_HTTP_ONLINE_USER' => 'http节点在线用户', - 'MULTI_SERVER_HTTP_ONLINE_USER' => 'http节点多服务器在线用户', - 'SERVER_HTTP_LAST_CHECK_AT' => 'http节点最后检查时间', - 'SERVER_HTTP_LAST_PUSH_AT' => 'http节点最后推送时间', - 'SERVER_MIERU_ONLINE_USER' => 'mieru节点在线用户', - 'MULTI_SERVER_MIERU_ONLINE_USER' => 'mieru节点多服务器在线用户', - 'SERVER_MIERU_LAST_CHECK_AT' => 'mieru节点最后检查时间', - 'SERVER_MIERU_LAST_PUSH_AT' => 'mieru节点最后推送时间', 'TEMP_TOKEN' => '临时令牌', 'LAST_SEND_EMAIL_REMIND_TRAFFIC' => '最后发送流量邮件提醒', 'SCHEDULE_LAST_CHECK_AT' => '计划任务最后检查时间', @@ -61,11 +18,50 @@ class CacheKey 'FORGET_REQUEST_LIMIT' => '找回密码次数限制' ]; - public static function get(string $key, $uniqueValue) + // 允许的缓存键模式(支持通配符) + const ALLOWED_PATTERNS = [ + 'SERVER_*_ONLINE_USER', // 节点在线用户 + 'MULTI_SERVER_*_ONLINE_USER', // 多服务器在线用户 + 'SERVER_*_LAST_CHECK_AT', // 节点最后检查时间 + 'SERVER_*_LAST_PUSH_AT', // 节点最后推送时间 + 'SERVER_*_LOAD_STATUS', // 节点负载状态 + 'SERVER_*_LAST_LOAD_AT', // 节点最后负载提交时间 + ]; + + /** + * 生成缓存键 + */ + public static function get(string $key, $uniqueValue = null): string { - if (!in_array($key, array_keys(self::KEYS))) { - abort(500, 'key is not in cache key list'); + // 检查是否为核心键 + if (array_key_exists($key, self::CORE_KEYS)) { + return $uniqueValue ? $key . '_' . $uniqueValue : $key; } - return $key . '_' . $uniqueValue; + + // 检查是否匹配允许的模式 + if (self::matchesPattern($key)) { + return $uniqueValue ? $key . '_' . $uniqueValue : $key; + } + + // 开发环境下记录警告,生产环境允许通过 + if (app()->environment('local', 'development')) { + logger()->warning("Unknown cache key used: {$key}"); + } + + return $uniqueValue ? $key . '_' . $uniqueValue : $key; + } + + /** + * 检查键名是否匹配允许的模式 + */ + private static function matchesPattern(string $key): bool + { + foreach (self::ALLOWED_PATTERNS as $pattern) { + $regex = '/^' . str_replace('*', '[A-Z_]+', $pattern) . '$/'; + if (preg_match($regex, $key)) { + return true; + } + } + return false; } } diff --git a/public/assets/admin/assets/index.css b/public/assets/admin/assets/index.css index 97395de..0fd9082 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{top:-.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-3{left:.75rem}.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-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[-1\]{z-index:-1}.z-\[1\]{z-index:1}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.-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-3{margin-top:.75rem}.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-\[100vh\]{height:100vh}.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-12{max-height:3rem}.max-h-96{max-height:24rem}.max-h-\[150px\]{max-height:150px}.max-h-\[200px\]{max-height:200px}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[70vh\]{max-height:70vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95\%\]{max-height:95%}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[200px\]{min-height:200px}.min-h-\[60px\]{min-height:60px}.min-h-svh{min-height:100svh}.w-0{width:0px}.w-1\.5{width:.375rem}.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-4\/5{width:80%}.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-80{width:20rem}.w-9{width:2.25rem}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[160px\]{width:160px}.w-\[180px\]{width:180px}.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-\[60px\]{width:60px}.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}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-20{min-width:5rem}.min-w-\[10em\]{min-width:10em}.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-6xl{max-width:72rem}.max-w-80{max-width:20rem}.max-w-\[150px\]{max-width:150px}.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-\[90vw\]{max-width:90vw}.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-sm{max-width:24rem}.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-0{--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))}.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-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-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,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-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * 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}.overscroll-contain{overscroll-behavior:contain}.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-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.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-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / 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-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.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-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.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\/20{background-color:#0003}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.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-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / 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{padding-left:0;padding-right:0}.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\.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-2\.5{padding-top:.625rem;padding-bottom:.625rem}.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}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0\.5{padding-bottom:.125rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.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}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-3{padding-right:.75rem}.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}.italic{font-style:italic}.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-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / 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-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-700{--tw-text-opacity: 1;color:rgb(21 128 61 / 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-700{--tw-text-opacity: 1;color:rgb(185 28 28 / 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-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.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-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / 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)}.running{animation-play-state:running}.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\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:bottom-0:after{content:var(--tw-content);bottom:0}.after\:left-0:after{content:var(--tw-content);left:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:hidden:after{content:var(--tw-content);display:none}.after\:h-32:after{content:var(--tw-content);height:8rem}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:w-full:after{content:var(--tw-content);width:100%}.after\:-translate-x-1\/2:after{content:var(--tw-content);--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))}.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-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.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-blue-200:hover{--tw-bg-opacity: 1;background-color:rgb(191 219 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-red-200:hover{--tw-bg-opacity: 1;background-color:rgb(254 202 202 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / 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\:text-red-600:focus{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.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-red-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(220 38 38 / var(--tw-ring-opacity, 1))}.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-1:focus-visible{--tw-ring-offset-width: 1px}.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-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.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-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.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-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--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))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--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))}.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-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / 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\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-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-blue-950\/30:is(.dark *){background-color:#1725544d}.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-red-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity, 1))}.dark\:bg-red-950\/30:is(.dark *){background-color:#450a0a4d}.dark\:bg-yellow-500\/10:is(.dark *){background-color:#eab3081a}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.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-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / 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-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / 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-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 64 175 / var(--tw-bg-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-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(153 27 27 / 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-\[350px\]{width:350px}.sm\:w-\[540px\]{width:540px}.sm\:w-\[90vw\]{width:90vw}.sm\:w-auto{width:auto}.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-\[500px\]{max-width:500px}.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-0{gap:0px}.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\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:relative{position:relative}.md\:bottom-0{bottom:0}.md\:right-8{right:2rem}.md\:right-auto{right:auto}.md\:top-8{top:2rem}.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-full{height:100%}.md\:h-svh{height:100svh}.md\:w-14{width:3.5rem}.md\:w-32{width:8rem}.md\:w-64{width:16rem}.md\:w-80{width:20rem}.md\:w-\[420px\]{width:420px}.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\:translate-x-0{--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))}.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}.md\:opacity-0{opacity:0}.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\: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-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-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--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))}.\[\&\[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{top:-.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-3{left:.75rem}.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-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[-1\]{z-index:-1}.z-\[1\]{z-index:1}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.-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-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.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-0{margin-top:0}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.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-\[100vh\]{height:100vh}.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-12{max-height:3rem}.max-h-96{max-height:24rem}.max-h-\[150px\]{max-height:150px}.max-h-\[200px\]{max-height:200px}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95\%\]{max-height:95%}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[200px\]{min-height:200px}.min-h-\[60px\]{min-height:60px}.min-h-svh{min-height:100svh}.w-0{width:0px}.w-1\.5{width:.375rem}.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-20{width:5rem}.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-4\/5{width:80%}.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-80{width:20rem}.w-9{width:2.25rem}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[180px\]{width:180px}.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-\[60px\]{width:60px}.w-\[70px\]{width:70px}.w-\[80px\]{width:80px}.w-\[9\.5rem\]{width:9.5rem}.w-auto{width:auto}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-20{min-width:5rem}.min-w-\[10em\]{min-width:10em}.min-w-\[3rem\]{min-width:3rem}.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-6xl{max-width:72rem}.max-w-80{max-width:20rem}.max-w-\[150px\]{max-width:150px}.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-\[90vw\]{max-width:90vw}.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-sm{max-width:24rem}.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-0{--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))}.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-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-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,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-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * 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}.overscroll-contain{overscroll-behavior:contain}.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-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.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\/30{border-color:hsl(var(--border) / .3)}.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-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / 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-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.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-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.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\/20{background-color:#0003}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.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{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.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-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / 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{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / 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{padding-left:0;padding-right:0}.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\.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-2\.5{padding-top:.625rem;padding-bottom:.625rem}.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}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0\.5{padding-bottom:.125rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.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}.pl-9{padding-left:2.25rem}.pr-10{padding-right:2.5rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-3{padding-right:.75rem}.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-3{padding-top:.75rem}.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}.italic{font-style:italic}.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-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / 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-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / 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-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-700{--tw-text-opacity: 1;color:rgb(21 128 61 / 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-700{--tw-text-opacity: 1;color:rgb(185 28 28 / 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-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.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-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / 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)}.running{animation-play-state:running}.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\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:bottom-0:after{content:var(--tw-content);bottom:0}.after\:left-0:after{content:var(--tw-content);left:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:hidden:after{content:var(--tw-content);display:none}.after\:h-32:after{content:var(--tw-content);height:8rem}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:w-full:after{content:var(--tw-content);width:100%}.after\:-translate-x-1\/2:after{content:var(--tw-content);--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))}.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-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.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-blue-200:hover{--tw-bg-opacity: 1;background-color:rgb(191 219 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-red-200:hover{--tw-bg-opacity: 1;background-color:rgb(254 202 202 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / 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\:text-red-600:focus{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.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-red-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(220 38 38 / var(--tw-ring-opacity, 1))}.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-1:focus-visible{--tw-ring-offset-width: 1px}.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-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.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-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.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-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--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))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--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))}.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-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / 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\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-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-blue-950\/30:is(.dark *){background-color:#1725544d}.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-red-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity, 1))}.dark\:bg-red-950\/30:is(.dark *){background-color:#450a0a4d}.dark\:bg-yellow-500\/10:is(.dark *){background-color:#eab3081a}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.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-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / 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-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / 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-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 64 175 / var(--tw-bg-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-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(153 27 27 / 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-\[350px\]{width:350px}.sm\:w-\[540px\]{width:540px}.sm\:w-\[90vw\]{width:90vw}.sm\:w-auto{width:auto}.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-\[500px\]{max-width:500px}.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-0{gap:0px}.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\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:relative{position:relative}.md\:bottom-0{bottom:0}.md\:right-8{right:2rem}.md\:right-auto{right:auto}.md\:top-8{top:2rem}.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-full{height:100%}.md\:h-svh{height:100svh}.md\:w-14{width:3.5rem}.md\:w-32{width:8rem}.md\:w-64{width:16rem}.md\:w-80{width:20rem}.md\:w-\[420px\]{width:420px}.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\:translate-x-0{--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))}.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}.md\:opacity-0{opacity:0}.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\: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-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-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--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))}.\[\&\[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 16f1558..792e4e1 100644 --- a/public/assets/admin/assets/index.js +++ b/public/assets/admin/assets/index.js @@ -1,19 +1,19 @@ -import{r as m,j as e,t as Xl,c as Zl,I as kn,a as Zs,S as rn,u as Vs,b as ei,d as ln,R as Yn,e as Jn,f as si,F as ti,C as ai,L as Qn,T as Xn,g as Zn,h as ni,i as ri,k as li,l as $,z as x,m as V,n as ye,o as _e,p as ne,q as hs,s as Se,v as ct,w as ii,O as on,x as oi,y as ci,A as di,B as mi,D as ui,E as xi,Q as hi,G as pi,H as gi,J as fi,P as ji,K as vi,M as bi,N as yi,U as Ni,V as er,W as sr,X as ga,Y as fa,Z as cn,_ as ls,$ as ja,a0 as va,a1 as tr,a2 as ar,a3 as nr,a4 as dn,a5 as rr,a6 as _i,a7 as lr,a8 as ir,a9 as or,aa as cr,ab as et,ac as dr,ad as wi,ae as mr,af as ur,ag as Ci,ah as Si,ai as ki,aj as Ti,ak as Di,al as Ei,am as Pi,an as Ri,ao as Ii,ap as Li,aq as Vi,ar as xr,as as Fi,at as Oi,au as st,av as hr,aw as Mi,ax as zi,ay as pr,az as mn,aA as Ai,aB as $i,aC as Tn,aD as qi,aE as gr,aF as Hi,aG as fr,aH as Ui,aI as Ki,aJ as Bi,aK as Gi,aL as Wi,aM as Yi,aN as jr,aO as Ji,aP as Qi,aQ as Xi,aR as $e,aS as Zi,aT as un,aU as eo,aV as so,aW as vr,aX as br,aY as yr,aZ as to,a_ as ao,a$ as no,b0 as Nr,b1 as ro,b2 as xn,b3 as _r,b4 as lo,b5 as wr,b6 as io,b7 as Cr,b8 as oo,b9 as Sr,ba as kr,bb as co,bc as mo,bd as Tr,be as uo,bf as xo,bg as Dr,bh as ho,bi as Er,bj as po,bk as go,bl as us,bm as ms,bn as Bt,bo as fo,bp as jo,bq as vo,br as bo,bs as yo,bt as No,bu as Dn,bv as En,bw as _o,bx as wo,by as Co,bz as So,bA as ko,bB as Ja,bC as zt,bD as To,bE as Do,bF as Pr,bG as Eo,bH as Po,bI as Rr,bJ as Ro,bK as Io,bL as Pn,bM as Qa,bN as Xa,bO as Lo,bP as Vo,bQ as Ir,bR as Fo,bS as Lt,bT as Oo,bU as Fa,bV as Mo,bW as Oa,bX as zo,bY as Ma,bZ as Rn,b_ as In,b$ as Za,c0 as en,c1 as Lr,c2 as Vr,c3 as Ao,c4 as $o,c5 as qo,c6 as Ho,c7 as Uo,c8 as Fr,c9 as Ko,ca as Bo,cb as Go,cc as Wo,cd as oa,ce as Oe,cf as Ln,cg as Yo,ch as Or,ci as Mr,cj as zr,ck as Ar,cl as $r,cm as qr,cn as Jo,co as Qo,cp as Xo,cq as ba,cr as tt,cs as ps,ct as is,cu as os,cv as gs,cw as fs,cx as js,cy as Zo,cz as ec,cA as sc,cB as tc,cC as ac,cD as nc,cE as rc,cF as sn,cG as hn,cH as pn,cI as lc,cJ as Fs,cK as Os,cL as ya,cM as ic,cN as ca,cO as oc,cP as Vn,cQ as Hr,cR as Fn,cS as da,cT as cc,cU as dc,cV as mc,cW as uc,cX as Ur,cY as xc,cZ as hc,c_ as Kr,c$ as tn,d0 as Br,d1 as pc,d2 as Gr,d3 as Wr,d4 as gc,d5 as fc,d6 as jc,d7 as vc,d8 as bc}from"./vendor.js";import"./index.js";var Th=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dh(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function yc(s){if(s.__esModule)return s;var n=s.default;if(typeof n=="function"){var t=function r(){return this instanceof r?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var a=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return s[r]}})}),t}const Nc={theme:"system",setTheme:()=>null},Yr=m.createContext(Nc);function _c({children:s,defaultTheme:n="system",storageKey:t="vite-ui-theme",...r}){const[a,l]=m.useState(()=>localStorage.getItem(t)||n);m.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),a==="system"){const u=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(u);return}c.classList.add(a)},[a]);const i={theme:a,setTheme:c=>{localStorage.setItem(t,c),l(c)}};return e.jsx(Yr.Provider,{...r,value:i,children:s})}const wc=()=>{const s=m.useContext(Yr);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Cc=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),Sc=function(s,n){return new URL(s,n).href},On={},fe=function(n,t,r){let a=Promise.resolve();if(t&&t.length>0){const i=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),u=c?.nonce||c?.getAttribute("nonce");a=Promise.allSettled(t.map(o=>{if(o=Sc(o,r),o in On)return;On[o]=!0;const d=o.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(!!r)for(let k=i.length-1;k>=0;k--){const C=i[k];if(C.href===o&&(!d||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${h}`))return;const P=document.createElement("link");if(P.rel=d?"stylesheet":Cc,d||(P.as="script"),P.crossOrigin="",P.href=o,u&&P.setAttribute("nonce",u),document.head.appendChild(P),d)return new Promise((k,C)=>{P.addEventListener("load",k),P.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${o}`)))})}))}function l(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&l(c.reason);return n().catch(l)})};function y(...s){return Xl(Zl(s))}const wt=Zs("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"}}),E=m.forwardRef(({className:s,variant:n,size:t,asChild:r=!1,children:a,disabled:l,loading:i=!1,leftSection:c,rightSection:u,...o},d)=>{const h=r?rn:"button";return e.jsxs(h,{className:y(wt({variant:n,size:t,className:s})),disabled:i||l,ref:d,...o,children:[(c&&i||!c&&!u&&i)&&e.jsx(kn,{className:"mr-2 h-4 w-4 animate-spin"}),!i&&c&&e.jsx("div",{className:"mr-2",children:c}),a,!i&&u&&e.jsx("div",{className:"ml-2",children:u}),u&&i&&e.jsx(kn,{className:"ml-2 h-4 w-4 animate-spin"})]})});E.displayName="Button";function dt({className:s,minimal:n=!1}){const t=Vs(),r=ei(),a=r?.message||r?.statusText||"Unknown error occurred";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:[!n&&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",{}),a]}),!n&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(E,{variant:"outline",onClick:()=>t(-1),children:"Go Back"}),e.jsx(E,{onClick:()=>t("/"),children:"Back to Home"})]})]})})}function Mn(){const s=Vs();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(E,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(E,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function kc(){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(E,{variant:"outline",children:"Learn more"})})]})})}function Tc(s){return typeof s>"u"}function Dc(s){return s===null}function Ec(s){return Dc(s)||Tc(s)}class Pc{storage;prefixKey;constructor(n){this.storage=n.storage,this.prefixKey=n.prefixKey}getKey(n){return`${this.prefixKey}${n}`.toUpperCase()}set(n,t,r=null){const a=JSON.stringify({value:t,time:Date.now(),expire:r!==null?new Date().getTime()+r*1e3:null});this.storage.setItem(this.getKey(n),a)}get(n,t=null){const r=this.storage.getItem(this.getKey(n));if(!r)return{value:t,time:0};try{const a=JSON.parse(r),{value:l,time:i,expire:c}=a;return Ec(c)||c>new Date().getTime()?{value:l,time:i}:(this.remove(n),{value:t,time:0})}catch{return this.remove(n),{value:t,time:0}}}remove(n){this.storage.removeItem(this.getKey(n))}clear(){this.storage.clear()}}function Jr({prefixKey:s="",storage:n=sessionStorage}){return new Pc({prefixKey:s,storage:n})}const Qr="Xboard_",Rc=function(s={}){return Jr({prefixKey:s.prefixKey||"",storage:localStorage})},Ic=function(s={}){return Jr({prefixKey:s.prefixKey||"",storage:sessionStorage})},Na=Rc({prefixKey:Qr});Ic({prefixKey:Qr});const Xr="access_token";function At(){return Na.get(Xr)}function Zr(){Na.remove(Xr)}const zn=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Lc({children:s}){const n=Vs(),t=ln(),r=At();return m.useEffect(()=>{if(!r.value&&!zn.includes(t.pathname)){const a=encodeURIComponent(t.pathname+t.search);n(`/sign-in?redirect=${a}`)}},[r.value,t.pathname,t.search,n]),zn.includes(t.pathname)||r.value?e.jsx(e.Fragment,{children:s}):null}const ke=m.forwardRef(({className:s,orientation:n="horizontal",decorative:t=!0,...r},a)=>e.jsx(Yn,{ref:a,decorative:t,orientation:n,className:y("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...r}));ke.displayName=Yn.displayName;const Vc=Zs("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ma=m.forwardRef(({className:s,...n},t)=>e.jsx(Jn,{ref:t,className:y(Vc(),s),...n}));ma.displayName=Jn.displayName;const we=ti,el=m.createContext({}),v=({...s})=>e.jsx(el.Provider,{value:{name:s.name},children:e.jsx(ai,{...s})}),_a=()=>{const s=m.useContext(el),n=m.useContext(sl),{getFieldState:t,formState:r}=si(),a=t(s.name,r);if(!s)throw new Error("useFormField should be used within ");const{id:l}=n;return{id:l,name:s.name,formItemId:`${l}-form-item`,formDescriptionId:`${l}-form-item-description`,formMessageId:`${l}-form-item-message`,...a}},sl=m.createContext({}),f=m.forwardRef(({className:s,...n},t)=>{const r=m.useId();return e.jsx(sl.Provider,{value:{id:r},children:e.jsx("div",{ref:t,className:y("space-y-2",s),...n})})});f.displayName="FormItem";const j=m.forwardRef(({className:s,...n},t)=>{const{error:r,formItemId:a}=_a();return e.jsx(ma,{ref:t,className:y(r&&"text-destructive",s),htmlFor:a,...n})});j.displayName="FormLabel";const b=m.forwardRef(({...s},n)=>{const{error:t,formItemId:r,formDescriptionId:a,formMessageId:l}=_a();return e.jsx(rn,{ref:n,id:r,"aria-describedby":t?`${a} ${l}`:`${a}`,"aria-invalid":!!t,...s})});b.displayName="FormControl";const F=m.forwardRef(({className:s,...n},t)=>{const{formDescriptionId:r}=_a();return e.jsx("p",{ref:t,id:r,className:y("text-[0.8rem] text-muted-foreground",s),...n})});F.displayName="FormDescription";const D=m.forwardRef(({className:s,children:n,...t},r)=>{const{error:a,formMessageId:l}=_a(),i=a?String(a?.message):n;return i?e.jsx("p",{ref:r,id:l,className:y("text-[0.8rem] font-medium text-destructive",s),...t,children:i}):null});D.displayName="FormMessage";const wa=ni,Gt=m.forwardRef(({className:s,...n},t)=>e.jsx(Qn,{ref:t,className:y("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...n}));Gt.displayName=Qn.displayName;const Be=m.forwardRef(({className:s,...n},t)=>e.jsx(Xn,{ref:t,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),...n}));Be.displayName=Xn.displayName;const Ns=m.forwardRef(({className:s,...n},t)=>e.jsx(Zn,{ref:t,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),...n}));Ns.displayName=Zn.displayName;function Ce(s=void 0,n="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),ri(s).format(n))}function Fc(s=void 0,n="YYYY-MM-DD"){return Ce(s,n)}function gt(s){const n=typeof s=="string"?parseFloat(s):s;return isNaN(n)?"0.00":n.toFixed(2)}function Ws(s,n=!0){if(s==null)return n?"¥0.00":"0.00";const t=typeof s=="string"?parseFloat(s):s;if(isNaN(t))return n?"¥0.00":"0.00";const a=(t/100).toFixed(2).replace(/\.?0+$/,l=>l.includes(".")?".00":l);return n?`¥${a}`:a}function ua(s){return new Promise(n=>{(async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(s);else{const r=document.createElement("textarea");r.value=s,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();const a=document.execCommand("copy");if(document.body.removeChild(r),!a)throw new Error("execCommand failed")}n(!0)}catch(r){console.error(r),n(!1)}})()})}function _s(s){const n=s/1024,t=n/1024,r=t/1024,a=r/1024;return a>=1?gt(a)+" TB":r>=1?gt(r)+" GB":t>=1?gt(t)+" MB":gt(n)+" KB"}const Oc="locale";function Mc(){return Na.get(Oc)}function tl(){Zr();const s=window.location.pathname,n=s&&!["/404","/sign-in"].includes(s),t=new URL(window.location.href),a=`${t.pathname.split("/")[1]?`/${t.pathname.split("/")[1]}`:""}#/sign-in`;window.location.href=a+(n?`?redirect=${s}`:"")}const zc=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function Ac(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const ft=li.create({baseURL:Ac(),timeout:12e3,headers:{"Content-Type":"application/json"}});ft.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const n=At();if(!zc.includes(s.url?.split("?")[0]||"")){if(!n.value)return tl(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=n.value}return s.headers["Content-Language"]=Mc().value||"zh-CN",s},s=>Promise.reject(s));ft.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const n=s.response?.status,t=s.response?.data?.message;return(n===401||n===403)&&tl(),$.error(t||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[n]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});const O={get:(s,n)=>ft.get(s,n),post:(s,n,t)=>ft.post(s,n,t),put:(s,n,t)=>ft.put(s,n,t),delete:(s,n)=>ft.delete(s,n)},$c="access_token";function qc(s){Na.set($c,s)}const Bs=window?.settings?.secure_path,xa={getStats:()=>O.get(Bs+"/monitor/api/stats"),getOverride:()=>O.get(Bs+"/stat/getOverride"),getOrderStat:s=>O.get(Bs+"/stat/getOrder",{params:s}),getStatsData:()=>O.get(Bs+"/stat/getStats"),getNodeTrafficData:s=>O.get(Bs+"/stat/getTrafficRank",{params:s}),getServerLastRank:()=>O.get(Bs+"/stat/getServerLastRank"),getServerYesterdayRank:()=>O.get(Bs+"/stat/getServerYesterdayRank")},kt=window?.settings?.secure_path,Vt={getList:()=>O.get(kt+"/theme/getThemes"),getConfig:s=>O.post(kt+"/theme/getThemeConfig",{name:s}),updateConfig:(s,n)=>O.post(kt+"/theme/saveThemeConfig",{name:s,config:n}),upload:s=>{const n=new FormData;return n.append("file",s),O.post(kt+"/theme/upload",n,{headers:{"Content-Type":"multipart/form-data"}})},drop:s=>O.post(kt+"/theme/delete",{name:s})},mt=window?.settings?.secure_path,Js={getList:()=>O.get(mt+"/server/manage/getNodes"),save:s=>O.post(mt+"/server/manage/save",s),drop:s=>O.post(mt+"/server/manage/drop",s),copy:s=>O.post(mt+"/server/manage/copy",s),update:s=>O.post(mt+"/server/manage/update",s),sort:s=>O.post(mt+"/server/manage/sort",s)},za=window?.settings?.secure_path,at={getList:()=>O.get(za+"/server/group/fetch"),save:s=>O.post(za+"/server/group/save",s),drop:s=>O.post(za+"/server/group/drop",s)},Aa=window?.settings?.secure_path,Ca={getList:()=>O.get(Aa+"/server/route/fetch"),save:s=>O.post(Aa+"/server/route/save",s),drop:s=>O.post(Aa+"/server/route/drop",s)},Gs=window?.settings?.secure_path,Qs={getList:()=>O.get(Gs+"/payment/fetch"),getMethodList:()=>O.get(Gs+"/payment/getPaymentMethods"),getMethodForm:s=>O.post(Gs+"/payment/getPaymentForm",s),save:s=>O.post(Gs+"/payment/save",s),drop:s=>O.post(Gs+"/payment/drop",s),updateStatus:s=>O.post(Gs+"/payment/show",s),sort:s=>O.post(Gs+"/payment/sort",s)},Tt=window?.settings?.secure_path,$t={getList:()=>O.get(`${Tt}/notice/fetch`),save:s=>O.post(`${Tt}/notice/save`,s),drop:s=>O.post(`${Tt}/notice/drop`,{id:s}),updateStatus:s=>O.post(`${Tt}/notice/show`,{id:s}),sort:s=>O.post(`${Tt}/notice/sort`,{ids:s})},ut=window?.settings?.secure_path,vt={getList:()=>O.get(ut+"/knowledge/fetch"),getInfo:s=>O.get(ut+"/knowledge/fetch?id="+s),save:s=>O.post(ut+"/knowledge/save",s),drop:s=>O.post(ut+"/knowledge/drop",s),updateStatus:s=>O.post(ut+"/knowledge/show",s),sort:s=>O.post(ut+"/knowledge/sort",s)},Dt=window?.settings?.secure_path,Xe={getList:()=>O.get(Dt+"/plan/fetch"),save:s=>O.post(Dt+"/plan/save",s),update:s=>O.post(Dt+"/plan/update",s),drop:s=>O.post(Dt+"/plan/drop",s),sort:s=>O.post(Dt+"/plan/sort",{ids:s})},xt=window?.settings?.secure_path,Ys={getList:s=>O.post(xt+"/order/fetch",s),getInfo:s=>O.post(xt+"/order/detail",s),markPaid:s=>O.post(xt+"/order/paid",s),makeCancel:s=>O.post(xt+"/order/cancel",s),update:s=>O.post(xt+"/order/update",s),assign:s=>O.post(xt+"/order/assign",s)},Qt=window?.settings?.secure_path,ha={getList:s=>O.post(Qt+"/coupon/fetch",s),save:s=>O.post(Qt+"/coupon/generate",s),drop:s=>O.post(Qt+"/coupon/drop",s),update:s=>O.post(Qt+"/coupon/update",s)},ys=window?.settings?.secure_path,Cs={getList:s=>O.post(`${ys}/user/fetch`,s),update:s=>O.post(`${ys}/user/update`,s),resetSecret:s=>O.post(`${ys}/user/resetSecret`,{id:s}),generate:s=>s.download_csv?O.post(`${ys}/user/generate`,s,{responseType:"blob"}):O.post(`${ys}/user/generate`,s),getStats:s=>O.post(`${ys}/stat/getStatUser`,s),destroy:s=>O.post(`${ys}/user/destroy`,{id:s}),sendMail:s=>O.post(`${ys}/user/sendMail`,s),dumpCSV:s=>O.post(`${ys}/user/dumpCSV`,s,{responseType:"blob"}),batchBan:s=>O.post(`${ys}/user/ban`,s)},Xt=window?.settings?.secure_path,jt={getList:s=>O.post(Xt+"/ticket/fetch",s),getInfo:s=>O.get(Xt+"/ticket/fetch?id= "+s),reply:s=>O.post(Xt+"/ticket/reply",s),close:s=>O.post(Xt+"/ticket/close",{id:s})},ns=window?.settings?.secure_path,me={getSettings:(s="")=>O.get(ns+"/config/fetch?key="+s),saveSettings:s=>O.post(ns+"/config/save",s),getEmailTemplate:()=>O.get(ns+"/config/getEmailTemplate"),sendTestMail:()=>O.post(ns+"/config/testSendMail"),setTelegramWebhook:()=>O.post(ns+"/config/setTelegramWebhook"),updateSystemConfig:s=>O.post(ns+"/config/save",s),getSystemStatus:()=>O.get(`${ns}/system/getSystemStatus`),getQueueStats:()=>O.get(`${ns}/system/getQueueStats`),getQueueWorkload:()=>O.get(`${ns}/system/getQueueWorkload`),getQueueMasters:()=>O.get(`${ns}/system/getQueueMasters`),getHorizonFailedJobs:s=>O.get(`${ns}/system/getHorizonFailedJobs`,{params:s}),getSystemLog:s=>O.get(`${ns}/system/getSystemLog`,{params:s})},Ps=window?.settings?.secure_path,Rs={getPluginList:()=>O.get(`${Ps}/plugin/getPlugins`),uploadPlugin:s=>{const n=new FormData;return n.append("file",s),O.post(`${Ps}/plugin/upload`,n,{headers:{"Content-Type":"multipart/form-data"}})},deletePlugin:s=>O.post(`${Ps}/plugin/delete`,{code:s}),installPlugin:s=>O.post(`${Ps}/plugin/install`,{code:s}),uninstallPlugin:s=>O.post(`${Ps}/plugin/uninstall`,{code:s}),enablePlugin:s=>O.post(`${Ps}/plugin/enable`,{code:s}),disablePlugin:s=>O.post(`${Ps}/plugin/disable`,{code:s}),getPluginConfig:s=>O.get(`${Ps}/plugin/config`,{params:{code:s}}),updatePluginConfig:(s,n)=>O.post(`${Ps}/plugin/config`,{code:s,config:n})};window?.settings?.secure_path;const Hc=x.object({subscribe_template_singbox:x.string().nullable(),subscribe_template_clash:x.string().nullable(),subscribe_template_clashmeta:x.string().nullable(),subscribe_template_stash:x.string().nullable(),subscribe_template_surge:x.string().nullable(),subscribe_template_surfboard:x.string().nullable()}),Uc={subscribe_template_singbox:"",subscribe_template_clash:"",subscribe_template_clashmeta:"",subscribe_template_stash:"",subscribe_template_surge:"",subscribe_template_surfboard:""};function Kc(){const{t:s}=V("settings"),[n,t]=m.useState(!1),r=m.useRef(null),[a,l]=m.useState("singbox"),i=ye({resolver:_e(Hc),defaultValues:Uc,mode:"onBlur"}),{data:c}=ne({queryKey:["settings","client"],queryFn:()=>me.getSettings("subscribe_template")}),{mutateAsync:u}=hs({mutationFn:me.saveSettings,onSuccess:h=>{h.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(c?.data.subscribe_template){const h=c.data.subscribe_template;Object.entries(h).forEach(([w,P])=>{i.setValue(w,P)}),r.current=h}},[c]),console.log(i.getValues());const o=m.useCallback(Se.debounce(async h=>{if(!Se.isEqual(h,r.current)){t(!0);try{await u(h),r.current=h}finally{t(!1)}}},1e3),[u]),d=m.useCallback(h=>{o(h)},[o]);return e.jsx(we,{...i,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(wa,{value:a,onValueChange:l,children:[e.jsxs(Gt,{children:[e.jsx(Be,{value:"singbox",children:"Sing-box"}),e.jsx(Be,{value:"clash",children:"Clash"}),e.jsx(Be,{value:"clashmeta",children:"Clash Meta"}),e.jsx(Be,{value:"stash",children:"Stash"}),e.jsx(Be,{value:"surge",children:"Surge"}),e.jsx(Be,{value:"surfboard",children:"Surfboard"})]}),e.jsx(Ns,{value:"singbox",children:e.jsx(v,{control:i.control,name:"subscribe_template_singbox",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.singbox.title")}),e.jsx(b,{children:e.jsx(ct,{height:"500px",defaultLanguage:"json",value:h.value||"",onChange:w=>{typeof w=="string"&&(h.onChange(w),d(i.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.singbox.description")}),e.jsx(D,{})]})})}),e.jsx(Ns,{value:"clash",children:e.jsx(v,{control:i.control,name:"subscribe_template_clash",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.clash.title")}),e.jsx(b,{children:e.jsx(ct,{height:"500px",defaultLanguage:"yaml",value:h.value||"",onChange:w=>{typeof w=="string"&&(h.onChange(w),d(i.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.clash.description")}),e.jsx(D,{})]})})}),e.jsx(Ns,{value:"clashmeta",children:e.jsx(v,{control:i.control,name:"subscribe_template_clashmeta",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.clashmeta.title")}),e.jsx(b,{children:e.jsx(ct,{height:"500px",defaultLanguage:"yaml",value:h.value||"",onChange:w=>{typeof w=="string"&&(h.onChange(w),d(i.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.clashmeta.description")}),e.jsx(D,{})]})})}),e.jsx(Ns,{value:"stash",children:e.jsx(v,{control:i.control,name:"subscribe_template_stash",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.stash.title")}),e.jsx(b,{children:e.jsx(ct,{height:"500px",defaultLanguage:"yaml",value:h.value||"",onChange:w=>{typeof w=="string"&&(h.onChange(w),d(i.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.stash.description")}),e.jsx(D,{})]})})}),e.jsx(Ns,{value:"surge",children:e.jsx(v,{control:i.control,name:"subscribe_template_surge",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.surge.title")}),e.jsx(b,{children:e.jsx(ct,{height:"500px",defaultLanguage:"ini",value:h.value||"",onChange:w=>{typeof w=="string"&&(h.onChange(w),d(i.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.surge.description")}),e.jsx(D,{})]})})}),e.jsx(Ns,{value:"surfboard",children:e.jsx(v,{control:i.control,name:"subscribe_template_surfboard",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.surfboard.title")}),e.jsx(b,{children:e.jsx(ct,{height:"500px",defaultLanguage:"ini",value:h.value||"",onChange:w=>{typeof w=="string"&&(h.onChange(w),d(i.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.surfboard.description")}),e.jsx(D,{})]})})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Bc(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("subscribe_template.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("subscribe_template.description")})]}),e.jsx(ke,{}),e.jsx(Kc,{})]})}const Gc=()=>e.jsx(Lc,{children:e.jsx(on,{})}),Wc=ii([{path:"/sign-in",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>md);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(Gc,{}),children:[{path:"/",lazy:async()=>({Component:(await fe(()=>Promise.resolve().then(()=>bd),void 0,import.meta.url)).default}),errorElement:e.jsx(dt,{}),children:[{index:!0,lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ad);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(dt,{}),children:[{path:"system",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ud);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Wd);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Zd);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>nm);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>cm);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>hm);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>vm);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>wm);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Dm);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Lm);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe-template",element:e.jsx(Bc,{})}]},{path:"payment",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>qm);return{default:s}},void 0,import.meta.url)).default})},{path:"plugin",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Km);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ym);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>tu);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>du);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(dt,{}),children:[{path:"manage",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Au);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ku);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Qu);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(dt,{}),children:[{path:"plan",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>lx);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>bx);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Dx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(dt,{}),children:[{path:"manage",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>rh);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ch);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:dt},{path:"/404",Component:Mn},{path:"/503",Component:kc},{path:"*",Component:Mn}]);function Yc(){return O.get("/user/info")}const $a={token:At()?.value||"",userInfo:null,isLoggedIn:!!At()?.value,loading:!1,error:null},Ft=oi("user/fetchUserInfo",async()=>(await Yc()).data,{condition:(s,{getState:n})=>{const{user:t}=n();return!!t.token&&!t.loading}}),al=ci({name:"user",initialState:$a,reducers:{setToken(s,n){s.token=n.payload,s.isLoggedIn=!!n.payload},resetUserState:()=>$a},extraReducers:s=>{s.addCase(Ft.pending,n=>{n.loading=!0,n.error=null}).addCase(Ft.fulfilled,(n,t)=>{n.loading=!1,n.userInfo=t.payload,n.error=null}).addCase(Ft.rejected,(n,t)=>{if(n.loading=!1,n.error=t.error.message||"Failed to fetch user info",!n.token)return $a})}}),{setToken:Jc,resetUserState:Qc}=al.actions,Xc=s=>s.user.userInfo,Zc=al.reducer,nl=di({reducer:{user:Zc}});At()?.value&&nl.dispatch(Ft());mi.use(ui).use(xi).init({resources:{"en-US":window.XBOARD_TRANSLATIONS?.["en-US"]||{},"zh-CN":window.XBOARD_TRANSLATIONS?.["zh-CN"]||{},"ko-KR":window.XBOARD_TRANSLATIONS?.["ko-KR"]||{}},fallbackLng:"zh-CN",supportedLngs:["en-US","zh-CN","ko-KR"],detection:{order:["querystring","localStorage","navigator"],lookupQuerystring:"lang",lookupLocalStorage:"i18nextLng",caches:["localStorage"]},interpolation:{escapeValue:!1}});const ed=new hi;pi.createRoot(document.getElementById("root")).render(e.jsx(gi.StrictMode,{children:e.jsx(fi,{client:ed,children:e.jsx(ji,{store:nl,children:e.jsxs(_c,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(vi,{router:Wc}),e.jsx(bi,{richColors:!0,position:"top-right"})]})})})}));const We=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:y("rounded-xl border bg-card text-card-foreground shadow",s),...n}));We.displayName="Card";const Ze=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:y("flex flex-col space-y-1.5 p-6",s),...n}));Ze.displayName="CardHeader";const ws=m.forwardRef(({className:s,...n},t)=>e.jsx("h3",{ref:t,className:y("font-semibold leading-none tracking-tight",s),...n}));ws.displayName="CardTitle";const Xs=m.forwardRef(({className:s,...n},t)=>e.jsx("p",{ref:t,className:y("text-sm text-muted-foreground",s),...n}));Xs.displayName="CardDescription";const es=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:y("p-6 pt-0",s),...n}));es.displayName="CardContent";const sd=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:y("flex items-center p-6 pt-0",s),...n}));sd.displayName="CardFooter";const T=m.forwardRef(({className:s,type:n,...t},r)=>e.jsx("input",{type:n,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:r,...t}));T.displayName="Input";const rl=m.forwardRef(({className:s,...n},t)=>{const[r,a]=m.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:r?"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:t,...n}),e.jsx(E,{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:()=>a(l=>!l),children:r?e.jsx(yi,{size:18}):e.jsx(Ni,{size:18})})]})});rl.displayName="PasswordInput";const td=s=>O.post("/passport/auth/login",s);function ad({className:s,onForgotPassword:n,...t}){const r=Vs(),a=er(),{t:l}=V("auth"),i=x.object({email:x.string().min(1,{message:l("signIn.validation.emailRequired")}),password:x.string().min(1,{message:l("signIn.validation.passwordRequired")}).min(7,{message:l("signIn.validation.passwordLength")})}),c=ye({resolver:_e(i),defaultValues:{email:"",password:""}});async function u(o){try{const{data:d}=await td(o);qc(d.auth_data),a(Jc(d.auth_data)),await a(Ft()).unwrap(),r("/")}catch(d){console.error("Login failed:",d),d.response?.data?.message&&c.setError("root",{message:d.response.data.message})}}return e.jsx("div",{className:y("grid gap-6",s),...t,children:e.jsx(we,{...c,children:e.jsx("form",{onSubmit:c.handleSubmit(u),className:"space-y-4",children:e.jsxs("div",{className:"space-y-4",children:[c.formState.errors.root&&e.jsx("div",{className:"text-sm text-destructive",children:c.formState.errors.root.message}),e.jsx(v,{control:c.control,name:"email",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:l("signIn.email")}),e.jsx(b,{children:e.jsx(T,{placeholder:l("signIn.emailPlaceholder"),autoComplete:"email",...o})}),e.jsx(D,{})]})}),e.jsx(v,{control:c.control,name:"password",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:l("signIn.password")}),e.jsx(b,{children:e.jsx(rl,{placeholder:l("signIn.passwordPlaceholder"),autoComplete:"current-password",...o})}),e.jsx(D,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(E,{variant:"link",type:"button",className:"px-0 text-sm font-normal text-muted-foreground hover:text-primary",onClick:n,children:l("signIn.forgotPassword")})}),e.jsx(E,{className:"w-full",size:"lg",loading:c.formState.isSubmitting,children:l("signIn.submit")})]})})})})}const pe=sr,as=tr,nd=ar,qs=cn,ll=m.forwardRef(({className:s,...n},t)=>e.jsx(ga,{ref: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),...n}));ll.displayName=ga.displayName;const ue=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(nd,{children:[e.jsx(ll,{}),e.jsxs(fa,{ref:r,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),...t,children:[n,e.jsxs(cn,{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(ls,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ue.displayName=fa.displayName;const ve=({className:s,...n})=>e.jsx("div",{className:y("flex flex-col space-y-1.5 text-center sm:text-left",s),...n});ve.displayName="DialogHeader";const Pe=({className:s,...n})=>e.jsx("div",{className:y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Pe.displayName="DialogFooter";const ge=m.forwardRef(({className:s,...n},t)=>e.jsx(ja,{ref:t,className:y("text-lg font-semibold leading-none tracking-tight",s),...n}));ge.displayName=ja.displayName;const Le=m.forwardRef(({className:s,...n},t)=>e.jsx(va,{ref:t,className:y("text-sm text-muted-foreground",s),...n}));Le.displayName=va.displayName;const bt=Zs("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"}}),B=m.forwardRef(({className:s,variant:n,size:t,asChild:r=!1,...a},l)=>{const i=r?rn:"button";return e.jsx(i,{className:y(bt({variant:n,size:t,className:s})),ref:l,...a})});B.displayName="Button";const Is=Ci,Ls=Si,rd=ki,ld=m.forwardRef(({className:s,inset:n,children:t,...r},a)=>e.jsxs(nr,{ref:a,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",n&&"pl-8",s),...r,children:[t,e.jsx(dn,{className:"ml-auto h-4 w-4"})]}));ld.displayName=nr.displayName;const id=m.forwardRef(({className:s,...n},t)=>e.jsx(rr,{ref:t,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),...n}));id.displayName=rr.displayName;const Ss=m.forwardRef(({className:s,sideOffset:n=4,...t},r)=>e.jsx(_i,{children:e.jsx(lr,{ref:r,sideOffset:n,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),...t})}));Ss.displayName=lr.displayName;const Ne=m.forwardRef(({className:s,inset:n,...t},r)=>e.jsx(ir,{ref:r,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",n&&"pl-8",s),...t}));Ne.displayName=ir.displayName;const od=m.forwardRef(({className:s,children:n,checked:t,...r},a)=>e.jsxs(or,{ref:a,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:t,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(cr,{children:e.jsx(et,{className:"h-4 w-4"})})}),n]}));od.displayName=or.displayName;const cd=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(dr,{ref:r,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),...t,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(cr,{children:e.jsx(wi,{className:"h-4 w-4 fill-current"})})}),n]}));cd.displayName=dr.displayName;const gn=m.forwardRef(({className:s,inset:n,...t},r)=>e.jsx(mr,{ref:r,className:y("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",s),...t}));gn.displayName=mr.displayName;const yt=m.forwardRef(({className:s,...n},t)=>e.jsx(ur,{ref:t,className:y("-mx-1 my-1 h-px bg-muted",s),...n}));yt.displayName=ur.displayName;const an=({className:s,...n})=>e.jsx("span",{className:y("ml-auto text-xs tracking-widest opacity-60",s),...n});an.displayName="DropdownMenuShortcut";const qa=[{code:"en-US",name:"English",flag:Ti,shortName:"EN"},{code:"zh-CN",name:"中文",flag:Di,shortName:"CN"},{code:"ko-KR",name:"한국어",flag:Ei,shortName:"KR"}];function il(){const{i18n:s}=V(),n=a=>{s.changeLanguage(a)},t=qa.find(a=>a.code===s.language)||qa[1],r=t.flag;return e.jsxs(Is,{children:[e.jsx(Ls,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",children:[e.jsx(r,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:"text-sm font-medium",children:t.shortName})]})}),e.jsx(Ss,{align:"end",className:"w-[120px]",children:qa.map(a=>{const l=a.flag,i=a.code===s.language;return e.jsxs(Ne,{onClick:()=>n(a.code),className:y("flex items-center gap-2 px-2 py-1.5 cursor-pointer",i&&"bg-accent"),children:[e.jsx(l,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:y("text-sm",i&&"font-medium"),children:a.name})]},a.code)})})]})}function dd(){const[s,n]=m.useState(!1),{t}=V("auth"),r=t("signIn.resetPassword.command");return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"container relative flex min-h-svh flex-col items-center justify-center bg-primary-foreground px-4 py-8 lg:max-w-none lg:px-0",children:[e.jsx("div",{className:"absolute right-4 top-4 md:right-8 md:top-8",children:e.jsx(il,{})}),e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px] md:w-[420px] lg:p-8",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold sm:text-3xl",children:window?.settings?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:window?.settings?.description})]}),e.jsxs(We,{className:"p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-tight sm:text-2xl",children:t("signIn.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("signIn.description")})]}),e.jsx(ad,{onForgotPassword:()=>n(!0)})]})]})]}),e.jsx(pe,{open:s,onOpenChange:n,children:e.jsx(ue,{className:"max-w-[90vw] sm:max-w-lg",children:e.jsxs(ve,{children:[e.jsx(ge,{children:t("signIn.resetPassword.title")}),e.jsx(Le,{children:t("signIn.resetPassword.description")}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"max-w-full overflow-x-auto rounded-md bg-secondary p-4 pr-12 text-sm",children:r}),e.jsx(B,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>ua(r).then(()=>{$.success(t("common:copy.success"))}),children:e.jsx(Pi,{className:"h-4 w-4"})})]})})]})})})]})}const md=Object.freeze(Object.defineProperty({__proto__:null,default:dd},Symbol.toStringTag,{value:"Module"})),Ve=m.forwardRef(({className:s,fadedBelow:n=!1,fixedHeight:t=!1,...r},a)=>e.jsx("div",{ref:a,className:y("relative flex h-full w-full flex-col",n&&"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",t&&"md:h-svh",s),...r}));Ve.displayName="Layout";const Fe=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:y("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...n}));Fe.displayName="LayoutHeader";const ze=m.forwardRef(({className:s,fixedHeight:n,...t},r)=>e.jsx("div",{ref:r,className:y("flex-1 overflow-hidden px-4 py-6 md:px-8",n&&"h-[calc(100%-var(--header-height))]",s),...t}));ze.displayName="LayoutBody";const ol=Ri,cl=Ii,dl=Li,be=Vi,xe=Fi,he=Oi,ce=m.forwardRef(({className:s,sideOffset:n=4,...t},r)=>e.jsx(xr,{ref:r,sideOffset:n,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),...t}));ce.displayName=xr.displayName;function Sa(){const{pathname:s}=ln();return{checkActiveNav:t=>{if(t==="/"&&s==="/")return!0;const r=t.replace(/^\//,""),a=s.replace(/^\//,"");return r?a.startsWith(r):!1}}}function ml({key:s,defaultValue:n}){const[t,r]=m.useState(()=>{const a=localStorage.getItem(s);return a!==null?JSON.parse(a):n});return m.useEffect(()=>{localStorage.setItem(s,JSON.stringify(t))},[t,s]),[t,r]}function ud(){const[s,n]=ml({key:"collapsed-sidebar-items",defaultValue:[]}),t=a=>!s.includes(a);return{isExpanded:t,toggleItem:a=>{t(a)?n([...s,a]):n(s.filter(l=>l!==a))}}}function xd({links:s,isCollapsed:n,className:t,closeNav:r}){const{t:a}=V(),l=({sub:i,...c})=>{const u=`${a(c.title)}-${c.href}`;return n&&i?m.createElement(gd,{...c,sub:i,key:u,closeNav:r}):n?m.createElement(pd,{...c,key:u,closeNav:r}):i?m.createElement(hd,{...c,sub:i,key:u,closeNav:r}):m.createElement(ul,{...c,key:u,closeNav:r})};return e.jsx("div",{"data-collapsed":n,className:y("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",t),children:e.jsx(be,{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 ul({title:s,icon:n,label:t,href:r,closeNav:a,subLink:l=!1}){const{checkActiveNav:i}=Sa(),{t:c}=V();return e.jsxs(st,{to:r,onClick:a,className:y(wt({variant:i(r)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",l&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":i(r)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:n}),c(s),t&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:c(t)})]})}function hd({title:s,icon:n,label:t,sub:r,closeNav:a}){const{checkActiveNav:l}=Sa(),{isExpanded:i,toggleItem:c}=ud(),{t:u}=V(),o=!!r?.find(w=>l(w.href)),d=u(s),h=i(d)||o;return e.jsxs(ol,{open:h,onOpenChange:()=>c(d),children:[e.jsxs(cl,{className:y(wt({variant:o?"secondary":"ghost",size:"sm"}),"group h-12 w-full justify-start rounded-none px-6"),children:[e.jsx("div",{className:"mr-2",children:n}),u(s),t&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:u(t)}),e.jsx("span",{className:y('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(hr,{stroke:1})})]}),e.jsx(dl,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:r.map(w=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(ul,{...w,subLink:!0,closeNav:a})},u(w.title)))})})]})}function pd({title:s,icon:n,label:t,href:r,closeNav:a}){const{checkActiveNav:l}=Sa(),{t:i}=V();return e.jsxs(xe,{delayDuration:0,children:[e.jsx(he,{asChild:!0,children:e.jsxs(st,{to:r,onClick:a,className:y(wt({variant:l(r)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[n,e.jsx("span",{className:"sr-only",children:i(s)})]})}),e.jsxs(ce,{side:"right",className:"flex items-center gap-4",children:[i(s),t&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:i(t)})]})]})}function gd({title:s,icon:n,label:t,sub:r,closeNav:a}){const{checkActiveNav:l}=Sa(),{t:i}=V(),c=!!r?.find(u=>l(u.href));return e.jsxs(Is,{children:[e.jsxs(xe,{delayDuration:0,children:[e.jsx(he,{asChild:!0,children:e.jsx(Ls,{asChild:!0,children:e.jsx(E,{variant:c?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:n})})}),e.jsxs(ce,{side:"right",className:"flex items-center gap-4",children:[i(s)," ",t&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:i(t)}),e.jsx(hr,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(Ss,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(gn,{children:[i(s)," ",t?`(${i(t)})`:""]}),e.jsx(yt,{}),r.map(({title:u,icon:o,label:d,href:h})=>e.jsx(Ne,{asChild:!0,children:e.jsxs(st,{to:h,onClick:a,className:`${l(h)?"bg-secondary":""}`,children:[o," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:i(u)}),d&&e.jsx("span",{className:"ml-auto text-xs",children:i(d)})]})},`${i(u)}-${h}`))]})]})}const xl=[{title:"nav:dashboard",label:"",href:"/",icon:e.jsx(Mi,{size:18})},{title:"nav:systemManagement",label:"",href:"",icon:e.jsx(zi,{size:18}),sub:[{title:"nav:systemConfig",label:"",href:"/config/system",icon:e.jsx(pr,{size:18})},{title:"nav:pluginManagement",label:"",href:"/config/plugin",icon:e.jsx(mn,{size:18})},{title:"nav:themeConfig",label:"",href:"/config/theme",icon:e.jsx(Ai,{size:18})},{title:"nav:noticeManagement",label:"",href:"/config/notice",icon:e.jsx($i,{size:18})},{title:"nav:paymentConfig",label:"",href:"/config/payment",icon:e.jsx(Tn,{size:18})},{title:"nav:knowledgeManagement",label:"",href:"/config/knowledge",icon:e.jsx(qi,{size:18})}]},{title:"nav:nodeManagement",label:"",href:"",icon:e.jsx(gr,{size:18}),sub:[{title:"nav:nodeManagement",label:"",href:"/server/manage",icon:e.jsx(Hi,{size:18})},{title:"nav:permissionGroupManagement",label:"",href:"/server/group",icon:e.jsx(fr,{size:18})},{title:"nav:routeManagement",label:"",href:"/server/route",icon:e.jsx(Ui,{size:18})}]},{title:"nav:subscriptionManagement",label:"",href:"",icon:e.jsx(Ki,{size:18}),sub:[{title:"nav:planManagement",label:"",href:"/finance/plan",icon:e.jsx(Bi,{size:18})},{title:"nav:orderManagement",label:"",href:"/finance/order",icon:e.jsx(Tn,{size:18})},{title:"nav:couponManagement",label:"",href:"/finance/coupon",icon:e.jsx(Gi,{size:18})}]},{title:"nav:userManagement",label:"",href:"",icon:e.jsx(Wi,{size:18}),sub:[{title:"nav:userManagement",label:"",href:"/user/manage",icon:e.jsx(Yi,{size:18})},{title:"nav:ticketManagement",label:"",href:"/user/ticket",icon:e.jsx(jr,{size:18})}]}];function fd({className:s,isCollapsed:n,setIsCollapsed:t}){const[r,a]=m.useState(!1),{t:l}=V();return m.useEffect(()=>{r?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[r]),e.jsxs("aside",{className:y(`fixed left-0 right-0 top-0 z-50 flex h-auto flex-col border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${n?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>a(!1),className:`absolute inset-0 transition-[opacity] delay-100 duration-700 ${r?"h-svh opacity-50":"h-0 opacity-0"} w-full bg-black md:hidden`}),e.jsxs(Ve,{className:`flex h-full flex-col ${r?"h-[100vh] md:h-full":""}`,children:[e.jsxs(Fe,{className:"sticky top-0 justify-between px-4 py-3 shadow md:px-4",children:[e.jsxs("div",{className:`flex items-center ${n?"":"gap-2"}`,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:`transition-all ${n?"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 ${n?"invisible w-0":"visible w-auto"}`,children:e.jsx("span",{className:"font-medium",children:window?.settings?.title})})]}),e.jsx(E,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":l("common:toggleNavigation"),"aria-controls":"sidebar-menu","aria-expanded":r,onClick:()=>a(i=>!i),children:r?e.jsx(Ji,{}):e.jsx(Qi,{})})]}),e.jsx(xd,{id:"sidebar-menu",className:y("flex-1 overflow-auto overscroll-contain",r?"block":"hidden md:block","md:py-2"),closeNav:()=>a(!1),isCollapsed:n,links:xl}),e.jsx("div",{className:y("border-t border-border/50 bg-background","px-4 py-2.5 text-xs text-muted-foreground",r?"block":"hidden md:block",n?"text-center":"text-left"),children:e.jsxs("div",{className:y("flex items-center gap-1.5",n?"justify-center":"justify-start"),children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),e.jsxs("span",{className:y("whitespace-nowrap tracking-wide","transition-opacity duration-200",n&&"md:opacity-0"),children:["v",window?.settings?.version]})]})}),e.jsx(E,{onClick:()=>t(i=>!i),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex","aria-label":l("common:toggleSidebar"),children:e.jsx(Xi,{stroke:1.5,className:`h-5 w-5 ${n?"rotate-180":""}`})})]})]})}function jd(){const[s,n]=ml({key:"collapsed-sidebar",defaultValue:!1});return m.useEffect(()=>{const t=()=>{n(window.innerWidth<768?!1:s)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[s,n]),[s,n]}function vd(){const[s,n]=jd();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(fd,{isCollapsed:s,setIsCollapsed:n}),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(on,{})})]})}const bd=Object.freeze(Object.defineProperty({__proto__:null,default:vd},Symbol.toStringTag,{value:"Module"})),Us=m.forwardRef(({className:s,...n},t)=>e.jsx($e,{ref:t,className:y("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...n}));Us.displayName=$e.displayName;const yd=({children:s,...n})=>e.jsx(pe,{...n,children:e.jsx(ue,{className:"overflow-hidden p-0",children:e.jsx(Us,{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})})}),nt=m.forwardRef(({className:s,...n},t)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Zi,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx($e.Input,{ref:t,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),...n})]}));nt.displayName=$e.Input.displayName;const Ks=m.forwardRef(({className:s,...n},t)=>e.jsx($e.List,{ref:t,className:y("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...n}));Ks.displayName=$e.List.displayName;const rt=m.forwardRef((s,n)=>e.jsx($e.Empty,{ref:n,className:"py-6 text-center text-sm",...s}));rt.displayName=$e.Empty.displayName;const ss=m.forwardRef(({className:s,...n},t)=>e.jsx($e.Group,{ref:t,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),...n}));ss.displayName=$e.Group.displayName;const Ct=m.forwardRef(({className:s,...n},t)=>e.jsx($e.Separator,{ref:t,className:y("-mx-1 h-px bg-border",s),...n}));Ct.displayName=$e.Separator.displayName;const Me=m.forwardRef(({className:s,...n},t)=>e.jsx($e.Item,{ref:t,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),...n}));Me.displayName=$e.Item.displayName;function Nd(){const s=[];for(const n of xl)if(n.href&&s.push(n),n.sub)for(const t of n.sub)s.push({...t,parent:n.title});return s}function Ye(){const[s,n]=m.useState(!1),t=Vs(),r=Nd(),{t:a}=V("search"),{t:l}=V("nav");m.useEffect(()=>{const c=u=>{u.key==="k"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),n(o=>!o))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]);const i=m.useCallback(c=>{n(!1),t(c)},[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(B,{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:()=>n(!0),children:[e.jsx(un,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:a("placeholder")}),e.jsx("span",{className:"sr-only",children:a("shortcut.label")}),e.jsx("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:a("shortcut.key")})]}),e.jsxs(yd,{open:s,onOpenChange:n,children:[e.jsx(nt,{placeholder:a("placeholder")}),e.jsxs(Ks,{children:[e.jsx(rt,{children:a("noResults")}),e.jsx(ss,{heading:a("title"),children:r.map(c=>e.jsxs(Me,{value:`${c.parent?c.parent+" ":""}${c.title}`,onSelect:()=>i(c.href),children:[e.jsx("div",{className:"mr-2",children:c.icon}),e.jsx("span",{children:l(c.title)}),c.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:l(c.parent)})]},c.href))})]})]})]})}function qe(){const{theme:s,setTheme:n}=wc();return m.useEffect(()=>{const t=s==="dark"?"#020817":"#fff",r=document.querySelector("meta[name='theme-color']");r&&r.setAttribute("content",t)},[s]),e.jsxs(e.Fragment,{children:[e.jsx(E,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>n(s==="light"?"dark":"light"),children:s==="light"?e.jsx(eo,{size:20}):e.jsx(so,{size:20})}),e.jsx(il,{})]})}const hl=m.forwardRef(({className:s,...n},t)=>e.jsx(vr,{ref:t,className:y("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...n}));hl.displayName=vr.displayName;const pl=m.forwardRef(({className:s,...n},t)=>e.jsx(br,{ref:t,className:y("aspect-square h-full w-full",s),...n}));pl.displayName=br.displayName;const gl=m.forwardRef(({className:s,...n},t)=>e.jsx(yr,{ref:t,className:y("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...n}));gl.displayName=yr.displayName;function He(){const s=Vs(),n=er(),t=to(Xc),{t:r}=V(["common"]),a=()=>{Zr(),n(Qc()),s("/sign-in")},l=t?.email?.split("@")[0]||r("common:user"),i=l.substring(0,2).toUpperCase();return e.jsxs(Is,{children:[e.jsx(Ls,{asChild:!0,children:e.jsx(E,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(hl,{className:"h-8 w-8",children:[e.jsx(pl,{src:t?.avatar_url,alt:l}),e.jsx(gl,{children:i})]})})}),e.jsxs(Ss,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(gn,{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:t?.email||r("common:defaultEmail")})]})}),e.jsx(yt,{}),e.jsx(Ne,{asChild:!0,children:e.jsxs(st,{to:"/config/system",children:[r("common:settings"),e.jsx(an,{children:"⌘S"})]})}),e.jsx(yt,{}),e.jsxs(Ne,{onClick:a,children:[r("common:logout"),e.jsx(an,{children:"⇧⌘Q"})]})]})]})}const J=ao,Ue=uo,Q=no,W=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(Nr,{ref:r,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),...t,children:[n,e.jsx(ro,{asChild:!0,children:e.jsx(xn,{className:"h-4 w-4 opacity-50"})})]}));W.displayName=Nr.displayName;const fl=m.forwardRef(({className:s,...n},t)=>e.jsx(_r,{ref:t,className:y("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(lo,{className:"h-4 w-4"})}));fl.displayName=_r.displayName;const jl=m.forwardRef(({className:s,...n},t)=>e.jsx(wr,{ref:t,className:y("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(xn,{className:"h-4 w-4"})}));jl.displayName=wr.displayName;const Y=m.forwardRef(({className:s,children:n,position:t="popper",...r},a)=>e.jsx(io,{children:e.jsxs(Cr,{ref:a,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",t==="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:t,...r,children:[e.jsx(fl,{}),e.jsx(oo,{className:y("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(jl,{})]})}));Y.displayName=Cr.displayName;const _d=m.forwardRef(({className:s,...n},t)=>e.jsx(Sr,{ref:t,className:y("px-2 py-1.5 text-sm font-semibold",s),...n}));_d.displayName=Sr.displayName;const A=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(kr,{ref:r,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),...t,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(co,{children:e.jsx(et,{className:"h-4 w-4"})})}),e.jsx(mo,{children:n})]}));A.displayName=kr.displayName;const wd=m.forwardRef(({className:s,...n},t)=>e.jsx(Tr,{ref:t,className:y("-mx-1 my-1 h-px bg-muted",s),...n}));wd.displayName=Tr.displayName;function lt({className:s,classNames:n,showOutsideDays:t=!0,...r}){return e.jsx(xo,{showOutsideDays:t,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(bt({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",r.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(bt({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",...n},components:{IconLeft:({className:a,...l})=>e.jsx(Dr,{className:y("h-4 w-4",a),...l}),IconRight:({className:a,...l})=>e.jsx(dn,{className:y("h-4 w-4",a),...l})},...r})}lt.displayName="Calendar";const ks=po,Ts=go,vs=m.forwardRef(({className:s,align:n="center",sideOffset:t=4,...r},a)=>e.jsx(ho,{children:e.jsx(Er,{ref:a,align:n,sideOffset:t,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),...r})}));vs.displayName=Er.displayName;const As={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},Rt=s=>(s/100).toFixed(2),Cd=({active:s,payload:n,label:t})=>{const{t:r}=V();return s&&n&&n.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:t}),n.map((a,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:a.color}}),e.jsxs("span",{className:"text-muted-foreground",children:[r(a.name),":"]}),e.jsx("span",{className:"font-medium",children:a.name.includes(r("dashboard:overview.amount"))?`¥${Rt(a.value)}`:r("dashboard:overview.transactions",{count:a.value})})]},l))]}):null},Sd=[{value:"7d",label:"dashboard:overview.last7Days"},{value:"30d",label:"dashboard:overview.last30Days"},{value:"90d",label:"dashboard:overview.last90Days"},{value:"180d",label:"dashboard:overview.last180Days"},{value:"365d",label:"dashboard:overview.lastYear"},{value:"custom",label:"dashboard:overview.customRange"}],kd=(s,n)=>{const t=new Date;if(s==="custom"&&n)return{startDate:n.from,endDate:n.to};let r;switch(s){case"7d":r=us(t,7);break;case"30d":r=us(t,30);break;case"90d":r=us(t,90);break;case"180d":r=us(t,180);break;case"365d":r=us(t,365);break;default:r=us(t,30)}return{startDate:r,endDate:t}};function Td(){const[s,n]=m.useState("amount"),[t,r]=m.useState("30d"),[a,l]=m.useState({from:us(new Date,7),to:new Date}),{t:i}=V(),{startDate:c,endDate:u}=kd(t,a),{data:o}=ne({queryKey:["orderStat",{start_date:ms(c,"yyyy-MM-dd"),end_date:ms(u,"yyyy-MM-dd")}],queryFn:async()=>{const{data:d}=await xa.getOrderStat({start_date:ms(c,"yyyy-MM-dd"),end_date:ms(u,"yyyy-MM-dd")});return d},refetchInterval:3e4});return e.jsxs(We,{children:[e.jsx(Ze,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(ws,{children:i("dashboard:overview.title")}),e.jsxs(Xs,{children:[o?.summary.start_date," ",i("dashboard:overview.to")," ",o?.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(J,{value:t,onValueChange:d=>r(d),children:[e.jsx(W,{className:"w-[120px]",children:e.jsx(Q,{placeholder:i("dashboard:overview.selectTimeRange")})}),e.jsx(Y,{children:Sd.map(d=>e.jsx(A,{value:d.value,children:i(d.label)},d.value))})]}),t==="custom"&&e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(B,{variant:"outline",className:y("min-w-0 justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Bt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a?.from?a.to?e.jsxs(e.Fragment,{children:[ms(a.from,"yyyy-MM-dd")," -"," ",ms(a.to,"yyyy-MM-dd")]}):ms(a.from,"yyyy-MM-dd"):i("dashboard:overview.selectDate")})]})}),e.jsx(vs,{className:"w-auto p-0",align:"end",children:e.jsx(lt,{mode:"range",defaultMonth:a?.from,selected:{from:a?.from,to:a?.to},onSelect:d=>{d?.from&&d?.to&&l({from:d.from,to:d.to})},numberOfMonths:2})})]})]}),e.jsx(wa,{value:s,onValueChange:d=>n(d),children:e.jsxs(Gt,{children:[e.jsx(Be,{value:"amount",children:i("dashboard:overview.amount")}),e.jsx(Be,{value:"count",children:i("dashboard:overview.count")})]})})]})]})}),e.jsxs(es,{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:i("dashboard:overview.totalIncome")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Rt(o?.summary?.paid_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:i("dashboard:overview.totalTransactions",{count:o?.summary?.paid_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[i("dashboard:overview.avgOrderAmount")," ¥",Rt(o?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:i("dashboard:overview.totalCommission")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Rt(o?.summary?.commission_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:i("dashboard:overview.totalTransactions",{count:o?.summary?.commission_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[i("dashboard:overview.commissionRate")," ",o?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]}),e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(fo,{width:"100%",height:"100%",children:e.jsxs(jo,{data:o?.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:As.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:As.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:As.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:As.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(vo,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>ms(new Date(d),"MM-dd",{locale:_o})}),e.jsx(bo,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>s==="amount"?`¥${Rt(d)}`:i("dashboard:overview.transactions",{count:d})}),e.jsx(yo,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(No,{content:e.jsx(Cd,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(Dn,{type:"monotone",dataKey:"paid_total",name:i("dashboard:overview.orderAmount"),stroke:As.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(Dn,{type:"monotone",dataKey:"commission_total",name:i("dashboard:overview.commissionAmount"),stroke:As.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(En,{dataKey:"paid_count",name:i("dashboard:overview.orderCount"),fill:As.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(En,{dataKey:"commission_count",name:i("dashboard:overview.commissionCount"),fill:As.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})]})]})}function oe({className:s,...n}){return e.jsx("div",{className:y("animate-pulse rounded-md bg-primary/10",s),...n})}function Dd(){return e.jsxs(We,{children:[e.jsxs(Ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(oe,{className:"h-4 w-[120px]"}),e.jsx(oe,{className:"h-4 w-4"})]}),e.jsxs(es,{children:[e.jsx(oe,{className:"h-8 w-[140px] mb-2"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsx(oe,{className:"h-4 w-[100px]"})]})]})]})}function Ed(){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:Array.from({length:8}).map((s,n)=>e.jsx(Dd,{},n))})}var ae=(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))(ae||{});const Et={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},Pt={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var xs=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(xs||{}),je=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(je||{});const Zt={0:"待确认",1:"发放中",2:"有效",3:"无效"},ea={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var Ie=(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))(Ie||{});const Pd={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var le=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s.Tuic="tuic",s.Socks="socks",s.Naive="naive",s.Http="http",s.Mieru="mieru",s.AnyTLS="anytls",s))(le||{});const rs=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"},{type:"tuic",label:"TUIC"},{type:"socks",label:"SOCKS"},{type:"naive",label:"Naive"},{type:"http",label:"HTTP"},{type:"mieru",label:"Mieru"},{type:"anytls",label:"AnyTLS"}],Ke={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a",tuic:"#00C853",socks:"#2196F3",naive:"#9C27B0",http:"#FF5722",mieru:"#4CAF50",anytls:"#7E57C2"};var Qe=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(Qe||{});const Rd={1:"按金额优惠",2:"按比例优惠"};var Hs=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(Hs||{}),Ae=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(Ae||{}),Ot=(s=>(s.MONTH="monthly",s.QUARTER="quarterly",s.HALF_YEAR="half_yearly",s.YEAR="yearly",s.TWO_YEAR="two_yearly",s.THREE_YEAR="three_yearly",s.ONETIME="onetime",s.RESET="reset_traffic",s))(Ot||{});function $s({title:s,value:n,icon:t,trend:r,description:a,onClick:l,highlight:i,className:c}){return e.jsxs(We,{className:y("transition-colors",l&&"cursor-pointer hover:bg-muted/50",i&&"border-primary/50",c),onClick:l,children:[e.jsxs(Ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ws,{className:"text-sm font-medium",children:s}),t]}),e.jsxs(es,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n}),r?e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(Do,{className:y("h-4 w-4",r.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:y("ml-1 text-xs",r.isPositive?"text-emerald-500":"text-red-500"),children:[r.isPositive?"+":"-",Math.abs(r.value),"%"]}),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:r.label})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:a})]})]})}function Id({className:s}){const n=Vs(),{t}=V(),{data:r,isLoading:a}=ne({queryKey:["dashboardStats"],queryFn:async()=>(await xa.getStatsData()).data,refetchInterval:1e3*60*5});if(a||!r)return e.jsx(Ed,{});const l=()=>{const i=new URLSearchParams;i.set("commission_status",je.PENDING.toString()),i.set("status",ae.COMPLETED.toString()),i.set("commission_balance","gt:0"),n(`/finance/order?${i.toString()}`)};return e.jsxs("div",{className:y("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx($s,{title:t("dashboard:stats.todayIncome"),value:Ws(r.todayIncome),icon:e.jsx(wo,{className:"h-4 w-4 text-emerald-500"}),trend:{value:r.dayIncomeGrowth,label:t("dashboard:stats.vsYesterday"),isPositive:r.dayIncomeGrowth>0}}),e.jsx($s,{title:t("dashboard:stats.monthlyIncome"),value:Ws(r.currentMonthIncome),icon:e.jsx(Co,{className:"h-4 w-4 text-blue-500"}),trend:{value:r.monthIncomeGrowth,label:t("dashboard:stats.vsLastMonth"),isPositive:r.monthIncomeGrowth>0}}),e.jsx($s,{title:t("dashboard:stats.pendingTickets"),value:r.ticketPendingTotal,icon:e.jsx(So,{className:y("h-4 w-4",r.ticketPendingTotal>0?"text-orange-500":"text-muted-foreground")}),description:r.ticketPendingTotal>0?t("dashboard:stats.hasPendingTickets"):t("dashboard:stats.noPendingTickets"),onClick:()=>n("/user/ticket"),highlight:r.ticketPendingTotal>0}),e.jsx($s,{title:t("dashboard:stats.pendingCommission"),value:r.commissionPendingTotal,icon:e.jsx(ko,{className:y("h-4 w-4",r.commissionPendingTotal>0?"text-blue-500":"text-muted-foreground")}),description:r.commissionPendingTotal>0?t("dashboard:stats.hasPendingCommission"):t("dashboard:stats.noPendingCommission"),onClick:l,highlight:r.commissionPendingTotal>0}),e.jsx($s,{title:t("dashboard:stats.monthlyNewUsers"),value:r.currentMonthNewUsers,icon:e.jsx(Ja,{className:"h-4 w-4 text-blue-500"}),trend:{value:r.userGrowth,label:t("dashboard:stats.vsLastMonth"),isPositive:r.userGrowth>0}}),e.jsx($s,{title:t("dashboard:stats.totalUsers"),value:r.totalUsers,icon:e.jsx(Ja,{className:"h-4 w-4 text-muted-foreground"}),description:t("dashboard:stats.activeUsers",{count:r.activeUsers})}),e.jsx($s,{title:t("dashboard:stats.monthlyUpload"),value:_s(r.monthTraffic.upload),icon:e.jsx(zt,{className:"h-4 w-4 text-emerald-500"}),description:t("dashboard:stats.todayTraffic",{value:_s(r.todayTraffic.upload)})}),e.jsx($s,{title:t("dashboard:stats.monthlyDownload"),value:_s(r.monthTraffic.download),icon:e.jsx(To,{className:"h-4 w-4 text-blue-500"}),description:t("dashboard:stats.todayTraffic",{value:_s(r.todayTraffic.download)})})]})}const Nt=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(Pr,{ref:r,className:y("relative overflow-hidden",s),...t,children:[e.jsx(Eo,{className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(pa,{}),e.jsx(Po,{})]}));Nt.displayName=Pr.displayName;const pa=m.forwardRef(({className:s,orientation:n="vertical",...t},r)=>e.jsx(Rr,{ref:r,orientation:n,className:y("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s),...t,children:e.jsx(Ro,{className:"relative flex-1 rounded-full bg-border"})}));pa.displayName=Rr.displayName;const nn={today:{getValue:()=>{const s=Lo();return{start:s,end:Vo(s,1)}}},last7days:{getValue:()=>{const s=new Date;return{start:us(s,7),end:s}}},last30days:{getValue:()=>{const s=new Date;return{start:us(s,30),end:s}}},custom:{getValue:()=>null}};function An({selectedRange:s,customDateRange:n,onRangeChange:t,onCustomRangeChange:r}){const{t:a}=V(),l={today:a("dashboard:trafficRank.today"),last7days:a("dashboard:trafficRank.last7days"),last30days:a("dashboard:trafficRank.last30days"),custom:a("dashboard:trafficRank.customRange")};return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.jsxs(J,{value:s,onValueChange:t,children:[e.jsx(W,{className:"w-[120px]",children:e.jsx(Q,{placeholder:a("dashboard:trafficRank.selectTimeRange")})}),e.jsx(Y,{position:"popper",className:"z-50",children:Object.entries(nn).map(([i])=>e.jsx(A,{value:i,children:l[i]},i))})]}),s==="custom"&&e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(B,{variant:"outline",className:y("min-w-0 justify-start text-left font-normal",!n&&"text-muted-foreground"),children:[e.jsx(Bt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:n?.from?n.to?e.jsxs(e.Fragment,{children:[ms(n.from,"yyyy-MM-dd")," -"," ",ms(n.to,"yyyy-MM-dd")]}):ms(n.from,"yyyy-MM-dd"):e.jsx("span",{children:a("dashboard:trafficRank.selectDateRange")})})]})}),e.jsx(vs,{className:"w-auto p-0",align:"end",children:e.jsx(lt,{mode:"range",defaultMonth:n?.from,selected:{from:n?.from,to:n?.to},onSelect:i=>{i?.from&&i?.to&&r({from:i.from,to:i.to})},numberOfMonths:2})})]})]})}const ht=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Ld({className:s}){const{t:n}=V(),[t,r]=m.useState("today"),[a,l]=m.useState({from:us(new Date,7),to:new Date}),[i,c]=m.useState("today"),[u,o]=m.useState({from:us(new Date,7),to:new Date}),d=m.useMemo(()=>t==="custom"?{start:a.from,end:a.to}:nn[t].getValue(),[t,a]),h=m.useMemo(()=>i==="custom"?{start:u.from,end:u.to}:nn[i].getValue(),[i,u]),{data:w}=ne({queryKey:["nodeTrafficRank",d.start,d.end],queryFn:()=>xa.getNodeTrafficData({type:"node",start_time:Se.round(d.start.getTime()/1e3),end_time:Se.round(d.end.getTime()/1e3)}),refetchInterval:3e4}),{data:P}=ne({queryKey:["userTrafficRank",h.start,h.end],queryFn:()=>xa.getNodeTrafficData({type:"user",start_time:Se.round(h.start.getTime()/1e3),end_time:Se.round(h.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:y("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(We,{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(ws,{className:"flex items-center text-base font-medium",children:[e.jsx(Io,{className:"mr-2 h-4 w-4"}),n("dashboard:trafficRank.nodeTrafficRank")]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(An,{selectedRange:t,customDateRange:a,onRangeChange:r,onCustomRangeChange:l}),e.jsx(Pn,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(es,{className:"flex-1",children:w?.data?e.jsxs(Nt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:w.data.map(k=>e.jsx(be,{delayDuration:200,children:e.jsxs(xe,{children:[e.jsx(he,{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:k.name}),e.jsxs("span",{className:y("ml-2 flex items-center text-xs font-medium",k.change>=0?"text-green-600":"text-red-600"),children:[k.change>=0?e.jsx(Qa,{className:"mr-1 h-3 w-3"}):e.jsx(Xa,{className:"mr-1 h-3 w-3"}),Math.abs(k.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:`${k.value/w.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ht(k.value)})]})]})})}),e.jsx(ce,{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.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.currentTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:ht(k.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:ht(k.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:y("font-medium",k.change>=0?"text-green-600":"text-red-600"),children:[k.change>=0?"+":"",k.change,"%"]})]})})]})},k.id))}),e.jsx(pa,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:n("common:loading")})})})]}),e.jsxs(We,{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(ws,{className:"flex items-center text-base font-medium",children:[e.jsx(Ja,{className:"mr-2 h-4 w-4"}),n("dashboard:trafficRank.userTrafficRank")]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(An,{selectedRange:i,customDateRange:u,onRangeChange:c,onCustomRangeChange:o}),e.jsx(Pn,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(es,{className:"flex-1",children:P?.data?e.jsxs(Nt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:P.data.map(k=>e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{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:k.name}),e.jsxs("span",{className:y("ml-2 flex items-center text-xs font-medium",k.change>=0?"text-green-600":"text-red-600"),children:[k.change>=0?e.jsx(Qa,{className:"mr-1 h-3 w-3"}):e.jsx(Xa,{className:"mr-1 h-3 w-3"}),Math.abs(k.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:`${k.value/P.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ht(k.value)})]})]})})}),e.jsx(ce,{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.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.currentTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:ht(k.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:ht(k.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:y("font-medium",k.change>=0?"text-green-600":"text-red-600"),children:[k.change>=0?"+":"",k.change,"%"]})]})})]})},k.id))}),e.jsx(pa,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:n("common:loading")})})})]})]})}const Vd=Zs("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 G({className:s,variant:n,...t}){return e.jsx("div",{className:y(Vd({variant:n}),s),...t})}const ra=m.forwardRef(({className:s,value:n,...t},r)=>e.jsx(Ir,{ref:r,className:y("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...t,children:e.jsx(Fo,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));ra.displayName=Ir.displayName;const qt=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:t,className:y("w-full caption-bottom text-sm",s),...n})}));qt.displayName="Table";const Ht=m.forwardRef(({className:s,...n},t)=>e.jsx("thead",{ref:t,className:y("[&_tr]:border-b",s),...n}));Ht.displayName="TableHeader";const Ut=m.forwardRef(({className:s,...n},t)=>e.jsx("tbody",{ref:t,className:y("[&_tr:last-child]:border-0",s),...n}));Ut.displayName="TableBody";const Fd=m.forwardRef(({className:s,...n},t)=>e.jsx("tfoot",{ref:t,className:y("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...n}));Fd.displayName="TableFooter";const Ge=m.forwardRef(({className:s,...n},t)=>e.jsx("tr",{ref:t,className:y("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...n}));Ge.displayName="TableRow";const Je=m.forwardRef(({className:s,...n},t)=>e.jsx("th",{ref:t,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),...n}));Je.displayName="TableHead";const Ee=m.forwardRef(({className:s,...n},t)=>e.jsx("td",{ref:t,className:y("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...n}));Ee.displayName="TableCell";const Od=m.forwardRef(({className:s,...n},t)=>e.jsx("caption",{ref:t,className:y("mt-4 text-sm text-muted-foreground",s),...n}));Od.displayName="TableCaption";function Md(){const{t:s}=V(),[n,t]=m.useState(0),[r,a]=m.useState(!1),[l,i]=m.useState(1),[c]=m.useState(10),[u,o]=m.useState(null),[d,h]=m.useState(!1),[w,P]=m.useState(!1),[k,C]=m.useState(1),[N]=m.useState(10),[p,S]=m.useState(null),[R,g]=m.useState(!1),[_,I]=m.useState(""),{data:U,isLoading:M,refetch:X,isRefetching:ie}=ne({queryKey:["systemStatus",n],queryFn:async()=>(await me.getSystemStatus()).data,refetchInterval:3e4}),{data:H,isLoading:te,refetch:q,isRefetching:L}=ne({queryKey:["queueStats",n],queryFn:async()=>(await me.getQueueStats()).data,refetchInterval:3e4}),{data:ee,isLoading:cs,refetch:Te}=ne({queryKey:["failedJobs",l,c],queryFn:async()=>{const K=await me.getHorizonFailedJobs({current:l,page_size:c});return{data:K.data,total:K.total||0}},enabled:r}),{data:re,isLoading:Es,refetch:Ms}=ne({queryKey:["systemLogs",k,N],queryFn:async()=>{const K=await me.getSystemLog({current:k,page_size:N});return{data:K.data,total:K.total||0}},enabled:w}),Wt=ee?.data||[],it=ee?.total||0,Yt=re?.data||[],ot=re?.total||0,Va=()=>{t(K=>K+1)},Jt=K=>{C(K)},se=K=>{i(K)},de=K=>{S(K),g(!0)},Re=K=>{o(K),h(!0)},zs=_?Yt.filter(K=>(K.title||K.message||"").toLowerCase().includes(_.toLowerCase())||K.level.toLowerCase().includes(_.toLowerCase())):Yt,Sn=K=>{switch(K.toLowerCase()){case"info":return e.jsx(Ma,{className:"h-4 w-4 text-blue-500"});case"warning":return e.jsx(Rn,{className:"h-4 w-4 text-yellow-500"});case"error":return e.jsx(In,{className:"h-4 w-4 text-red-500"});default:return e.jsx(Ma,{className:"h-4 w-4 text-slate-500"})}};if(M||te)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(Lt,{className:"h-6 w-6 animate-spin"})});const Wl=K=>K?e.jsx(Lr,{className:"h-5 w-5 text-green-500"}):e.jsx(Vr,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(We,{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(ws,{className:"flex items-center gap-2",children:[e.jsx(Oo,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Xs,{children:s("dashboard:queue.status.description")})]}),e.jsx(B,{variant:"outline",size:"icon",onClick:Va,disabled:ie||L,children:e.jsx(Fa,{className:y("h-4 w-4",(ie||L)&&"animate-spin")})})]}),e.jsx(es,{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:[Wl(H?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(G,{variant:H?.status?"secondary":"destructive",children:H?.status?s("dashboard:queue.status.normal"):s("dashboard:queue.status.abnormal")})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.status.waitTime",{seconds:H?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.recentJobs")}),e.jsx("p",{className:"text-2xl font-bold",children:H?.recentJobs||0}),e.jsx(ra,{value:(H?.recentJobs||0)/(H?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:H?.periods?.recentJobs||0})})})]})}),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.jobsPerMinute")}),e.jsx("p",{className:"text-2xl font-bold",children:H?.jobsPerMinute||0}),e.jsx(ra,{value:(H?.jobsPerMinute||0)/(H?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:H?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(We,{children:[e.jsxs(Ze,{children:[e.jsxs(ws,{className:"flex items-center gap-2",children:[e.jsx(Mo,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Xs,{children:s("dashboard:queue.details.description")})]}),e.jsx(es,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.failedJobs7Days")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"cursor-pointer text-2xl font-bold text-destructive hover:underline",title:s("dashboard:queue.details.viewFailedJobs"),onClick:()=>a(!0),style:{userSelect:"none"},children:H?.failedJobs||0}),e.jsx(Oa,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-destructive",onClick:()=>a(!0),"aria-label":s("dashboard:queue.details.viewFailedJobs")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("dashboard:queue.details.retentionPeriod",{hours:H?.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:s("dashboard:queue.details.longestRunningQueue")}),e.jsxs("p",{className:"text-2xl font-bold",children:[H?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:H?.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:s("dashboard:queue.details.activeProcesses")}),e.jsxs("span",{className:"font-medium",children:[H?.processes||0," /"," ",(H?.processes||0)+(H?.pausedMasters||0)]})]}),e.jsx(ra,{value:(H?.processes||0)/((H?.processes||0)+(H?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]}),e.jsxs(We,{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(ws,{className:"flex items-center gap-2",children:[e.jsx(zo,{className:"h-5 w-5"}),s("dashboard:systemLog.title","系统日志")]}),e.jsx(Xs,{children:s("dashboard:systemLog.description","查看系统运行日志记录")})]}),e.jsx(B,{variant:"outline",onClick:()=>P(!0),children:s("dashboard:systemLog.viewAll","查看全部")})]}),e.jsx(es,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-900 dark:bg-blue-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ma,{className:"h-5 w-5 text-blue-500"}),e.jsx("p",{className:"font-medium text-blue-700 dark:text-blue-300",children:"信息"})]}),e.jsx("p",{className:"text-2xl font-bold text-blue-700 dark:text-blue-300",children:U?.logs?.info||0})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-900 dark:bg-yellow-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Rn,{className:"h-5 w-5 text-yellow-500"}),e.jsx("p",{className:"font-medium text-yellow-700 dark:text-yellow-300",children:"警告"})]}),e.jsx("p",{className:"text-2xl font-bold text-yellow-700 dark:text-yellow-300",children:U?.logs?.warning||0})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-900 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(In,{className:"h-5 w-5 text-red-500"}),e.jsx("p",{className:"font-medium text-red-700 dark:text-red-300",children:"错误"})]}),e.jsx("p",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:U?.logs?.error||0})]})]}),U?.logs&&U.logs.total>0&&e.jsx("div",{className:"mt-3 text-center text-sm text-muted-foreground",children:s("dashboard:systemLog.totalLogs","总日志数:{{count}}",{count:U.logs.total})})]})})]}),e.jsx(pe,{open:r,onOpenChange:a,children:e.jsxs(ue,{className:"max-w-4xl",children:[e.jsx(ve,{children:e.jsx(ge,{children:s("dashboard:queue.details.failedJobsDetailTitle","失败任务详情")})}),e.jsx("div",{className:"overflow-x-auto",children:cs?e.jsx("div",{className:"flex justify-center p-4",children:e.jsx(Lt,{className:"h-6 w-6 animate-spin"})}):e.jsxs(e.Fragment,{children:[e.jsxs(qt,{children:[e.jsx(Ht,{children:e.jsxs(Ge,{children:[e.jsx(Je,{children:s("dashboard:queue.details.time","时间")}),e.jsx(Je,{children:s("dashboard:queue.details.queue","队列")}),e.jsx(Je,{children:s("dashboard:queue.details.name","任务名称")}),e.jsx(Je,{children:s("dashboard:queue.details.exception","异常信息")}),e.jsx(Je,{className:"w-[80px]",children:s("dashboard:queue.details.action","操作")})]})}),e.jsx(Ut,{children:Wt.length===0?e.jsx(Ge,{children:e.jsx(Ee,{colSpan:5,className:"text-center text-muted-foreground",children:s("dashboard:queue.details.noFailedJobs","暂无失败任务")})}):Wt.map(K=>e.jsxs(Ge,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>Re(K),children:[e.jsx(Ee,{children:K.failed_at}),e.jsx(Ee,{children:K.queue}),e.jsx(Ee,{children:e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("span",{className:"inline-block max-w-[150px] truncate",children:K.name})}),e.jsx(ce,{children:e.jsx("span",{children:K.name})})]})})}),e.jsx(Ee,{children:e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("span",{className:"inline-block max-w-[200px] truncate",children:K.exception.split(` -`)[0]})}),e.jsx(ce,{className:"max-w-[300px] whitespace-pre-wrap",children:e.jsx("span",{children:K.exception})})]})})}),e.jsx(Ee,{children:e.jsx(B,{variant:"ghost",size:"sm",onClick:St=>{St.stopPropagation(),Re(K)},"aria-label":s("dashboard:queue.details.viewDetail","查看详情"),children:e.jsx(Oa,{className:"h-4 w-4"})})})]},K.id))})]}),it>c&&e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:common.pagination","第 {{current}}/{{total}} 页,共 {{count}} 条",{current:l,total:Math.ceil(it/c),count:it})}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(B,{variant:"outline",size:"sm",onClick:()=>se(l-1),disabled:l<=1,children:e.jsx(Za,{className:"h-4 w-4"})}),e.jsx(B,{variant:"outline",size:"sm",onClick:()=>se(l+1),disabled:l>=Math.ceil(it/c),children:e.jsx(en,{className:"h-4 w-4"})})]})]})]})}),e.jsxs(Pe,{children:[e.jsxs(B,{variant:"outline",onClick:()=>Te(),children:[e.jsx(Fa,{className:"mr-2 h-4 w-4"}),s("dashboard:common.refresh","刷新")]}),e.jsx(qs,{asChild:!0,children:e.jsx(B,{variant:"outline",children:s("common.close","关闭")})})]})]})}),e.jsx(pe,{open:d,onOpenChange:h,children:e.jsxs(ue,{className:"max-w-4xl",children:[e.jsx(ve,{children:e.jsx(ge,{children:s("dashboard:queue.details.jobDetailTitle","任务详情")})}),u&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.id","任务ID")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:u.id})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.time","时间")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:u.failed_at})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.queue","队列")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:u.queue})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.connection","连接")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:u.connection})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.name","任务名称")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:u.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.exception","异常信息")}),e.jsx("div",{className:"max-h-[200px] overflow-y-auto rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-700 dark:text-red-300",children:u.exception})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.payload","任务数据")}),e.jsx("div",{className:"max-h-[200px] overflow-y-auto rounded-md bg-muted/50 p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs",children:(()=>{try{return JSON.stringify(JSON.parse(u.payload),null,2)}catch{return u.payload}})()})})]})]}),e.jsx(Pe,{className:"mt-2",children:e.jsx(B,{variant:"outline",onClick:()=>h(!1),children:s("common.close","关闭")})})]})}),e.jsx(pe,{open:w,onOpenChange:P,children:e.jsxs(ue,{className:"max-w-4xl",children:[e.jsx(ve,{children:e.jsx(ge,{children:s("dashboard:systemLog.title","系统日志")})}),e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx(un,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(T,{placeholder:s("dashboard:systemLog.search","搜索日志内容..."),value:_,onChange:K=>I(K.target.value),className:"flex-1"})]}),e.jsx("div",{className:"overflow-x-auto",children:Es?e.jsx("div",{className:"flex justify-center p-4",children:e.jsx(Lt,{className:"h-6 w-6 animate-spin"})}):e.jsxs(e.Fragment,{children:[e.jsxs(qt,{children:[e.jsx(Ht,{children:e.jsxs(Ge,{children:[e.jsx(Je,{className:"w-[80px]",children:s("dashboard:systemLog.level","级别")}),e.jsx(Je,{className:"w-[160px]",children:s("dashboard:systemLog.time","时间")}),e.jsx(Je,{children:s("dashboard:systemLog.title","标题")}),e.jsx(Je,{className:"w-[100px]",children:s("dashboard:systemLog.method","请求方法")}),e.jsx(Je,{className:"w-[80px]",children:s("dashboard:systemLog.action","操作")})]})}),e.jsx(Ut,{children:zs.length===0?e.jsx(Ge,{children:e.jsx(Ee,{colSpan:5,className:"text-center text-muted-foreground",children:_?s("dashboard:systemLog.noSearchResults","没有匹配的日志记录"):s("dashboard:systemLog.noLogs","暂无日志记录")})}):zs.map(K=>e.jsxs(Ge,{children:[e.jsx(Ee,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[Sn(K.level),e.jsx("span",{className:y(K.level.toLowerCase()==="error"&&"text-red-600",K.level.toLowerCase()==="warning"&&"text-yellow-600",K.level.toLowerCase()==="info"&&"text-blue-600"),children:K.level})]})}),e.jsx(Ee,{children:K.created_at?new Date(K.created_at*1e3).toLocaleString():""}),e.jsx(Ee,{children:e.jsx("span",{className:"inline-block max-w-[300px] truncate",children:K.title||K.message||""})}),e.jsx(Ee,{children:K.method&&e.jsx(G,{variant:"outline",className:y(K.method==="GET"&&"border-blue-200 bg-blue-50 text-blue-700",K.method==="POST"&&"border-green-200 bg-green-50 text-green-700",K.method==="PUT"&&"border-amber-200 bg-amber-50 text-amber-700",K.method==="DELETE"&&"border-red-200 bg-red-50 text-red-700"),children:K.method})}),e.jsx(Ee,{children:e.jsx(B,{variant:"ghost",size:"sm",onClick:()=>de(K),"aria-label":s("dashboard:systemLog.viewDetail","查看详情"),children:e.jsx(Oa,{className:"h-4 w-4"})})})]},K.id))})]}),ot>N&&!_&&e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:common.pagination","第 {{current}}/{{total}} 页,共 {{count}} 条",{current:k,total:Math.ceil(ot/N),count:ot})}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(B,{variant:"outline",size:"sm",onClick:()=>Jt(k-1),disabled:k<=1,children:e.jsx(Za,{className:"h-4 w-4"})}),e.jsx(B,{variant:"outline",size:"sm",onClick:()=>Jt(k+1),disabled:k>=Math.ceil(ot/N),children:e.jsx(en,{className:"h-4 w-4"})})]})]})]})}),e.jsxs(Pe,{children:[e.jsxs(B,{variant:"outline",onClick:()=>Ms(),children:[e.jsx(Fa,{className:"mr-2 h-4 w-4"}),s("dashboard:common.refresh","刷新")]}),e.jsx(qs,{asChild:!0,children:e.jsx(B,{variant:"outline",children:s("common.close","关闭")})})]})]})}),e.jsx(pe,{open:R,onOpenChange:g,children:e.jsxs(ue,{className:"max-w-4xl",children:[e.jsx(ve,{children:e.jsx(ge,{children:s("dashboard:systemLog.detailTitle","日志详情")})}),p&&e.jsxs("div",{className:"max-h-[70vh] space-y-5 overflow-y-auto pr-1",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.level","级别")}),e.jsxs("div",{className:"flex items-center gap-1",children:[Sn(p.level),e.jsx("p",{className:y("font-medium",p.level.toLowerCase()==="error"&&"text-red-600",p.level.toLowerCase()==="warning"&&"text-yellow-600",p.level.toLowerCase()==="info"&&"text-blue-600"),children:p.level})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.time","时间")}),e.jsx("p",{children:p.created_at?new Date(p.created_at*1e3).toLocaleString():p.updated_at?new Date(p.updated_at*1e3).toLocaleString():""})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.title","标题")}),e.jsx("div",{className:"whitespace-pre-wrap rounded-md bg-muted/50 p-3",children:p.title||p.message||""})]}),p.host&&e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.host","主机")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:p.host})]}),p.ip&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.ip","IP地址")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:p.ip})]})]}),p.uri&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.uri","URI")}),e.jsx("div",{className:"overflow-x-auto rounded-md bg-muted/50 p-3",children:e.jsx("code",{className:"text-sm",children:p.uri})})]}),p.method&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.method","请求方法")}),e.jsx("div",{children:e.jsx(G,{variant:"outline",className:y("text-base font-medium",p.method==="GET"&&"border-blue-200 bg-blue-50 text-blue-700",p.method==="POST"&&"border-green-200 bg-green-50 text-green-700",p.method==="PUT"&&"border-amber-200 bg-amber-50 text-amber-700",p.method==="DELETE"&&"border-red-200 bg-red-50 text-red-700"),children:p.method})})]}),p.data&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.requestData","请求数据")}),e.jsx("div",{className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/50 p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs",children:(()=>{try{return JSON.stringify(JSON.parse(p.data),null,2)}catch{return p.data}})()})})]}),p.context&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.exception","异常信息")}),e.jsx("div",{className:"max-h-[250px] overflow-y-auto rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs text-red-700 dark:text-red-300",children:(()=>{try{const K=JSON.parse(p.context);if(K.exception){const St=K.exception,Yl=St["\0*\0message"]||"",Jl=St["\0*\0file"]||"",Ql=St["\0*\0line"]||"";return`${Yl} +import{r as m,j as e,t as di,c as mi,I as Vn,a as Zs,S as on,u as Is,b as ui,d as cn,R as tl,e as al,f as xi,F as hi,C as pi,L as nl,T as ll,g as rl,h as gi,i as fi,k as ji,l as A,z as x,m as V,n as ye,o as _e,p as ne,q as gs,s as Se,v as ot,w as vi,O as dn,x as bi,y as yi,A as Ni,B as _i,D as wi,E as Ci,Q as Si,G as ki,H as Ti,J as Di,P as Pi,K as Ei,M as Ri,N as Ii,U as Li,V as il,W as ol,X as ja,Y as va,Z as mn,_ as ds,$ as ba,a0 as ya,a1 as cl,a2 as dl,a3 as ml,a4 as un,a5 as ul,a6 as Vi,a7 as xl,a8 as hl,a9 as pl,aa as gl,ab as et,ac as fl,ad as Fi,ae as jl,af as vl,ag as Mi,ah as Oi,ai as zi,aj as $i,ak as Ai,al as qi,am as Hi,an as Ui,ao as Ki,ap as Bi,aq as Gi,ar as bl,as as Wi,at as Yi,au as st,av as yl,aw as Ji,ax as Qi,ay as Nl,az as xn,aA as Xi,aB as Zi,aC as Fn,aD as eo,aE as _l,aF as so,aG as wl,aH as to,aI as ao,aJ as no,aK as lo,aL as ro,aM as io,aN as Cl,aO as oo,aP as co,aQ as mo,aR as He,aS as uo,aT as hn,aU as xo,aV as ho,aW as Sl,aX as kl,aY as Tl,aZ as po,a_ as go,a$ as fo,b0 as Dl,b1 as jo,b2 as pn,b3 as Pl,b4 as vo,b5 as El,b6 as bo,b7 as Rl,b8 as yo,b9 as Il,ba as Ll,bb as No,bc as _o,bd as Vl,be as wo,bf as Co,bg as Fl,bh as So,bi as Ml,bj as ko,bk as To,bl as hs,bm as xs,bn as Kt,bo as Do,bp as Po,bq as Eo,br as Ro,bs as Io,bt as Lo,bu as Mn,bv as On,bw as Vo,bx as Fo,by as Mo,bz as Oo,bA as zo,bB as Qa,bC as At,bD as $o,bE as Ao,bF as Ol,bG as qo,bH as Ho,bI as zl,bJ as Uo,bK as Ko,bL as zn,bM as Xa,bN as Za,bO as Bo,bP as Go,bQ as $l,bR as Wo,bS as Yo,bT as Jo,bU as da,bV as en,bW as Je,bX as gn,bY as Qo,bZ as za,b_ as Xo,b$ as $n,c0 as Ft,c1 as sn,c2 as tn,c3 as Al,c4 as Qe,c5 as ls,c6 as ql,c7 as Hl,c8 as Zo,c9 as ec,ca as sc,cb as tc,cc as ac,cd as Ul,ce as nc,cf as lc,cg as ze,ch as An,ci as rc,cj as Kl,ck as Bl,cl as Gl,cm as Wl,cn as Yl,co as Jl,cp as ic,cq as oc,cr as cc,cs as Na,ct as tt,cu as fs,cv as js,cw as vs,cx as dc,cy as mc,cz as uc,cA as xc,cB as hc,cC as pc,cD as gc,cE as fc,cF as jc,cG as an,cH as fn,cI as jn,cJ as vc,cK as Ls,cL as Vs,cM as _a,cN as bc,cO as ma,cP as yc,cQ as qn,cR as Ql,cS as Hn,cT as ua,cU as Nc,cV as _c,cW as wc,cX as Cc,cY as Xl,cZ as Sc,c_ as kc,c$ as Zl,d0 as nn,d1 as er,d2 as Tc,d3 as sr,d4 as tr,d5 as Dc,d6 as Pc,d7 as Ec,d8 as Rc,d9 as Ic}from"./vendor.js";import"./index.js";var $h=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ah(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Lc(s){if(s.__esModule)return s;var a=s.default;if(typeof a=="function"){var t=function l(){return this instanceof l?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};t.prototype=a.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(l){var n=Object.getOwnPropertyDescriptor(s,l);Object.defineProperty(t,l,n.get?n:{enumerable:!0,get:function(){return s[l]}})}),t}const Vc={theme:"system",setTheme:()=>null},ar=m.createContext(Vc);function Fc({children:s,defaultTheme:a="system",storageKey:t="vite-ui-theme",...l}){const[n,o]=m.useState(()=>localStorage.getItem(t)||a);m.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),n==="system"){const u=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(u);return}c.classList.add(n)},[n]);const r={theme:n,setTheme:c=>{localStorage.setItem(t,c),o(c)}};return e.jsx(ar.Provider,{...l,value:r,children:s})}const Mc=()=>{const s=m.useContext(ar);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Oc=function(){const a=typeof document<"u"&&document.createElement("link").relList;return a&&a.supports&&a.supports("modulepreload")?"modulepreload":"preload"}(),zc=function(s,a){return new URL(s,a).href},Un={},fe=function(a,t,l){let n=Promise.resolve();if(t&&t.length>0){const r=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),u=c?.nonce||c?.getAttribute("nonce");n=Promise.allSettled(t.map(i=>{if(i=zc(i,l),i in Un)return;Un[i]=!0;const d=i.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(!!l)for(let S=r.length-1;S>=0;S--){const C=r[S];if(C.href===i&&(!d||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${h}`))return;const k=document.createElement("link");if(k.rel=d?"stylesheet":Oc,d||(k.as="script"),k.crossOrigin="",k.href=i,u&&k.setAttribute("nonce",u),document.head.appendChild(k),d)return new Promise((S,C)=>{k.addEventListener("load",S),k.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${i}`)))})}))}function o(r){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=r,window.dispatchEvent(c),!c.defaultPrevented)throw r}return n.then(r=>{for(const c of r||[])c.status==="rejected"&&o(c.reason);return a().catch(o)})};function y(...s){return di(mi(s))}const wt=Zs("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"}}),E=m.forwardRef(({className:s,variant:a,size:t,asChild:l=!1,children:n,disabled:o,loading:r=!1,leftSection:c,rightSection:u,...i},d)=>{const h=l?on:"button";return e.jsxs(h,{className:y(wt({variant:a,size:t,className:s})),disabled:r||o,ref:d,...i,children:[(c&&r||!c&&!u&&r)&&e.jsx(Vn,{className:"mr-2 h-4 w-4 animate-spin"}),!r&&c&&e.jsx("div",{className:"mr-2",children:c}),n,!r&&u&&e.jsx("div",{className:"ml-2",children:u}),u&&r&&e.jsx(Vn,{className:"ml-2 h-4 w-4 animate-spin"})]})});E.displayName="Button";function ct({className:s,minimal:a=!1}){const t=Is(),l=ui(),n=l?.message||l?.statusText||"Unknown error occurred";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:[!a&&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",{}),n]}),!a&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(E,{variant:"outline",onClick:()=>t(-1),children:"Go Back"}),e.jsx(E,{onClick:()=>t("/"),children:"Back to Home"})]})]})})}function Kn(){const s=Is();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(E,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(E,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function $c(){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(E,{variant:"outline",children:"Learn more"})})]})})}function Ac(s){return typeof s>"u"}function qc(s){return s===null}function Hc(s){return qc(s)||Ac(s)}class Uc{storage;prefixKey;constructor(a){this.storage=a.storage,this.prefixKey=a.prefixKey}getKey(a){return`${this.prefixKey}${a}`.toUpperCase()}set(a,t,l=null){const n=JSON.stringify({value:t,time:Date.now(),expire:l!==null?new Date().getTime()+l*1e3:null});this.storage.setItem(this.getKey(a),n)}get(a,t=null){const l=this.storage.getItem(this.getKey(a));if(!l)return{value:t,time:0};try{const n=JSON.parse(l),{value:o,time:r,expire:c}=n;return Hc(c)||c>new Date().getTime()?{value:o,time:r}:(this.remove(a),{value:t,time:0})}catch{return this.remove(a),{value:t,time:0}}}remove(a){this.storage.removeItem(this.getKey(a))}clear(){this.storage.clear()}}function nr({prefixKey:s="",storage:a=sessionStorage}){return new Uc({prefixKey:s,storage:a})}const lr="Xboard_",Kc=function(s={}){return nr({prefixKey:s.prefixKey||"",storage:localStorage})},Bc=function(s={}){return nr({prefixKey:s.prefixKey||"",storage:sessionStorage})},wa=Kc({prefixKey:lr});Bc({prefixKey:lr});const rr="access_token";function qt(){return wa.get(rr)}function ir(){wa.remove(rr)}const Bn=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Gc({children:s}){const a=Is(),t=cn(),l=qt();return m.useEffect(()=>{if(!l.value&&!Bn.includes(t.pathname)){const n=encodeURIComponent(t.pathname+t.search);a(`/sign-in?redirect=${n}`)}},[l.value,t.pathname,t.search,a]),Bn.includes(t.pathname)||l.value?e.jsx(e.Fragment,{children:s}):null}const ke=m.forwardRef(({className:s,orientation:a="horizontal",decorative:t=!0,...l},n)=>e.jsx(tl,{ref:n,decorative:t,orientation:a,className:y("shrink-0 bg-border",a==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...l}));ke.displayName=tl.displayName;const Wc=Zs("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xa=m.forwardRef(({className:s,...a},t)=>e.jsx(al,{ref:t,className:y(Wc(),s),...a}));xa.displayName=al.displayName;const we=hi,or=m.createContext({}),v=({...s})=>e.jsx(or.Provider,{value:{name:s.name},children:e.jsx(pi,{...s})}),Ca=()=>{const s=m.useContext(or),a=m.useContext(cr),{getFieldState:t,formState:l}=xi(),n=t(s.name,l);if(!s)throw new Error("useFormField should be used within ");const{id:o}=a;return{id:o,name:s.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...n}},cr=m.createContext({}),f=m.forwardRef(({className:s,...a},t)=>{const l=m.useId();return e.jsx(cr.Provider,{value:{id:l},children:e.jsx("div",{ref:t,className:y("space-y-2",s),...a})})});f.displayName="FormItem";const j=m.forwardRef(({className:s,...a},t)=>{const{error:l,formItemId:n}=Ca();return e.jsx(xa,{ref:t,className:y(l&&"text-destructive",s),htmlFor:n,...a})});j.displayName="FormLabel";const b=m.forwardRef(({...s},a)=>{const{error:t,formItemId:l,formDescriptionId:n,formMessageId:o}=Ca();return e.jsx(on,{ref:a,id:l,"aria-describedby":t?`${n} ${o}`:`${n}`,"aria-invalid":!!t,...s})});b.displayName="FormControl";const F=m.forwardRef(({className:s,...a},t)=>{const{formDescriptionId:l}=Ca();return e.jsx("p",{ref:t,id:l,className:y("text-[0.8rem] text-muted-foreground",s),...a})});F.displayName="FormDescription";const P=m.forwardRef(({className:s,children:a,...t},l)=>{const{error:n,formMessageId:o}=Ca(),r=n?String(n?.message):a;return r?e.jsx("p",{ref:l,id:o,className:y("text-[0.8rem] font-medium text-destructive",s),...t,children:r}):null});P.displayName="FormMessage";const Bt=gi,Ct=m.forwardRef(({className:s,...a},t)=>e.jsx(nl,{ref:t,className:y("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...a}));Ct.displayName=nl.displayName;const Ee=m.forwardRef(({className:s,...a},t)=>e.jsx(ll,{ref:t,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),...a}));Ee.displayName=ll.displayName;const We=m.forwardRef(({className:s,...a},t)=>e.jsx(rl,{ref:t,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),...a}));We.displayName=rl.displayName;function Ce(s=void 0,a="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),fi(s).format(a))}function Yc(s=void 0,a="YYYY-MM-DD"){return Ce(s,a)}function pt(s){const a=typeof s=="string"?parseFloat(s):s;return isNaN(a)?"0.00":a.toFixed(2)}function Ws(s,a=!0){if(s==null)return a?"¥0.00":"0.00";const t=typeof s=="string"?parseFloat(s):s;if(isNaN(t))return a?"¥0.00":"0.00";const n=(t/100).toFixed(2).replace(/\.?0+$/,o=>o.includes(".")?".00":o);return a?`¥${n}`:n}function ha(s){return new Promise(a=>{(async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(s);else{const l=document.createElement("textarea");l.value=s,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.select();const n=document.execCommand("copy");if(document.body.removeChild(l),!n)throw new Error("execCommand failed")}a(!0)}catch(l){console.error(l),a(!1)}})()})}function Oe(s){const a=s/1024,t=a/1024,l=t/1024,n=l/1024;return n>=1?pt(n)+" TB":l>=1?pt(l)+" GB":t>=1?pt(t)+" MB":pt(a)+" KB"}const Jc="locale";function Qc(){return wa.get(Jc)}function dr(){ir();const s=window.location.pathname,a=s&&!["/404","/sign-in"].includes(s),t=new URL(window.location.href),n=`${t.pathname.split("/")[1]?`/${t.pathname.split("/")[1]}`:""}#/sign-in`;window.location.href=n+(a?`?redirect=${s}`:"")}const Xc=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function Zc(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const gt=ji.create({baseURL:Zc(),timeout:12e3,headers:{"Content-Type":"application/json"}});gt.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const a=qt();if(!Xc.includes(s.url?.split("?")[0]||"")){if(!a.value)return dr(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=a.value}return s.headers["Content-Language"]=Qc().value||"zh-CN",s},s=>Promise.reject(s));gt.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const a=s.response?.status,t=s.response?.data?.message;return(a===401||a===403)&&dr(),A.error(t||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[a]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});const M={get:(s,a)=>gt.get(s,a),post:(s,a,t)=>gt.post(s,a,t),put:(s,a,t)=>gt.put(s,a,t),delete:(s,a)=>gt.delete(s,a)},ed="access_token";function sd(s){wa.set(ed,s)}const Bs=window?.settings?.secure_path,pa={getStats:()=>M.get(Bs+"/monitor/api/stats"),getOverride:()=>M.get(Bs+"/stat/getOverride"),getOrderStat:s=>M.get(Bs+"/stat/getOrder",{params:s}),getStatsData:()=>M.get(Bs+"/stat/getStats"),getNodeTrafficData:s=>M.get(Bs+"/stat/getTrafficRank",{params:s}),getServerLastRank:()=>M.get(Bs+"/stat/getServerLastRank"),getServerYesterdayRank:()=>M.get(Bs+"/stat/getServerYesterdayRank")},kt=window?.settings?.secure_path,Mt={getList:()=>M.get(kt+"/theme/getThemes"),getConfig:s=>M.post(kt+"/theme/getThemeConfig",{name:s}),updateConfig:(s,a)=>M.post(kt+"/theme/saveThemeConfig",{name:s,config:a}),upload:s=>{const a=new FormData;return a.append("file",s),M.post(kt+"/theme/upload",a,{headers:{"Content-Type":"multipart/form-data"}})},drop:s=>M.post(kt+"/theme/delete",{name:s})},dt=window?.settings?.secure_path,Js={getList:()=>M.get(dt+"/server/manage/getNodes"),save:s=>M.post(dt+"/server/manage/save",s),drop:s=>M.post(dt+"/server/manage/drop",s),copy:s=>M.post(dt+"/server/manage/copy",s),update:s=>M.post(dt+"/server/manage/update",s),sort:s=>M.post(dt+"/server/manage/sort",s)},$a=window?.settings?.secure_path,at={getList:()=>M.get($a+"/server/group/fetch"),save:s=>M.post($a+"/server/group/save",s),drop:s=>M.post($a+"/server/group/drop",s)},Aa=window?.settings?.secure_path,Sa={getList:()=>M.get(Aa+"/server/route/fetch"),save:s=>M.post(Aa+"/server/route/save",s),drop:s=>M.post(Aa+"/server/route/drop",s)},Gs=window?.settings?.secure_path,Qs={getList:()=>M.get(Gs+"/payment/fetch"),getMethodList:()=>M.get(Gs+"/payment/getPaymentMethods"),getMethodForm:s=>M.post(Gs+"/payment/getPaymentForm",s),save:s=>M.post(Gs+"/payment/save",s),drop:s=>M.post(Gs+"/payment/drop",s),updateStatus:s=>M.post(Gs+"/payment/show",s),sort:s=>M.post(Gs+"/payment/sort",s)},Tt=window?.settings?.secure_path,Ht={getList:()=>M.get(`${Tt}/notice/fetch`),save:s=>M.post(`${Tt}/notice/save`,s),drop:s=>M.post(`${Tt}/notice/drop`,{id:s}),updateStatus:s=>M.post(`${Tt}/notice/show`,{id:s}),sort:s=>M.post(`${Tt}/notice/sort`,{ids:s})},mt=window?.settings?.secure_path,vt={getList:()=>M.get(mt+"/knowledge/fetch"),getInfo:s=>M.get(mt+"/knowledge/fetch?id="+s),save:s=>M.post(mt+"/knowledge/save",s),drop:s=>M.post(mt+"/knowledge/drop",s),updateStatus:s=>M.post(mt+"/knowledge/show",s),sort:s=>M.post(mt+"/knowledge/sort",s)},Dt=window?.settings?.secure_path,es={getList:()=>M.get(Dt+"/plan/fetch"),save:s=>M.post(Dt+"/plan/save",s),update:s=>M.post(Dt+"/plan/update",s),drop:s=>M.post(Dt+"/plan/drop",s),sort:s=>M.post(Dt+"/plan/sort",{ids:s})},ut=window?.settings?.secure_path,Ys={getList:s=>M.post(ut+"/order/fetch",s),getInfo:s=>M.post(ut+"/order/detail",s),markPaid:s=>M.post(ut+"/order/paid",s),makeCancel:s=>M.post(ut+"/order/cancel",s),update:s=>M.post(ut+"/order/update",s),assign:s=>M.post(ut+"/order/assign",s)},Qt=window?.settings?.secure_path,ga={getList:s=>M.post(Qt+"/coupon/fetch",s),save:s=>M.post(Qt+"/coupon/generate",s),drop:s=>M.post(Qt+"/coupon/drop",s),update:s=>M.post(Qt+"/coupon/update",s)},Ns=window?.settings?.secure_path,ws={getList:s=>M.post(`${Ns}/user/fetch`,s),update:s=>M.post(`${Ns}/user/update`,s),resetSecret:s=>M.post(`${Ns}/user/resetSecret`,{id:s}),generate:s=>s.download_csv?M.post(`${Ns}/user/generate`,s,{responseType:"blob"}):M.post(`${Ns}/user/generate`,s),getStats:s=>M.post(`${Ns}/stat/getStatUser`,s),destroy:s=>M.post(`${Ns}/user/destroy`,{id:s}),sendMail:s=>M.post(`${Ns}/user/sendMail`,s),dumpCSV:s=>M.post(`${Ns}/user/dumpCSV`,s,{responseType:"blob"}),batchBan:s=>M.post(`${Ns}/user/ban`,s)},Xt=window?.settings?.secure_path,ft={getList:s=>M.post(Xt+"/ticket/fetch",s),getInfo:s=>M.get(Xt+"/ticket/fetch?id= "+s),reply:s=>M.post(Xt+"/ticket/reply",s),close:s=>M.post(Xt+"/ticket/close",{id:s})},os=window?.settings?.secure_path,me={getSettings:(s="")=>M.get(os+"/config/fetch?key="+s),saveSettings:s=>M.post(os+"/config/save",s),getEmailTemplate:()=>M.get(os+"/config/getEmailTemplate"),sendTestMail:()=>M.post(os+"/config/testSendMail"),setTelegramWebhook:()=>M.post(os+"/config/setTelegramWebhook"),updateSystemConfig:s=>M.post(os+"/config/save",s),getSystemStatus:()=>M.get(`${os}/system/getSystemStatus`),getQueueStats:()=>M.get(`${os}/system/getQueueStats`),getQueueWorkload:()=>M.get(`${os}/system/getQueueWorkload`),getQueueMasters:()=>M.get(`${os}/system/getQueueMasters`),getHorizonFailedJobs:s=>M.get(`${os}/system/getHorizonFailedJobs`,{params:s}),getSystemLog:s=>M.get(`${os}/system/getSystemLog`,{params:s})},Ds=window?.settings?.secure_path,Ps={getPluginList:()=>M.get(`${Ds}/plugin/getPlugins`),uploadPlugin:s=>{const a=new FormData;return a.append("file",s),M.post(`${Ds}/plugin/upload`,a,{headers:{"Content-Type":"multipart/form-data"}})},deletePlugin:s=>M.post(`${Ds}/plugin/delete`,{code:s}),installPlugin:s=>M.post(`${Ds}/plugin/install`,{code:s}),uninstallPlugin:s=>M.post(`${Ds}/plugin/uninstall`,{code:s}),enablePlugin:s=>M.post(`${Ds}/plugin/enable`,{code:s}),disablePlugin:s=>M.post(`${Ds}/plugin/disable`,{code:s}),getPluginConfig:s=>M.get(`${Ds}/plugin/config`,{params:{code:s}}),updatePluginConfig:(s,a)=>M.post(`${Ds}/plugin/config`,{code:s,config:a})};window?.settings?.secure_path;const td=x.object({subscribe_template_singbox:x.string().nullable(),subscribe_template_clash:x.string().nullable(),subscribe_template_clashmeta:x.string().nullable(),subscribe_template_stash:x.string().nullable(),subscribe_template_surge:x.string().nullable(),subscribe_template_surfboard:x.string().nullable()}),ad={subscribe_template_singbox:"",subscribe_template_clash:"",subscribe_template_clashmeta:"",subscribe_template_stash:"",subscribe_template_surge:"",subscribe_template_surfboard:""};function nd(){const{t:s}=V("settings"),[a,t]=m.useState(!1),l=m.useRef(null),[n,o]=m.useState("singbox"),r=ye({resolver:_e(td),defaultValues:ad,mode:"onBlur"}),{data:c}=ne({queryKey:["settings","client"],queryFn:()=>me.getSettings("subscribe_template")}),{mutateAsync:u}=gs({mutationFn:me.saveSettings,onSuccess:h=>{h.data&&A.success(s("common.autoSaved"))}});m.useEffect(()=>{if(c?.data.subscribe_template){const h=c.data.subscribe_template;Object.entries(h).forEach(([_,k])=>{r.setValue(_,k)}),l.current=h}},[c]),console.log(r.getValues());const i=m.useCallback(Se.debounce(async h=>{if(!Se.isEqual(h,l.current)){t(!0);try{await u(h),l.current=h}finally{t(!1)}}},1e3),[u]),d=m.useCallback(h=>{i(h)},[i]);return e.jsx(we,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Bt,{value:n,onValueChange:o,children:[e.jsxs(Ct,{children:[e.jsx(Ee,{value:"singbox",children:"Sing-box"}),e.jsx(Ee,{value:"clash",children:"Clash"}),e.jsx(Ee,{value:"clashmeta",children:"Clash Meta"}),e.jsx(Ee,{value:"stash",children:"Stash"}),e.jsx(Ee,{value:"surge",children:"Surge"}),e.jsx(Ee,{value:"surfboard",children:"Surfboard"})]}),e.jsx(We,{value:"singbox",children:e.jsx(v,{control:r.control,name:"subscribe_template_singbox",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.singbox.title")}),e.jsx(b,{children:e.jsx(ot,{height:"500px",defaultLanguage:"json",value:h.value||"",onChange:_=>{typeof _=="string"&&(h.onChange(_),d(r.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.singbox.description")}),e.jsx(P,{})]})})}),e.jsx(We,{value:"clash",children:e.jsx(v,{control:r.control,name:"subscribe_template_clash",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.clash.title")}),e.jsx(b,{children:e.jsx(ot,{height:"500px",defaultLanguage:"yaml",value:h.value||"",onChange:_=>{typeof _=="string"&&(h.onChange(_),d(r.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.clash.description")}),e.jsx(P,{})]})})}),e.jsx(We,{value:"clashmeta",children:e.jsx(v,{control:r.control,name:"subscribe_template_clashmeta",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.clashmeta.title")}),e.jsx(b,{children:e.jsx(ot,{height:"500px",defaultLanguage:"yaml",value:h.value||"",onChange:_=>{typeof _=="string"&&(h.onChange(_),d(r.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.clashmeta.description")}),e.jsx(P,{})]})})}),e.jsx(We,{value:"stash",children:e.jsx(v,{control:r.control,name:"subscribe_template_stash",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.stash.title")}),e.jsx(b,{children:e.jsx(ot,{height:"500px",defaultLanguage:"yaml",value:h.value||"",onChange:_=>{typeof _=="string"&&(h.onChange(_),d(r.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.stash.description")}),e.jsx(P,{})]})})}),e.jsx(We,{value:"surge",children:e.jsx(v,{control:r.control,name:"subscribe_template_surge",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.surge.title")}),e.jsx(b,{children:e.jsx(ot,{height:"500px",defaultLanguage:"ini",value:h.value||"",onChange:_=>{typeof _=="string"&&(h.onChange(_),d(r.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.surge.description")}),e.jsx(P,{})]})})}),e.jsx(We,{value:"surfboard",children:e.jsx(v,{control:r.control,name:"subscribe_template_surfboard",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe_template.surfboard.title")}),e.jsx(b,{children:e.jsx(ot,{height:"500px",defaultLanguage:"ini",value:h.value||"",onChange:_=>{typeof _=="string"&&(h.onChange(_),d(r.getValues()))},options:{minimap:{enabled:!1},fontSize:14}})}),e.jsx(F,{children:s("subscribe_template.surfboard.description")}),e.jsx(P,{})]})})})]}),a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function ld(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("subscribe_template.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("subscribe_template.description")})]}),e.jsx(ke,{}),e.jsx(nd,{})]})}const rd=()=>e.jsx(Gc,{children:e.jsx(dn,{})}),id=vi([{path:"/sign-in",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>wd);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(rd,{}),children:[{path:"/",lazy:async()=>({Component:(await fe(()=>Promise.resolve().then(()=>Id),void 0,import.meta.url)).default}),errorElement:e.jsx(ct,{}),children:[{index:!0,lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Zd);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(ct,{}),children:[{path:"system",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>am);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>im);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>um);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>fm);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Nm);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>km);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Rm);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Mm);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>qm);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Gm);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe-template",element:e.jsx(ld,{})}]},{path:"payment",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>eu);return{default:s}},void 0,import.meta.url)).default})},{path:"plugin",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>au);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>iu);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>hu);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Nu);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(ct,{}),children:[{path:"manage",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Xu);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>ax);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>cx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(ct,{}),children:[{path:"plan",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>jx);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Rx);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ax);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(ct,{}),children:[{path:"manage",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>fh);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await fe(async()=>{const{default:s}=await Promise.resolve().then(()=>Mh);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:ct},{path:"/404",Component:Kn},{path:"/503",Component:$c},{path:"*",Component:Kn}]);function od(){return M.get("/user/info")}const qa={token:qt()?.value||"",userInfo:null,isLoggedIn:!!qt()?.value,loading:!1,error:null},Ot=bi("user/fetchUserInfo",async()=>(await od()).data,{condition:(s,{getState:a})=>{const{user:t}=a();return!!t.token&&!t.loading}}),mr=yi({name:"user",initialState:qa,reducers:{setToken(s,a){s.token=a.payload,s.isLoggedIn=!!a.payload},resetUserState:()=>qa},extraReducers:s=>{s.addCase(Ot.pending,a=>{a.loading=!0,a.error=null}).addCase(Ot.fulfilled,(a,t)=>{a.loading=!1,a.userInfo=t.payload,a.error=null}).addCase(Ot.rejected,(a,t)=>{if(a.loading=!1,a.error=t.error.message||"Failed to fetch user info",!a.token)return qa})}}),{setToken:cd,resetUserState:dd}=mr.actions,md=s=>s.user.userInfo,ud=mr.reducer,ur=Ni({reducer:{user:ud}});qt()?.value&&ur.dispatch(Ot());_i.use(wi).use(Ci).init({resources:{"en-US":window.XBOARD_TRANSLATIONS?.["en-US"]||{},"zh-CN":window.XBOARD_TRANSLATIONS?.["zh-CN"]||{},"ko-KR":window.XBOARD_TRANSLATIONS?.["ko-KR"]||{}},fallbackLng:"zh-CN",supportedLngs:["en-US","zh-CN","ko-KR"],detection:{order:["querystring","localStorage","navigator"],lookupQuerystring:"lang",lookupLocalStorage:"i18nextLng",caches:["localStorage"]},interpolation:{escapeValue:!1}});const xd=new Si;ki.createRoot(document.getElementById("root")).render(e.jsx(Ti.StrictMode,{children:e.jsx(Di,{client:xd,children:e.jsx(Pi,{store:ur,children:e.jsxs(Fc,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(Ei,{router:id}),e.jsx(Ri,{richColors:!0,position:"top-right"})]})})})}));const Ye=m.forwardRef(({className:s,...a},t)=>e.jsx("div",{ref:t,className:y("rounded-xl border bg-card text-card-foreground shadow",s),...a}));Ye.displayName="Card";const ss=m.forwardRef(({className:s,...a},t)=>e.jsx("div",{ref:t,className:y("flex flex-col space-y-1.5 p-6",s),...a}));ss.displayName="CardHeader";const _s=m.forwardRef(({className:s,...a},t)=>e.jsx("h3",{ref:t,className:y("font-semibold leading-none tracking-tight",s),...a}));_s.displayName="CardTitle";const Xs=m.forwardRef(({className:s,...a},t)=>e.jsx("p",{ref:t,className:y("text-sm text-muted-foreground",s),...a}));Xs.displayName="CardDescription";const ts=m.forwardRef(({className:s,...a},t)=>e.jsx("div",{ref:t,className:y("p-6 pt-0",s),...a}));ts.displayName="CardContent";const hd=m.forwardRef(({className:s,...a},t)=>e.jsx("div",{ref:t,className:y("flex items-center p-6 pt-0",s),...a}));hd.displayName="CardFooter";const D=m.forwardRef(({className:s,type:a,...t},l)=>e.jsx("input",{type:a,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:l,...t}));D.displayName="Input";const xr=m.forwardRef(({className:s,...a},t)=>{const[l,n]=m.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:l?"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:t,...a}),e.jsx(E,{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:()=>n(o=>!o),children:l?e.jsx(Ii,{size:18}):e.jsx(Li,{size:18})})]})});xr.displayName="PasswordInput";const pd=s=>M.post("/passport/auth/login",s);function gd({className:s,onForgotPassword:a,...t}){const l=Is(),n=il(),{t:o}=V("auth"),r=x.object({email:x.string().min(1,{message:o("signIn.validation.emailRequired")}),password:x.string().min(1,{message:o("signIn.validation.passwordRequired")}).min(7,{message:o("signIn.validation.passwordLength")})}),c=ye({resolver:_e(r),defaultValues:{email:"",password:""}});async function u(i){try{const{data:d}=await pd(i);sd(d.auth_data),n(cd(d.auth_data)),await n(Ot()).unwrap(),l("/")}catch(d){console.error("Login failed:",d),d.response?.data?.message&&c.setError("root",{message:d.response.data.message})}}return e.jsx("div",{className:y("grid gap-6",s),...t,children:e.jsx(we,{...c,children:e.jsx("form",{onSubmit:c.handleSubmit(u),className:"space-y-4",children:e.jsxs("div",{className:"space-y-4",children:[c.formState.errors.root&&e.jsx("div",{className:"text-sm text-destructive",children:c.formState.errors.root.message}),e.jsx(v,{control:c.control,name:"email",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:o("signIn.email")}),e.jsx(b,{children:e.jsx(D,{placeholder:o("signIn.emailPlaceholder"),autoComplete:"email",...i})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"password",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:o("signIn.password")}),e.jsx(b,{children:e.jsx(xr,{placeholder:o("signIn.passwordPlaceholder"),autoComplete:"current-password",...i})}),e.jsx(P,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(E,{variant:"link",type:"button",className:"px-0 text-sm font-normal text-muted-foreground hover:text-primary",onClick:a,children:o("signIn.forgotPassword")})}),e.jsx(E,{className:"w-full",size:"lg",loading:c.formState.isSubmitting,children:o("signIn.submit")})]})})})})}const pe=ol,rs=cl,fd=dl,qs=mn,hr=m.forwardRef(({className:s,...a},t)=>e.jsx(ja,{ref: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),...a}));hr.displayName=ja.displayName;const ue=m.forwardRef(({className:s,children:a,...t},l)=>e.jsxs(fd,{children:[e.jsx(hr,{}),e.jsxs(va,{ref:l,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),...t,children:[a,e.jsxs(mn,{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(ds,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ue.displayName=va.displayName;const ve=({className:s,...a})=>e.jsx("div",{className:y("flex flex-col space-y-1.5 text-center sm:text-left",s),...a});ve.displayName="DialogHeader";const Re=({className:s,...a})=>e.jsx("div",{className:y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...a});Re.displayName="DialogFooter";const ge=m.forwardRef(({className:s,...a},t)=>e.jsx(ba,{ref:t,className:y("text-lg font-semibold leading-none tracking-tight",s),...a}));ge.displayName=ba.displayName;const Le=m.forwardRef(({className:s,...a},t)=>e.jsx(ya,{ref:t,className:y("text-sm text-muted-foreground",s),...a}));Le.displayName=ya.displayName;const bt=Zs("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"}}),G=m.forwardRef(({className:s,variant:a,size:t,asChild:l=!1,...n},o)=>{const r=l?on:"button";return e.jsx(r,{className:y(bt({variant:a,size:t,className:s})),ref:o,...n})});G.displayName="Button";const Es=Mi,Rs=Oi,jd=zi,vd=m.forwardRef(({className:s,inset:a,children:t,...l},n)=>e.jsxs(ml,{ref:n,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",a&&"pl-8",s),...l,children:[t,e.jsx(un,{className:"ml-auto h-4 w-4"})]}));vd.displayName=ml.displayName;const bd=m.forwardRef(({className:s,...a},t)=>e.jsx(ul,{ref:t,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),...a}));bd.displayName=ul.displayName;const Cs=m.forwardRef(({className:s,sideOffset:a=4,...t},l)=>e.jsx(Vi,{children:e.jsx(xl,{ref:l,sideOffset:a,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),...t})}));Cs.displayName=xl.displayName;const Ne=m.forwardRef(({className:s,inset:a,...t},l)=>e.jsx(hl,{ref:l,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",a&&"pl-8",s),...t}));Ne.displayName=hl.displayName;const yd=m.forwardRef(({className:s,children:a,checked:t,...l},n)=>e.jsxs(pl,{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),checked:t,...l,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(gl,{children:e.jsx(et,{className:"h-4 w-4"})})}),a]}));yd.displayName=pl.displayName;const Nd=m.forwardRef(({className:s,children:a,...t},l)=>e.jsxs(fl,{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),...t,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(gl,{children:e.jsx(Fi,{className:"h-4 w-4 fill-current"})})}),a]}));Nd.displayName=fl.displayName;const vn=m.forwardRef(({className:s,inset:a,...t},l)=>e.jsx(jl,{ref:l,className:y("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",s),...t}));vn.displayName=jl.displayName;const yt=m.forwardRef(({className:s,...a},t)=>e.jsx(vl,{ref:t,className:y("-mx-1 my-1 h-px bg-muted",s),...a}));yt.displayName=vl.displayName;const ln=({className:s,...a})=>e.jsx("span",{className:y("ml-auto text-xs tracking-widest opacity-60",s),...a});ln.displayName="DropdownMenuShortcut";const Ha=[{code:"en-US",name:"English",flag:$i,shortName:"EN"},{code:"zh-CN",name:"中文",flag:Ai,shortName:"CN"},{code:"ko-KR",name:"한국어",flag:qi,shortName:"KR"}];function pr(){const{i18n:s}=V(),a=n=>{s.changeLanguage(n)},t=Ha.find(n=>n.code===s.language)||Ha[1],l=t.flag;return e.jsxs(Es,{children:[e.jsx(Rs,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",children:[e.jsx(l,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:"text-sm font-medium",children:t.shortName})]})}),e.jsx(Cs,{align:"end",className:"w-[120px]",children:Ha.map(n=>{const o=n.flag,r=n.code===s.language;return e.jsxs(Ne,{onClick:()=>a(n.code),className:y("flex items-center gap-2 px-2 py-1.5 cursor-pointer",r&&"bg-accent"),children:[e.jsx(o,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:y("text-sm",r&&"font-medium"),children:n.name})]},n.code)})})]})}function _d(){const[s,a]=m.useState(!1),{t}=V("auth"),l=t("signIn.resetPassword.command");return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"container relative flex min-h-svh flex-col items-center justify-center bg-primary-foreground px-4 py-8 lg:max-w-none lg:px-0",children:[e.jsx("div",{className:"absolute right-4 top-4 md:right-8 md:top-8",children:e.jsx(pr,{})}),e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px] md:w-[420px] lg:p-8",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold sm:text-3xl",children:window?.settings?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:window?.settings?.description})]}),e.jsxs(Ye,{className:"p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-tight sm:text-2xl",children:t("signIn.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("signIn.description")})]}),e.jsx(gd,{onForgotPassword:()=>a(!0)})]})]})]}),e.jsx(pe,{open:s,onOpenChange:a,children:e.jsx(ue,{className:"max-w-[90vw] sm:max-w-lg",children:e.jsxs(ve,{children:[e.jsx(ge,{children:t("signIn.resetPassword.title")}),e.jsx(Le,{children:t("signIn.resetPassword.description")}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"max-w-full overflow-x-auto rounded-md bg-secondary p-4 pr-12 text-sm",children:l}),e.jsx(G,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>ha(l).then(()=>{A.success(t("common:copy.success"))}),children:e.jsx(Hi,{className:"h-4 w-4"})})]})})]})})})]})}const wd=Object.freeze(Object.defineProperty({__proto__:null,default:_d},Symbol.toStringTag,{value:"Module"})),Ve=m.forwardRef(({className:s,fadedBelow:a=!1,fixedHeight:t=!1,...l},n)=>e.jsx("div",{ref:n,className:y("relative flex h-full w-full flex-col",a&&"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",t&&"md:h-svh",s),...l}));Ve.displayName="Layout";const Fe=m.forwardRef(({className:s,...a},t)=>e.jsx("div",{ref:t,className:y("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...a}));Fe.displayName="LayoutHeader";const Ae=m.forwardRef(({className:s,fixedHeight:a,...t},l)=>e.jsx("div",{ref:l,className:y("flex-1 overflow-hidden px-4 py-6 md:px-8",a&&"h-[calc(100%-var(--header-height))]",s),...t}));Ae.displayName="LayoutBody";const gr=Ui,fr=Ki,jr=Bi,be=Gi,xe=Wi,he=Yi,de=m.forwardRef(({className:s,sideOffset:a=4,...t},l)=>e.jsx(bl,{ref:l,sideOffset:a,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),...t}));de.displayName=bl.displayName;function ka(){const{pathname:s}=cn();return{checkActiveNav:t=>{if(t==="/"&&s==="/")return!0;const l=t.replace(/^\//,""),n=s.replace(/^\//,"");return l?n.startsWith(l):!1}}}function vr({key:s,defaultValue:a}){const[t,l]=m.useState(()=>{const n=localStorage.getItem(s);return n!==null?JSON.parse(n):a});return m.useEffect(()=>{localStorage.setItem(s,JSON.stringify(t))},[t,s]),[t,l]}function Cd(){const[s,a]=vr({key:"collapsed-sidebar-items",defaultValue:[]}),t=n=>!s.includes(n);return{isExpanded:t,toggleItem:n=>{t(n)?a([...s,n]):a(s.filter(o=>o!==n))}}}function Sd({links:s,isCollapsed:a,className:t,closeNav:l}){const{t:n}=V(),o=({sub:r,...c})=>{const u=`${n(c.title)}-${c.href}`;return a&&r?m.createElement(Dd,{...c,sub:r,key:u,closeNav:l}):a?m.createElement(Td,{...c,key:u,closeNav:l}):r?m.createElement(kd,{...c,sub:r,key:u,closeNav:l}):m.createElement(br,{...c,key:u,closeNav:l})};return e.jsx("div",{"data-collapsed":a,className:y("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",t),children:e.jsx(be,{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(o)})})})}function br({title:s,icon:a,label:t,href:l,closeNav:n,subLink:o=!1}){const{checkActiveNav:r}=ka(),{t:c}=V();return e.jsxs(st,{to:l,onClick:n,className:y(wt({variant:r(l)?"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":r(l)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:a}),c(s),t&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:c(t)})]})}function kd({title:s,icon:a,label:t,sub:l,closeNav:n}){const{checkActiveNav:o}=ka(),{isExpanded:r,toggleItem:c}=Cd(),{t:u}=V(),i=!!l?.find(_=>o(_.href)),d=u(s),h=r(d)||i;return e.jsxs(gr,{open:h,onOpenChange:()=>c(d),children:[e.jsxs(fr,{className:y(wt({variant:i?"secondary":"ghost",size:"sm"}),"group h-12 w-full justify-start rounded-none px-6"),children:[e.jsx("div",{className:"mr-2",children:a}),u(s),t&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:u(t)}),e.jsx("span",{className:y('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(yl,{stroke:1})})]}),e.jsx(jr,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:l.map(_=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(br,{..._,subLink:!0,closeNav:n})},u(_.title)))})})]})}function Td({title:s,icon:a,label:t,href:l,closeNav:n}){const{checkActiveNav:o}=ka(),{t:r}=V();return e.jsxs(xe,{delayDuration:0,children:[e.jsx(he,{asChild:!0,children:e.jsxs(st,{to:l,onClick:n,className:y(wt({variant:o(l)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[a,e.jsx("span",{className:"sr-only",children:r(s)})]})}),e.jsxs(de,{side:"right",className:"flex items-center gap-4",children:[r(s),t&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:r(t)})]})]})}function Dd({title:s,icon:a,label:t,sub:l,closeNav:n}){const{checkActiveNav:o}=ka(),{t:r}=V(),c=!!l?.find(u=>o(u.href));return e.jsxs(Es,{children:[e.jsxs(xe,{delayDuration:0,children:[e.jsx(he,{asChild:!0,children:e.jsx(Rs,{asChild:!0,children:e.jsx(E,{variant:c?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:a})})}),e.jsxs(de,{side:"right",className:"flex items-center gap-4",children:[r(s)," ",t&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:r(t)}),e.jsx(yl,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(Cs,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(vn,{children:[r(s)," ",t?`(${r(t)})`:""]}),e.jsx(yt,{}),l.map(({title:u,icon:i,label:d,href:h})=>e.jsx(Ne,{asChild:!0,children:e.jsxs(st,{to:h,onClick:n,className:`${o(h)?"bg-secondary":""}`,children:[i," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:r(u)}),d&&e.jsx("span",{className:"ml-auto text-xs",children:r(d)})]})},`${r(u)}-${h}`))]})]})}const yr=[{title:"nav:dashboard",label:"",href:"/",icon:e.jsx(Ji,{size:18})},{title:"nav:systemManagement",label:"",href:"",icon:e.jsx(Qi,{size:18}),sub:[{title:"nav:systemConfig",label:"",href:"/config/system",icon:e.jsx(Nl,{size:18})},{title:"nav:pluginManagement",label:"",href:"/config/plugin",icon:e.jsx(xn,{size:18})},{title:"nav:themeConfig",label:"",href:"/config/theme",icon:e.jsx(Xi,{size:18})},{title:"nav:noticeManagement",label:"",href:"/config/notice",icon:e.jsx(Zi,{size:18})},{title:"nav:paymentConfig",label:"",href:"/config/payment",icon:e.jsx(Fn,{size:18})},{title:"nav:knowledgeManagement",label:"",href:"/config/knowledge",icon:e.jsx(eo,{size:18})}]},{title:"nav:nodeManagement",label:"",href:"",icon:e.jsx(_l,{size:18}),sub:[{title:"nav:nodeManagement",label:"",href:"/server/manage",icon:e.jsx(so,{size:18})},{title:"nav:permissionGroupManagement",label:"",href:"/server/group",icon:e.jsx(wl,{size:18})},{title:"nav:routeManagement",label:"",href:"/server/route",icon:e.jsx(to,{size:18})}]},{title:"nav:subscriptionManagement",label:"",href:"",icon:e.jsx(ao,{size:18}),sub:[{title:"nav:planManagement",label:"",href:"/finance/plan",icon:e.jsx(no,{size:18})},{title:"nav:orderManagement",label:"",href:"/finance/order",icon:e.jsx(Fn,{size:18})},{title:"nav:couponManagement",label:"",href:"/finance/coupon",icon:e.jsx(lo,{size:18})}]},{title:"nav:userManagement",label:"",href:"",icon:e.jsx(ro,{size:18}),sub:[{title:"nav:userManagement",label:"",href:"/user/manage",icon:e.jsx(io,{size:18})},{title:"nav:ticketManagement",label:"",href:"/user/ticket",icon:e.jsx(Cl,{size:18})}]}];function Pd({className:s,isCollapsed:a,setIsCollapsed:t}){const[l,n]=m.useState(!1),{t:o}=V();return m.useEffect(()=>{l?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[l]),e.jsxs("aside",{className:y(`fixed left-0 right-0 top-0 z-50 flex h-auto flex-col border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${a?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>n(!1),className:`absolute inset-0 transition-[opacity] delay-100 duration-700 ${l?"h-svh opacity-50":"h-0 opacity-0"} w-full bg-black md:hidden`}),e.jsxs(Ve,{className:`flex h-full flex-col ${l?"h-[100vh] md:h-full":""}`,children:[e.jsxs(Fe,{className:"sticky top-0 justify-between px-4 py-3 shadow md:px-4",children:[e.jsxs("div",{className:`flex items-center ${a?"":"gap-2"}`,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:`transition-all ${a?"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 ${a?"invisible w-0":"visible w-auto"}`,children:e.jsx("span",{className:"font-medium",children:window?.settings?.title})})]}),e.jsx(E,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":o("common:toggleNavigation"),"aria-controls":"sidebar-menu","aria-expanded":l,onClick:()=>n(r=>!r),children:l?e.jsx(oo,{}):e.jsx(co,{})})]}),e.jsx(Sd,{id:"sidebar-menu",className:y("flex-1 overflow-auto overscroll-contain",l?"block":"hidden md:block","md:py-2"),closeNav:()=>n(!1),isCollapsed:a,links:yr}),e.jsx("div",{className:y("border-t border-border/50 bg-background","px-4 py-2.5 text-xs text-muted-foreground",l?"block":"hidden md:block",a?"text-center":"text-left"),children:e.jsxs("div",{className:y("flex items-center gap-1.5",a?"justify-center":"justify-start"),children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),e.jsxs("span",{className:y("whitespace-nowrap tracking-wide","transition-opacity duration-200",a&&"md:opacity-0"),children:["v",window?.settings?.version]})]})}),e.jsx(E,{onClick:()=>t(r=>!r),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex","aria-label":o("common:toggleSidebar"),children:e.jsx(mo,{stroke:1.5,className:`h-5 w-5 ${a?"rotate-180":""}`})})]})]})}function Ed(){const[s,a]=vr({key:"collapsed-sidebar",defaultValue:!1});return m.useEffect(()=>{const t=()=>{a(window.innerWidth<768?!1:s)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[s,a]),[s,a]}function Rd(){const[s,a]=Ed();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(Pd,{isCollapsed:s,setIsCollapsed:a}),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(dn,{})})]})}const Id=Object.freeze(Object.defineProperty({__proto__:null,default:Rd},Symbol.toStringTag,{value:"Module"})),Us=m.forwardRef(({className:s,...a},t)=>e.jsx(He,{ref:t,className:y("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...a}));Us.displayName=He.displayName;const Ld=({children:s,...a})=>e.jsx(pe,{...a,children:e.jsx(ue,{className:"overflow-hidden p-0",children:e.jsx(Us,{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})})}),nt=m.forwardRef(({className:s,...a},t)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(uo,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(He.Input,{ref:t,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),...a})]}));nt.displayName=He.Input.displayName;const Ks=m.forwardRef(({className:s,...a},t)=>e.jsx(He.List,{ref:t,className:y("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...a}));Ks.displayName=He.List.displayName;const lt=m.forwardRef((s,a)=>e.jsx(He.Empty,{ref:a,className:"py-6 text-center text-sm",...s}));lt.displayName=He.Empty.displayName;const as=m.forwardRef(({className:s,...a},t)=>e.jsx(He.Group,{ref:t,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),...a}));as.displayName=He.Group.displayName;const St=m.forwardRef(({className:s,...a},t)=>e.jsx(He.Separator,{ref:t,className:y("-mx-1 h-px bg-border",s),...a}));St.displayName=He.Separator.displayName;const $e=m.forwardRef(({className:s,...a},t)=>e.jsx(He.Item,{ref:t,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),...a}));$e.displayName=He.Item.displayName;function Vd(){const s=[];for(const a of yr)if(a.href&&s.push(a),a.sub)for(const t of a.sub)s.push({...t,parent:a.title});return s}function Xe(){const[s,a]=m.useState(!1),t=Is(),l=Vd(),{t:n}=V("search"),{t:o}=V("nav");m.useEffect(()=>{const c=u=>{u.key==="k"&&(u.metaKey||u.ctrlKey)&&(u.preventDefault(),a(i=>!i))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]);const r=m.useCallback(c=>{a(!1),t(c)},[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(G,{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:()=>a(!0),children:[e.jsx(hn,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:n("placeholder")}),e.jsx("span",{className:"sr-only",children:n("shortcut.label")}),e.jsx("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:n("shortcut.key")})]}),e.jsxs(Ld,{open:s,onOpenChange:a,children:[e.jsx(nt,{placeholder:n("placeholder")}),e.jsxs(Ks,{children:[e.jsx(lt,{children:n("noResults")}),e.jsx(as,{heading:n("title"),children:l.map(c=>e.jsxs($e,{value:`${c.parent?c.parent+" ":""}${c.title}`,onSelect:()=>r(c.href),children:[e.jsx("div",{className:"mr-2",children:c.icon}),e.jsx("span",{children:o(c.title)}),c.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:o(c.parent)})]},c.href))})]})]})]})}function Ue(){const{theme:s,setTheme:a}=Mc();return m.useEffect(()=>{const t=s==="dark"?"#020817":"#fff",l=document.querySelector("meta[name='theme-color']");l&&l.setAttribute("content",t)},[s]),e.jsxs(e.Fragment,{children:[e.jsx(E,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>a(s==="light"?"dark":"light"),children:s==="light"?e.jsx(xo,{size:20}):e.jsx(ho,{size:20})}),e.jsx(pr,{})]})}const Nr=m.forwardRef(({className:s,...a},t)=>e.jsx(Sl,{ref:t,className:y("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...a}));Nr.displayName=Sl.displayName;const _r=m.forwardRef(({className:s,...a},t)=>e.jsx(kl,{ref:t,className:y("aspect-square h-full w-full",s),...a}));_r.displayName=kl.displayName;const wr=m.forwardRef(({className:s,...a},t)=>e.jsx(Tl,{ref:t,className:y("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...a}));wr.displayName=Tl.displayName;function Ke(){const s=Is(),a=il(),t=po(md),{t:l}=V(["common"]),n=()=>{ir(),a(dd()),s("/sign-in")},o=t?.email?.split("@")[0]||l("common:user"),r=o.substring(0,2).toUpperCase();return e.jsxs(Es,{children:[e.jsx(Rs,{asChild:!0,children:e.jsx(E,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(Nr,{className:"h-8 w-8",children:[e.jsx(_r,{src:t?.avatar_url,alt:o}),e.jsx(wr,{children:r})]})})}),e.jsxs(Cs,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(vn,{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:o}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:t?.email||l("common:defaultEmail")})]})}),e.jsx(yt,{}),e.jsx(Ne,{asChild:!0,children:e.jsxs(st,{to:"/config/system",children:[l("common:settings"),e.jsx(ln,{children:"⌘S"})]})}),e.jsx(yt,{}),e.jsxs(Ne,{onClick:n,children:[l("common:logout"),e.jsx(ln,{children:"⇧⌘Q"})]})]})]})}const X=go,Be=wo,Z=fo,Y=m.forwardRef(({className:s,children:a,...t},l)=>e.jsxs(Dl,{ref:l,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),...t,children:[a,e.jsx(jo,{asChild:!0,children:e.jsx(pn,{className:"h-4 w-4 opacity-50"})})]}));Y.displayName=Dl.displayName;const Cr=m.forwardRef(({className:s,...a},t)=>e.jsx(Pl,{ref:t,className:y("flex cursor-default items-center justify-center py-1",s),...a,children:e.jsx(vo,{className:"h-4 w-4"})}));Cr.displayName=Pl.displayName;const Sr=m.forwardRef(({className:s,...a},t)=>e.jsx(El,{ref:t,className:y("flex cursor-default items-center justify-center py-1",s),...a,children:e.jsx(pn,{className:"h-4 w-4"})}));Sr.displayName=El.displayName;const J=m.forwardRef(({className:s,children:a,position:t="popper",...l},n)=>e.jsx(bo,{children:e.jsxs(Rl,{ref:n,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",t==="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:t,...l,children:[e.jsx(Cr,{}),e.jsx(yo,{className:y("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),e.jsx(Sr,{})]})}));J.displayName=Rl.displayName;const Fd=m.forwardRef(({className:s,...a},t)=>e.jsx(Il,{ref:t,className:y("px-2 py-1.5 text-sm font-semibold",s),...a}));Fd.displayName=Il.displayName;const $=m.forwardRef(({className:s,children:a,...t},l)=>e.jsxs(Ll,{ref:l,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),...t,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(No,{children:e.jsx(et,{className:"h-4 w-4"})})}),e.jsx(_o,{children:a})]}));$.displayName=Ll.displayName;const Md=m.forwardRef(({className:s,...a},t)=>e.jsx(Vl,{ref:t,className:y("-mx-1 my-1 h-px bg-muted",s),...a}));Md.displayName=Vl.displayName;function rt({className:s,classNames:a,showOutsideDays:t=!0,...l}){return e.jsx(Co,{showOutsideDays:t,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(bt({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",l.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(bt({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",...a},components:{IconLeft:({className:n,...o})=>e.jsx(Fl,{className:y("h-4 w-4",n),...o}),IconRight:({className:n,...o})=>e.jsx(un,{className:y("h-4 w-4",n),...o})},...l})}rt.displayName="Calendar";const Ss=ko,ks=To,bs=m.forwardRef(({className:s,align:a="center",sideOffset:t=4,...l},n)=>e.jsx(So,{children:e.jsx(Ml,{ref:n,align:a,sideOffset:t,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),...l})}));bs.displayName=Ml.displayName;const zs={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},Lt=s=>(s/100).toFixed(2),Od=({active:s,payload:a,label:t})=>{const{t:l}=V();return s&&a&&a.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:t}),a.map((n,o)=>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:[l(n.name),":"]}),e.jsx("span",{className:"font-medium",children:n.name.includes(l("dashboard:overview.amount"))?`¥${Lt(n.value)}`:l("dashboard:overview.transactions",{count:n.value})})]},o))]}):null},zd=[{value:"7d",label:"dashboard:overview.last7Days"},{value:"30d",label:"dashboard:overview.last30Days"},{value:"90d",label:"dashboard:overview.last90Days"},{value:"180d",label:"dashboard:overview.last180Days"},{value:"365d",label:"dashboard:overview.lastYear"},{value:"custom",label:"dashboard:overview.customRange"}],$d=(s,a)=>{const t=new Date;if(s==="custom"&&a)return{startDate:a.from,endDate:a.to};let l;switch(s){case"7d":l=hs(t,7);break;case"30d":l=hs(t,30);break;case"90d":l=hs(t,90);break;case"180d":l=hs(t,180);break;case"365d":l=hs(t,365);break;default:l=hs(t,30)}return{startDate:l,endDate:t}};function Ad(){const[s,a]=m.useState("amount"),[t,l]=m.useState("30d"),[n,o]=m.useState({from:hs(new Date,7),to:new Date}),{t:r}=V(),{startDate:c,endDate:u}=$d(t,n),{data:i}=ne({queryKey:["orderStat",{start_date:xs(c,"yyyy-MM-dd"),end_date:xs(u,"yyyy-MM-dd")}],queryFn:async()=>{const{data:d}=await pa.getOrderStat({start_date:xs(c,"yyyy-MM-dd"),end_date:xs(u,"yyyy-MM-dd")});return d},refetchInterval:3e4});return e.jsxs(Ye,{children:[e.jsx(ss,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(_s,{children:r("dashboard:overview.title")}),e.jsxs(Xs,{children:[i?.summary.start_date," ",r("dashboard:overview.to")," ",i?.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(X,{value:t,onValueChange:d=>l(d),children:[e.jsx(Y,{className:"w-[120px]",children:e.jsx(Z,{placeholder:r("dashboard:overview.selectTimeRange")})}),e.jsx(J,{children:zd.map(d=>e.jsx($,{value:d.value,children:r(d.label)},d.value))})]}),t==="custom"&&e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:y("min-w-0 justify-start text-left font-normal",!n&&"text-muted-foreground"),children:[e.jsx(Kt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:n?.from?n.to?e.jsxs(e.Fragment,{children:[xs(n.from,"yyyy-MM-dd")," -"," ",xs(n.to,"yyyy-MM-dd")]}):xs(n.from,"yyyy-MM-dd"):r("dashboard:overview.selectDate")})]})}),e.jsx(bs,{className:"w-auto p-0",align:"end",children:e.jsx(rt,{mode:"range",defaultMonth:n?.from,selected:{from:n?.from,to:n?.to},onSelect:d=>{d?.from&&d?.to&&o({from:d.from,to:d.to})},numberOfMonths:2})})]})]}),e.jsx(Bt,{value:s,onValueChange:d=>a(d),children:e.jsxs(Ct,{children:[e.jsx(Ee,{value:"amount",children:r("dashboard:overview.amount")}),e.jsx(Ee,{value:"count",children:r("dashboard:overview.count")})]})})]})]})}),e.jsxs(ts,{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:r("dashboard:overview.totalIncome")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Lt(i?.summary?.paid_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r("dashboard:overview.totalTransactions",{count:i?.summary?.paid_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[r("dashboard:overview.avgOrderAmount")," ¥",Lt(i?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:r("dashboard:overview.totalCommission")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Lt(i?.summary?.commission_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r("dashboard:overview.totalTransactions",{count:i?.summary?.commission_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[r("dashboard:overview.commissionRate")," ",i?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]}),e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(Do,{width:"100%",height:"100%",children:e.jsxs(Po,{data:i?.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:zs.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:zs.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:zs.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:zs.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(Eo,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>xs(new Date(d),"MM-dd",{locale:Vo})}),e.jsx(Ro,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>s==="amount"?`¥${Lt(d)}`:r("dashboard:overview.transactions",{count:d})}),e.jsx(Io,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(Lo,{content:e.jsx(Od,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(Mn,{type:"monotone",dataKey:"paid_total",name:r("dashboard:overview.orderAmount"),stroke:zs.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(Mn,{type:"monotone",dataKey:"commission_total",name:r("dashboard:overview.commissionAmount"),stroke:zs.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(On,{dataKey:"paid_count",name:r("dashboard:overview.orderCount"),fill:zs.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(On,{dataKey:"commission_count",name:r("dashboard:overview.commissionCount"),fill:zs.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})]})]})}function ce({className:s,...a}){return e.jsx("div",{className:y("animate-pulse rounded-md bg-primary/10",s),...a})}function qd(){return e.jsxs(Ye,{children:[e.jsxs(ss,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ce,{className:"h-4 w-[120px]"}),e.jsx(ce,{className:"h-4 w-4"})]}),e.jsxs(ts,{children:[e.jsx(ce,{className:"h-8 w-[140px] mb-2"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-4 w-4"}),e.jsx(ce,{className:"h-4 w-[100px]"})]})]})]})}function Hd(){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:Array.from({length:8}).map((s,a)=>e.jsx(qd,{},a))})}var ae=(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))(ae||{});const Pt={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},Et={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var ps=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(ps||{}),je=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(je||{});const Zt={0:"待确认",1:"发放中",2:"有效",3:"无效"},ea={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var Ie=(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))(Ie||{});const Ud={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var re=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s.Tuic="tuic",s.Socks="socks",s.Naive="naive",s.Http="http",s.Mieru="mieru",s.AnyTLS="anytls",s))(re||{});const cs=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"},{type:"tuic",label:"TUIC"},{type:"socks",label:"SOCKS"},{type:"naive",label:"Naive"},{type:"http",label:"HTTP"},{type:"mieru",label:"Mieru"},{type:"anytls",label:"AnyTLS"}],Ge={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a",tuic:"#00C853",socks:"#2196F3",naive:"#9C27B0",http:"#FF5722",mieru:"#4CAF50",anytls:"#7E57C2"};var Ze=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(Ze||{});const Kd={1:"按金额优惠",2:"按比例优惠"};var Hs=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(Hs||{}),qe=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(qe||{}),zt=(s=>(s.MONTH="monthly",s.QUARTER="quarterly",s.HALF_YEAR="half_yearly",s.YEAR="yearly",s.TWO_YEAR="two_yearly",s.THREE_YEAR="three_yearly",s.ONETIME="onetime",s.RESET="reset_traffic",s))(zt||{});function $s({title:s,value:a,icon:t,trend:l,description:n,onClick:o,highlight:r,className:c}){return e.jsxs(Ye,{className:y("transition-colors",o&&"cursor-pointer hover:bg-muted/50",r&&"border-primary/50",c),onClick:o,children:[e.jsxs(ss,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(_s,{className:"text-sm font-medium",children:s}),t]}),e.jsxs(ts,{children:[e.jsx("div",{className:"text-2xl font-bold",children:a}),l?e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(Ao,{className:y("h-4 w-4",l.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:y("ml-1 text-xs",l.isPositive?"text-emerald-500":"text-red-500"),children:[l.isPositive?"+":"-",Math.abs(l.value),"%"]}),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:l.label})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:n})]})]})}function Bd({className:s}){const a=Is(),{t}=V(),{data:l,isLoading:n}=ne({queryKey:["dashboardStats"],queryFn:async()=>(await pa.getStatsData()).data,refetchInterval:1e3*60*5});if(n||!l)return e.jsx(Hd,{});const o=()=>{const r=new URLSearchParams;r.set("commission_status",je.PENDING.toString()),r.set("status",ae.COMPLETED.toString()),r.set("commission_balance","gt:0"),a(`/finance/order?${r.toString()}`)};return e.jsxs("div",{className:y("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx($s,{title:t("dashboard:stats.todayIncome"),value:Ws(l.todayIncome),icon:e.jsx(Fo,{className:"h-4 w-4 text-emerald-500"}),trend:{value:l.dayIncomeGrowth,label:t("dashboard:stats.vsYesterday"),isPositive:l.dayIncomeGrowth>0}}),e.jsx($s,{title:t("dashboard:stats.monthlyIncome"),value:Ws(l.currentMonthIncome),icon:e.jsx(Mo,{className:"h-4 w-4 text-blue-500"}),trend:{value:l.monthIncomeGrowth,label:t("dashboard:stats.vsLastMonth"),isPositive:l.monthIncomeGrowth>0}}),e.jsx($s,{title:t("dashboard:stats.pendingTickets"),value:l.ticketPendingTotal,icon:e.jsx(Oo,{className:y("h-4 w-4",l.ticketPendingTotal>0?"text-orange-500":"text-muted-foreground")}),description:l.ticketPendingTotal>0?t("dashboard:stats.hasPendingTickets"):t("dashboard:stats.noPendingTickets"),onClick:()=>a("/user/ticket"),highlight:l.ticketPendingTotal>0}),e.jsx($s,{title:t("dashboard:stats.pendingCommission"),value:l.commissionPendingTotal,icon:e.jsx(zo,{className:y("h-4 w-4",l.commissionPendingTotal>0?"text-blue-500":"text-muted-foreground")}),description:l.commissionPendingTotal>0?t("dashboard:stats.hasPendingCommission"):t("dashboard:stats.noPendingCommission"),onClick:o,highlight:l.commissionPendingTotal>0}),e.jsx($s,{title:t("dashboard:stats.monthlyNewUsers"),value:l.currentMonthNewUsers,icon:e.jsx(Qa,{className:"h-4 w-4 text-blue-500"}),trend:{value:l.userGrowth,label:t("dashboard:stats.vsLastMonth"),isPositive:l.userGrowth>0}}),e.jsx($s,{title:t("dashboard:stats.totalUsers"),value:l.totalUsers,icon:e.jsx(Qa,{className:"h-4 w-4 text-muted-foreground"}),description:t("dashboard:stats.activeUsers",{count:l.activeUsers})}),e.jsx($s,{title:t("dashboard:stats.monthlyUpload"),value:Oe(l.monthTraffic.upload),icon:e.jsx(At,{className:"h-4 w-4 text-emerald-500"}),description:t("dashboard:stats.todayTraffic",{value:Oe(l.todayTraffic.upload)})}),e.jsx($s,{title:t("dashboard:stats.monthlyDownload"),value:Oe(l.monthTraffic.download),icon:e.jsx($o,{className:"h-4 w-4 text-blue-500"}),description:t("dashboard:stats.todayTraffic",{value:Oe(l.todayTraffic.download)})})]})}const Nt=m.forwardRef(({className:s,children:a,...t},l)=>e.jsxs(Ol,{ref:l,className:y("relative overflow-hidden",s),...t,children:[e.jsx(qo,{className:"h-full w-full rounded-[inherit]",children:a}),e.jsx(fa,{}),e.jsx(Ho,{})]}));Nt.displayName=Ol.displayName;const fa=m.forwardRef(({className:s,orientation:a="vertical",...t},l)=>e.jsx(zl,{ref:l,orientation:a,className:y("flex touch-none select-none transition-colors",a==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",a==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s),...t,children:e.jsx(Uo,{className:"relative flex-1 rounded-full bg-border"})}));fa.displayName=zl.displayName;const rn={today:{getValue:()=>{const s=Bo();return{start:s,end:Go(s,1)}}},last7days:{getValue:()=>{const s=new Date;return{start:hs(s,7),end:s}}},last30days:{getValue:()=>{const s=new Date;return{start:hs(s,30),end:s}}},custom:{getValue:()=>null}};function Gn({selectedRange:s,customDateRange:a,onRangeChange:t,onCustomRangeChange:l}){const{t:n}=V(),o={today:n("dashboard:trafficRank.today"),last7days:n("dashboard:trafficRank.last7days"),last30days:n("dashboard:trafficRank.last30days"),custom:n("dashboard:trafficRank.customRange")};return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.jsxs(X,{value:s,onValueChange:t,children:[e.jsx(Y,{className:"w-[120px]",children:e.jsx(Z,{placeholder:n("dashboard:trafficRank.selectTimeRange")})}),e.jsx(J,{position:"popper",className:"z-50",children:Object.entries(rn).map(([r])=>e.jsx($,{value:r,children:o[r]},r))})]}),s==="custom"&&e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:y("min-w-0 justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Kt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a?.from?a.to?e.jsxs(e.Fragment,{children:[xs(a.from,"yyyy-MM-dd")," -"," ",xs(a.to,"yyyy-MM-dd")]}):xs(a.from,"yyyy-MM-dd"):e.jsx("span",{children:n("dashboard:trafficRank.selectDateRange")})})]})}),e.jsx(bs,{className:"w-auto p-0",align:"end",children:e.jsx(rt,{mode:"range",defaultMonth:a?.from,selected:{from:a?.from,to:a?.to},onSelect:r=>{r?.from&&r?.to&&l({from:r.from,to:r.to})},numberOfMonths:2})})]})]})}const xt=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Gd({className:s}){const{t:a}=V(),[t,l]=m.useState("today"),[n,o]=m.useState({from:hs(new Date,7),to:new Date}),[r,c]=m.useState("today"),[u,i]=m.useState({from:hs(new Date,7),to:new Date}),d=m.useMemo(()=>t==="custom"?{start:n.from,end:n.to}:rn[t].getValue(),[t,n]),h=m.useMemo(()=>r==="custom"?{start:u.from,end:u.to}:rn[r].getValue(),[r,u]),{data:_}=ne({queryKey:["nodeTrafficRank",d.start,d.end],queryFn:()=>pa.getNodeTrafficData({type:"node",start_time:Se.round(d.start.getTime()/1e3),end_time:Se.round(d.end.getTime()/1e3)}),refetchInterval:3e4}),{data:k}=ne({queryKey:["userTrafficRank",h.start,h.end],queryFn:()=>pa.getNodeTrafficData({type:"user",start_time:Se.round(h.start.getTime()/1e3),end_time:Se.round(h.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:y("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(Ye,{children:[e.jsx(ss,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(_s,{className:"flex items-center text-base font-medium",children:[e.jsx(Ko,{className:"mr-2 h-4 w-4"}),a("dashboard:trafficRank.nodeTrafficRank")]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(Gn,{selectedRange:t,customDateRange:n,onRangeChange:l,onCustomRangeChange:o}),e.jsx(zn,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(ts,{className:"flex-1",children:_?.data?e.jsxs(Nt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:_.data.map(S=>e.jsx(be,{delayDuration:200,children:e.jsxs(xe,{children:[e.jsx(he,{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:S.name}),e.jsxs("span",{className:y("ml-2 flex items-center text-xs font-medium",S.change>=0?"text-green-600":"text-red-600"),children:[S.change>=0?e.jsx(Xa,{className:"mr-1 h-3 w-3"}):e.jsx(Za,{className:"mr-1 h-3 w-3"}),Math.abs(S.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:`${S.value/_.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:xt(S.value)})]})]})})}),e.jsx(de,{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.jsxs("span",{className:"text-muted-foreground",children:[a("dashboard:trafficRank.currentTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:xt(S.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[a("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:xt(S.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[a("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:y("font-medium",S.change>=0?"text-green-600":"text-red-600"),children:[S.change>=0?"+":"",S.change,"%"]})]})})]})},S.id))}),e.jsx(fa,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:a("common:loading")})})})]}),e.jsxs(Ye,{children:[e.jsx(ss,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(_s,{className:"flex items-center text-base font-medium",children:[e.jsx(Qa,{className:"mr-2 h-4 w-4"}),a("dashboard:trafficRank.userTrafficRank")]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(Gn,{selectedRange:r,customDateRange:u,onRangeChange:c,onCustomRangeChange:i}),e.jsx(zn,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(ts,{className:"flex-1",children:k?.data?e.jsxs(Nt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:k.data.map(S=>e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{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:S.name}),e.jsxs("span",{className:y("ml-2 flex items-center text-xs font-medium",S.change>=0?"text-green-600":"text-red-600"),children:[S.change>=0?e.jsx(Xa,{className:"mr-1 h-3 w-3"}):e.jsx(Za,{className:"mr-1 h-3 w-3"}),Math.abs(S.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:`${S.value/k.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:xt(S.value)})]})]})})}),e.jsx(de,{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.jsxs("span",{className:"text-muted-foreground",children:[a("dashboard:trafficRank.currentTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:xt(S.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[a("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:xt(S.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[a("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:y("font-medium",S.change>=0?"text-green-600":"text-red-600"),children:[S.change>=0?"+":"",S.change,"%"]})]})})]})},S.id))}),e.jsx(fa,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:a("common:loading")})})})]})]})}const Wd=Zs("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 B({className:s,variant:a,...t}){return e.jsx("div",{className:y(Wd({variant:a}),s),...t})}const ra=m.forwardRef(({className:s,value:a,...t},l)=>e.jsx($l,{ref:l,className:y("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...t,children:e.jsx(Wo,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(a||0)}%)`}})}));ra.displayName=$l.displayName;const bn=m.forwardRef(({className:s,...a},t)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:t,className:y("w-full caption-bottom text-sm",s),...a})}));bn.displayName="Table";const yn=m.forwardRef(({className:s,...a},t)=>e.jsx("thead",{ref:t,className:y("[&_tr]:border-b",s),...a}));yn.displayName="TableHeader";const Nn=m.forwardRef(({className:s,...a},t)=>e.jsx("tbody",{ref:t,className:y("[&_tr:last-child]:border-0",s),...a}));Nn.displayName="TableBody";const Yd=m.forwardRef(({className:s,...a},t)=>e.jsx("tfoot",{ref:t,className:y("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a}));Yd.displayName="TableFooter";const As=m.forwardRef(({className:s,...a},t)=>e.jsx("tr",{ref:t,className:y("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a}));As.displayName="TableRow";const _n=m.forwardRef(({className:s,...a},t)=>e.jsx("th",{ref:t,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),...a}));_n.displayName="TableHead";const jt=m.forwardRef(({className:s,...a},t)=>e.jsx("td",{ref:t,className:y("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a}));jt.displayName="TableCell";const Jd=m.forwardRef(({className:s,...a},t)=>e.jsx("caption",{ref:t,className:y("mt-4 text-sm text-muted-foreground",s),...a}));Jd.displayName="TableCaption";function wn({table:s}){const[a,t]=m.useState(""),{t:l}=V("common");m.useEffect(()=>{t((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const n=o=>{const r=parseInt(o);!isNaN(r)&&r>=1&&r<=s.getPageCount()?s.setPageIndex(r-1):t((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.jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:l("table.pagination.selected",{selected:s.getFilteredSelectedRowModel().rows.length,total: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:l("table.pagination.itemsPerPage")}),e.jsxs(X,{value:`${s.getState().pagination.pageSize}`,onValueChange:o=>{s.setPageSize(Number(o))},children:[e.jsx(Y,{className:"h-8 w-[70px]",children:e.jsx(Z,{placeholder:s.getState().pagination.pageSize})}),e.jsx(J,{side:"top",children:[10,20,30,40,50,100,500].map(o=>e.jsx($,{value:`${o}`,children:o},o))})]})]}),e.jsxs("div",{className:"flex items-center justify-center space-x-2 text-sm font-medium",children:[e.jsx("span",{children:l("table.pagination.page")}),e.jsx(D,{type:"text",value:a,onChange:o=>t(o.target.value),onBlur:o=>n(o.target.value),onKeyDown:o=>{o.key==="Enter"&&n(o.currentTarget.value)},className:"h-8 w-[50px] text-center"}),e.jsx("span",{children:l("table.pagination.pageOf",{total:s.getPageCount()})})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(E,{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:l("table.pagination.firstPage")}),e.jsx(Yo,{className:"h-4 w-4"})]}),e.jsxs(E,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.previousPage(),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:l("table.pagination.previousPage")}),e.jsx(Fl,{className:"h-4 w-4"})]}),e.jsxs(E,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.nextPage(),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:l("table.pagination.nextPage")}),e.jsx(un,{className:"h-4 w-4"})]}),e.jsxs(E,{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:l("table.pagination.lastPage")}),e.jsx(Jo,{className:"h-4 w-4"})]})]})]})]})}function is({table:s,toolbar:a,draggable:t=!1,onDragStart:l,onDragEnd:n,onDragOver:o,onDragLeave:r,onDrop:c,showPagination:u=!0,isLoading:i=!1}){const{t:d}=V("common"),h=m.useRef(null),_=s.getAllColumns().filter(N=>N.getIsPinned()==="left"),k=s.getAllColumns().filter(N=>N.getIsPinned()==="right"),S=N=>_.slice(0,N).reduce((g,T)=>g+(T.getSize()??0),0),C=N=>k.slice(N+1).reduce((g,T)=>g+(T.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof a=="function"?a(s):a,e.jsx("div",{ref:h,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs(bn,{children:[e.jsx(yn,{children:s.getHeaderGroups().map(N=>e.jsx(As,{className:"hover:bg-transparent",children:N.headers.map((g,T)=>{const R=g.column.getIsPinned()==="left",p=g.column.getIsPinned()==="right",w=R?S(_.indexOf(g.column)):void 0,I=p?C(k.indexOf(g.column)):void 0;return e.jsx(_n,{colSpan:g.colSpan,style:{width:g.getSize(),...R&&{left:w},...p&&{right:I}},className:y("h-11 bg-card px-4 text-muted-foreground",(R||p)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",R&&"before:right-0",p&&"before:left-0"]),children:g.isPlaceholder?null:da(g.column.columnDef.header,g.getContext())},g.id)})},N.id))}),e.jsx(Nn,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((N,g)=>e.jsx(As,{"data-state":N.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:t,onDragStart:T=>l?.(T,g),onDragEnd:n,onDragOver:o,onDragLeave:r,onDrop:T=>c?.(T,g),children:N.getVisibleCells().map((T,R)=>{const p=T.column.getIsPinned()==="left",w=T.column.getIsPinned()==="right",I=p?S(_.indexOf(T.column)):void 0,H=w?C(k.indexOf(T.column)):void 0;return e.jsx(jt,{style:{width:T.column.getSize(),...p&&{left:I},...w&&{right:H}},className:y("bg-card",(p||w)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",p&&"before:right-0",w&&"before:left-0"]),children:da(T.column.columnDef.cell,T.getContext())},T.id)})},N.id)):e.jsx(As,{children:e.jsx(jt,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:d("table.noData")})})})]})})}),u&&e.jsx(wn,{table:s})]})}const ia=s=>{if(!s)return"";let a;if(typeof s=="string"){if(a=parseInt(s),isNaN(a))return s}else a=s;return(a.toString().length===10?new Date(a*1e3):new Date(a)).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})},Rt=Al(),It=Al();function sa({data:s,isLoading:a,searchKeyword:t,selectedLevel:l,total:n,currentPage:o,pageSize:r,onViewDetail:c,onPageChange:u}){const{t:i}=V(),d=k=>{switch(k.toLowerCase()){case"info":return e.jsx(Ft,{className:"h-4 w-4 text-blue-500"});case"warning":return e.jsx(sn,{className:"h-4 w-4 text-yellow-500"});case"error":return e.jsx(tn,{className:"h-4 w-4 text-red-500"});default:return e.jsx(Ft,{className:"h-4 w-4 text-slate-500"})}},h=m.useMemo(()=>[Rt.accessor("level",{id:"level",header:()=>i("dashboard:systemLog.level","级别"),size:80,cell:({getValue:k,row:S})=>{const C=k();return e.jsxs("div",{className:"flex items-center gap-1",children:[d(C),e.jsx("span",{className:y(C.toLowerCase()==="error"&&"text-red-600",C.toLowerCase()==="warning"&&"text-yellow-600",C.toLowerCase()==="info"&&"text-blue-600"),children:C})]})}}),Rt.accessor("created_at",{id:"created_at",header:()=>i("dashboard:systemLog.time","时间"),size:160,cell:({getValue:k})=>ia(k())}),Rt.accessor(k=>k.title||k.message||"",{id:"title",header:()=>i("dashboard:systemLog.logTitle","标题"),cell:({getValue:k})=>e.jsx("span",{className:"inline-block max-w-[300px] truncate",children:k()})}),Rt.accessor("method",{id:"method",header:()=>i("dashboard:systemLog.method","请求方法"),size:100,cell:({getValue:k})=>{const S=k();return S?e.jsx(B,{variant:"outline",className:y(S==="GET"&&"border-blue-200 bg-blue-50 text-blue-700",S==="POST"&&"border-green-200 bg-green-50 text-green-700",S==="PUT"&&"border-amber-200 bg-amber-50 text-amber-700",S==="DELETE"&&"border-red-200 bg-red-50 text-red-700"),children:S}):null}}),Rt.display({id:"actions",header:()=>i("dashboard:systemLog.action","操作"),size:80,cell:({row:k})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>c(k.original),"aria-label":i("dashboard:systemLog.viewDetail","查看详情"),children:e.jsx(en,{className:"h-4 w-4"})})})],[i,c]),_=Je({data:s,columns:h,getCoreRowModel:Qe(),getPaginationRowModel:ls(),pageCount:Math.ceil(n/r),manualPagination:!0,state:{pagination:{pageIndex:o-1,pageSize:r}},onPaginationChange:k=>{if(typeof k=="function"){const S=k({pageIndex:o-1,pageSize:r});u(S.pageIndex+1)}else u(k.pageIndex+1)}});return e.jsxs("div",{className:"overflow-x-auto",children:[e.jsx(is,{table:_,showPagination:!1,isLoading:a}),e.jsx(wn,{table:_}),(t||l&&l!=="all")&&e.jsx("div",{className:"text-center text-sm text-muted-foreground",children:t&&l&&l!=="all"?i("dashboard:systemLog.filter.searchAndLevel",{keyword:t,level:l,count:n},`筛选结果: 包含"${t}"且级别为"${l}"的日志共 ${n} 条`):t?i("dashboard:systemLog.filter.searchOnly",{keyword:t,count:n},`搜索结果: 包含"${t}"的日志共 ${n} 条`):i("dashboard:systemLog.filter.levelOnly",{level:l,count:n},`筛选结果: 级别为"${l}"的日志共 ${n} 条`)})]})}function Qd(){const{t:s}=V(),[a,t]=m.useState(0),[l,n]=m.useState(!1),[o,r]=m.useState(1),[c]=m.useState(10),[u,i]=m.useState(null),[d,h]=m.useState(!1),[_,k]=m.useState(!1),[S,C]=m.useState(1),[N]=m.useState(10),[g,T]=m.useState(null),[R,p]=m.useState(!1),[w,I]=m.useState(""),[H,O]=m.useState(""),[K,oe]=m.useState("all");m.useEffect(()=>{const Q=setTimeout(()=>{O(w),w!==H&&C(1)},500);return()=>clearTimeout(Q)},[w]);const{data:W,isLoading:te,refetch:q,isRefetching:L}=ne({queryKey:["systemStatus",a],queryFn:async()=>(await me.getSystemStatus()).data,refetchInterval:3e4}),{data:U,isLoading:ms,refetch:De,isRefetching:le}=ne({queryKey:["queueStats",a],queryFn:async()=>(await me.getQueueStats()).data,refetchInterval:3e4}),{data:ys,isLoading:Fs,refetch:Fa}=ne({queryKey:["failedJobs",o,c],queryFn:async()=>{const Q=await me.getHorizonFailedJobs({current:o,page_size:c});return{data:Q.data,total:Q.total||0}},enabled:l}),{data:Gt,isLoading:it,refetch:Ma}=ne({queryKey:["systemLogs",S,N,K,H],queryFn:async()=>{const Q={current:S,page_size:N};K&&K!=="all"&&(Q.level=K),H.trim()&&(Q.keyword=H.trim());const Os=await me.getSystemLog(Q);return{data:Os.data,total:Os.total||0}},enabled:_}),Wt=ys?.data||[],Oa=ys?.total||0,se=Gt?.data||[],ie=Gt?.total||0,Me=m.useMemo(()=>[It.display({id:"failed_at",header:()=>s("dashboard:queue.details.time","时间"),cell:({row:Q})=>ia(Q.original.failed_at)}),It.display({id:"queue",header:()=>s("dashboard:queue.details.queue","队列"),cell:({row:Q})=>Q.original.queue}),It.display({id:"name",header:()=>s("dashboard:queue.details.name","任务名称"),cell:({row:Q})=>e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("span",{className:"inline-block max-w-[150px] truncate",children:Q.original.name})}),e.jsx(de,{children:e.jsx("span",{children:Q.original.name})})]})})}),It.display({id:"exception",header:()=>s("dashboard:queue.details.exception","异常信息"),cell:({row:Q})=>e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("span",{className:"inline-block max-w-[200px] truncate",children:Q.original.exception.split(` +`)[0]})}),e.jsx(de,{className:"max-w-[300px] whitespace-pre-wrap",children:e.jsx("span",{children:Q.original.exception})})]})})}),It.display({id:"actions",header:()=>s("dashboard:queue.details.action","操作"),size:80,cell:({row:Q})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>li(Q.original),"aria-label":s("dashboard:queue.details.viewDetail","查看详情"),children:e.jsx(en,{className:"h-4 w-4"})})})],[s]),Ms=Je({data:Wt,columns:Me,getCoreRowModel:Qe(),getPaginationRowModel:ls(),pageCount:Math.ceil(Oa/c),manualPagination:!0,state:{pagination:{pageIndex:o-1,pageSize:c}},onPaginationChange:Q=>{if(typeof Q=="function"){const Os=Q({pageIndex:o-1,pageSize:c});Ln(Os.pageIndex+1)}else Ln(Q.pageIndex+1)}}),ti=()=>{t(Q=>Q+1)},Ln=Q=>{r(Q)},Yt=Q=>{C(Q)},ai=Q=>{oe(Q),C(1)},ni=()=>{I(""),O(""),oe("all"),C(1)},Jt=Q=>{T(Q),p(!0)},li=Q=>{i(Q),h(!0)};if(te||ms)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(gn,{className:"h-6 w-6 animate-spin"})});const ri=Q=>Q?e.jsx(ql,{className:"h-5 w-5 text-green-500"}):e.jsx(Hl,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ye,{children:[e.jsxs(ss,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(_s,{className:"flex items-center gap-2",children:[e.jsx(Qo,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Xs,{children:s("dashboard:queue.status.description")})]}),e.jsx(G,{variant:"outline",size:"icon",onClick:ti,disabled:L||le,children:e.jsx(za,{className:y("h-4 w-4",(L||le)&&"animate-spin")})})]}),e.jsx(ts,{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:[ri(U?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(B,{variant:U?.status?"secondary":"destructive",children:U?.status?s("dashboard:queue.status.normal"):s("dashboard:queue.status.abnormal")})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.status.waitTime",{seconds:U?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.recentJobs")}),e.jsx("p",{className:"text-2xl font-bold",children:U?.recentJobs||0}),e.jsx(ra,{value:(U?.recentJobs||0)/(U?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(de,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:U?.periods?.recentJobs||0})})})]})}),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.jobsPerMinute")}),e.jsx("p",{className:"text-2xl font-bold",children:U?.jobsPerMinute||0}),e.jsx(ra,{value:(U?.jobsPerMinute||0)/(U?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(de,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:U?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(Ye,{children:[e.jsxs(ss,{children:[e.jsxs(_s,{className:"flex items-center gap-2",children:[e.jsx(Xo,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Xs,{children:s("dashboard:queue.details.description")})]}),e.jsx(ts,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.failedJobs7Days")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"cursor-pointer text-2xl font-bold text-destructive hover:underline",title:s("dashboard:queue.details.viewFailedJobs"),onClick:()=>n(!0),style:{userSelect:"none"},children:U?.failedJobs||0}),e.jsx(en,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-destructive",onClick:()=>n(!0),"aria-label":s("dashboard:queue.details.viewFailedJobs")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("dashboard:queue.details.retentionPeriod",{hours:U?.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:s("dashboard:queue.details.longestRunningQueue")}),e.jsxs("p",{className:"text-2xl font-bold",children:[U?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:U?.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:s("dashboard:queue.details.activeProcesses")}),e.jsxs("span",{className:"font-medium",children:[U?.processes||0," /"," ",(U?.processes||0)+(U?.pausedMasters||0)]})]}),e.jsx(ra,{value:(U?.processes||0)/((U?.processes||0)+(U?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]}),e.jsxs(Ye,{children:[e.jsxs(ss,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(_s,{className:"flex items-center gap-2",children:[e.jsx($n,{className:"h-5 w-5"}),s("dashboard:systemLog.title","系统日志")]}),e.jsx(Xs,{children:s("dashboard:systemLog.description","查看系统运行日志记录")})]}),e.jsx(G,{variant:"outline",onClick:()=>k(!0),children:s("dashboard:systemLog.viewAll","查看全部")})]}),e.jsx(ts,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-900 dark:bg-blue-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ft,{className:"h-5 w-5 text-blue-500"}),e.jsx("p",{className:"font-medium text-blue-700 dark:text-blue-300",children:s("dashboard:systemLog.tabs.info","信息")})]}),e.jsx("p",{className:"text-2xl font-bold text-blue-700 dark:text-blue-300",children:W?.logs?.info||0})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-900 dark:bg-yellow-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(sn,{className:"h-5 w-5 text-yellow-500"}),e.jsx("p",{className:"font-medium text-yellow-700 dark:text-yellow-300",children:s("dashboard:systemLog.tabs.warning","警告")})]}),e.jsx("p",{className:"text-2xl font-bold text-yellow-700 dark:text-yellow-300",children:W?.logs?.warning||0})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-900 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tn,{className:"h-5 w-5 text-red-500"}),e.jsx("p",{className:"font-medium text-red-700 dark:text-red-300",children:s("dashboard:systemLog.tabs.error","错误")})]}),e.jsx("p",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:W?.logs?.error||0})]})]}),W?.logs&&W.logs.total>0&&e.jsx("div",{className:"mt-3 text-center text-sm text-muted-foreground",children:s("dashboard:systemLog.totalLogs","总日志数:{{count}}",{count:W.logs.total})})]})})]}),e.jsx(pe,{open:l,onOpenChange:n,children:e.jsxs(ue,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(ve,{children:e.jsx(ge,{children:s("dashboard:queue.details.failedJobsDetailTitle","失败任务详情")})}),e.jsxs("div",{className:"overflow-x-auto",children:[e.jsx(is,{table:Ms,showPagination:!1,isLoading:Fs}),e.jsx(wn,{table:Ms}),Wt.length===0&&e.jsx("div",{className:"py-8 text-center text-muted-foreground",children:s("dashboard:queue.details.noFailedJobs","暂无失败任务")})]}),e.jsxs(Re,{children:[e.jsxs(G,{variant:"outline",onClick:()=>Fa(),children:[e.jsx(za,{className:"mr-2 h-4 w-4"}),s("dashboard:common.refresh","刷新")]}),e.jsx(qs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common.close","关闭")})})]})]})}),e.jsx(pe,{open:d,onOpenChange:h,children:e.jsxs(ue,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(ve,{children:e.jsx(ge,{children:s("dashboard:queue.details.jobDetailTitle","任务详情")})}),u&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.id","任务ID")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:u.id})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.time","时间")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:u.failed_at})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.queue","队列")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:u.queue})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.connection","连接")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:u.connection})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.name","任务名称")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:u.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.exception","异常信息")}),e.jsx("div",{className:"max-h-[200px] overflow-y-auto rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-700 dark:text-red-300",children:u.exception})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.payload","任务数据")}),e.jsx("div",{className:"max-h-[200px] overflow-y-auto rounded-md bg-muted/50 p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs",children:(()=>{try{return JSON.stringify(JSON.parse(u.payload),null,2)}catch{return u.payload}})()})})]})]}),e.jsx(Re,{children:e.jsx(G,{variant:"outline",onClick:()=>h(!1),children:s("common.close","关闭")})})]})}),e.jsx(pe,{open:_,onOpenChange:k,children:e.jsxs(ue,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(ve,{children:e.jsx(ge,{children:s("dashboard:systemLog.title","系统日志")})}),e.jsxs(Bt,{value:K,onValueChange:ai,className:"w-full overflow-x-auto",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-2 p-1 md:flex-row md:items-center md:justify-between",children:[e.jsxs(Ct,{className:"grid w-auto grid-cols-4",children:[e.jsxs(Ee,{value:"all",className:"flex items-center gap-2",children:[e.jsx($n,{className:"h-4 w-4"}),s("dashboard:systemLog.tabs.all","全部")]}),e.jsxs(Ee,{value:"info",className:"flex items-center gap-2",children:[e.jsx(Ft,{className:"h-4 w-4 text-blue-500"}),s("dashboard:systemLog.tabs.info","信息")]}),e.jsxs(Ee,{value:"warning",className:"flex items-center gap-2",children:[e.jsx(sn,{className:"h-4 w-4 text-yellow-500"}),s("dashboard:systemLog.tabs.warning","警告")]}),e.jsxs(Ee,{value:"error",className:"flex items-center gap-2",children:[e.jsx(tn,{className:"h-4 w-4 text-red-500"}),s("dashboard:systemLog.tabs.error","错误")]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(hn,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(D,{placeholder:s("dashboard:systemLog.search","搜索日志内容..."),value:w,onChange:Q=>I(Q.target.value),className:"w-full md:w-64"})]})]}),e.jsx(We,{value:"all",className:"mt-0",children:e.jsx(sa,{data:se,isLoading:it,searchKeyword:H,selectedLevel:K,total:ie,currentPage:S,pageSize:N,onViewDetail:Jt,onPageChange:Yt})}),e.jsx(We,{value:"info",className:"mt-0 overflow-x-auto",children:e.jsx(sa,{data:se,isLoading:it,searchKeyword:H,selectedLevel:K,total:ie,currentPage:S,pageSize:N,onViewDetail:Jt,onPageChange:Yt})}),e.jsx(We,{value:"warning",className:"mt-0",children:e.jsx(sa,{data:se,isLoading:it,searchKeyword:H,selectedLevel:K,total:ie,currentPage:S,pageSize:N,onViewDetail:Jt,onPageChange:Yt})}),e.jsx(We,{value:"error",className:"mt-0",children:e.jsx(sa,{data:se,isLoading:it,searchKeyword:H,selectedLevel:K,total:ie,currentPage:S,pageSize:N,onViewDetail:Jt,onPageChange:Yt})})]}),e.jsxs(Re,{children:[e.jsxs(G,{variant:"outline",onClick:()=>Ma(),children:[e.jsx(za,{className:"mr-2 h-4 w-4"}),s("dashboard:common.refresh","刷新")]}),e.jsx(G,{variant:"outline",onClick:ni,children:s("dashboard:systemLog.filter.reset","重置筛选")}),e.jsx(qs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common.close","关闭")})})]})]})}),e.jsx(pe,{open:R,onOpenChange:p,children:e.jsxs(ue,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(ve,{children:e.jsx(ge,{children:s("dashboard:systemLog.detailTitle","日志详情")})}),g&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.level","级别")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ft,{className:"h-4 w-4"}),e.jsx("p",{className:"font-medium",children:g.level})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.time","时间")}),e.jsx("p",{children:ia(g.created_at)||ia(g.updated_at)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.logTitle","标题")}),e.jsx("div",{className:"whitespace-pre-wrap rounded-md bg-muted/50 p-3",children:g.title||g.message||""})]}),(g.host||g.ip)&&e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[g.host&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.host","主机")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:g.host})]}),g.ip&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.ip","IP地址")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:g.ip})]})]}),g.uri&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.uri","URI")}),e.jsx("div",{className:"overflow-x-auto rounded-md bg-muted/50 p-3",children:e.jsx("code",{className:"text-sm",children:g.uri})})]}),g.method&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.method","请求方法")}),e.jsx("div",{children:e.jsx(B,{variant:"outline",className:"text-base font-medium",children:g.method})})]}),g.data&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.requestData","请求数据")}),e.jsx("div",{className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/50 p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs",children:(()=>{try{return JSON.stringify(JSON.parse(g.data),null,2)}catch{return g.data}})()})})]}),g.context&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.exception","异常信息")}),e.jsx("div",{className:"max-h-[250px] overflow-y-auto rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs text-red-700 dark:text-red-300",children:(()=>{try{const Q=JSON.parse(g.context);if(Q.exception){const Os=Q.exception,ii=Os["\0*\0message"]||"",oi=Os["\0*\0file"]||"",ci=Os["\0*\0line"]||"";return`${ii} -File: ${Jl} -Line: ${Ql}`}return JSON.stringify(K,null,2)}catch{return p.context}})()})})]})]}),e.jsx(Pe,{children:e.jsx(qs,{asChild:!0,children:e.jsx(B,{variant:"outline",children:s("common.close","关闭")})})})]})})]})}function zd(){const{t:s}=V();return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("dashboard:title")})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ye,{}),e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Id,{}),e.jsx(Td,{}),e.jsx(Ld,{}),e.jsx(Md,{})]})})})]})}const Ad=Object.freeze(Object.defineProperty({__proto__:null,default:zd},Symbol.toStringTag,{value:"Module"}));function $d({className:s,items:n,...t}){const{pathname:r}=ln(),a=Vs(),[l,i]=m.useState(r??"/settings"),c=o=>{i(o),a(o)},{t:u}=V("settings");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(J,{value:l,onValueChange:c,children:[e.jsx(W,{className:"h-12 sm:w-48",children:e.jsx(Q,{placeholder:"Theme"})}),e.jsx(Y,{children:n.map(o=>e.jsx(A,{value:o.href,children:e.jsxs("div",{className:"flex gap-x-4 px-2 py-1",children:[e.jsx("span",{className:"scale-125",children:o.icon}),e.jsx("span",{className:"text-md",children:u(o.title)})]})},o.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),...t,children:n.map(o=>e.jsxs(st,{to:o.href,className:y(wt({variant:"ghost"}),r===o.href?"bg-muted hover:bg-muted":"hover:bg-transparent hover:underline","justify-start"),children:[e.jsx("span",{className:"mr-2",children:o.icon}),u(o.title)]},o.href))})})]})}const qd=[{title:"site.title",key:"site",icon:e.jsx(Ao,{size:18}),href:"/config/system",description:"site.description"},{title:"safe.title",key:"safe",icon:e.jsx(fr,{size:18}),href:"/config/system/safe",description:"safe.description"},{title:"subscribe.title",key:"subscribe",icon:e.jsx(jr,{size:18}),href:"/config/system/subscribe",description:"subscribe.description"},{title:"invite.title",key:"invite",icon:e.jsx($o,{size:18}),href:"/config/system/invite",description:"invite.description"},{title:"server.title",key:"server",icon:e.jsx(gr,{size:18}),href:"/config/system/server",description:"server.description"},{title:"email.title",key:"email",icon:e.jsx(qo,{size:18}),href:"/config/system/email",description:"email.description"},{title:"telegram.title",key:"telegram",icon:e.jsx(Ho,{size:18}),href:"/config/system/telegram",description:"telegram.description"},{title:"app.title",key:"app",icon:e.jsx(pr,{size:18}),href:"/config/system/app",description:"app.description"},{title:"subscribe_template.title",key:"subscribe_template",icon:e.jsx(Uo,{size:18}),href:"/config/system/subscribe-template",description:"subscribe_template.description"}];function Hd(){const{t:s}=V("settings");return e.jsxs(Ve,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")}),e.jsx("div",{className:"text-muted-foreground",children:s("description")})]}),e.jsx(ke,{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($d,{items:qd})}),e.jsx("div",{className:"flex-1 w-full p-1 pr-4",children:e.jsx("div",{className:"pb-16",children:e.jsx(on,{})})})]})]})]})}const Ud=Object.freeze(Object.defineProperty({__proto__:null,default:Hd},Symbol.toStringTag,{value:"Module"})),Z=m.forwardRef(({className:s,...n},t)=>e.jsx(Fr,{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),...n,ref:t,children:e.jsx(Ko,{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")})}));Z.displayName=Fr.displayName;const Ds=m.forwardRef(({className:s,...n},t)=>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:t,...n}));Ds.displayName="Textarea";const Kd=x.object({logo:x.string().nullable().default(""),force_https:x.number().nullable().default(0),stop_register:x.number().nullable().default(0),app_name:x.string().nullable().default(""),app_description:x.string().nullable().default(""),app_url:x.string().nullable().default(""),subscribe_url:x.string().nullable().default(""),try_out_plan_id:x.number().nullable().default(0),try_out_hour:x.coerce.number().nullable().default(0),tos_url:x.string().nullable().default(""),currency:x.string().nullable().default(""),currency_symbol:x.string().nullable().default("")});function Bd(){const{t:s}=V("settings"),[n,t]=m.useState(!1),r=m.useRef(null),{data:a}=ne({queryKey:["settings","site"],queryFn:()=>me.getSettings("site")}),{data:l}=ne({queryKey:["plans"],queryFn:()=>Xe.getList()}),i=ye({resolver:_e(Kd),defaultValues:{},mode:"onBlur"}),{mutateAsync:c}=hs({mutationFn:me.saveSettings,onSuccess:d=>{d.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(a?.data?.site){const d=a?.data?.site;Object.entries(d).forEach(([h,w])=>{i.setValue(h,w)}),r.current=d}},[a]);const u=m.useCallback(Se.debounce(async d=>{if(!Se.isEqual(d,r.current)){t(!0);try{const h=Object.entries(d).reduce((w,[P,k])=>(w[P]=k===null?"":k,w),{});await c(h),r.current=d}finally{t(!1)}}},1e3),[c]),o=m.useCallback(d=>{u(d)},[u]);return m.useEffect(()=>{const d=i.watch(h=>{o(h)});return()=>d.unsubscribe()},[i.watch,o]),e.jsx(we,{...i,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:i.control,name:"app_name",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.siteName.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("site.form.siteName.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),o(i.getValues())}})}),e.jsx(F,{children:s("site.form.siteName.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"app_description",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.siteDescription.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("site.form.siteDescription.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),o(i.getValues())}})}),e.jsx(F,{children:s("site.form.siteDescription.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"app_url",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.siteUrl.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("site.form.siteUrl.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),o(i.getValues())}})}),e.jsx(F,{children:s("site.form.siteUrl.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"force_https",render:({field:d})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("site.form.forceHttps.label")}),e.jsx(F,{children:s("site.form.forceHttps.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:!!d.value,onCheckedChange:h=>{d.onChange(Number(h)),o(i.getValues())}})})]})}),e.jsx(v,{control:i.control,name:"logo",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.logo.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("site.form.logo.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),o(i.getValues())}})}),e.jsx(F,{children:s("site.form.logo.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"subscribe_url",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.subscribeUrl.label")}),e.jsx(b,{children:e.jsx(Ds,{placeholder:s("site.form.subscribeUrl.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),o(i.getValues())}})}),e.jsx(F,{children:s("site.form.subscribeUrl.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"tos_url",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.tosUrl.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("site.form.tosUrl.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),o(i.getValues())}})}),e.jsx(F,{children:s("site.form.tosUrl.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"stop_register",render:({field:d})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("site.form.stopRegister.label")}),e.jsx(F,{children:s("site.form.stopRegister.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:!!d.value,onCheckedChange:h=>{d.onChange(Number(h)),o(i.getValues())}})})]})}),e.jsx(v,{control:i.control,name:"try_out_plan_id",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.tryOut.label")}),e.jsx(b,{children:e.jsxs(J,{value:d.value?.toString(),onValueChange:h=>{d.onChange(Number(h)),o(i.getValues())},children:[e.jsx(W,{children:e.jsx(Q,{placeholder:s("site.form.tryOut.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("site.form.tryOut.placeholder")}),l?.data?.map(h=>e.jsx(A,{value:h.id.toString(),children:h.name},h.id.toString()))]})]})}),e.jsx(F,{children:s("site.form.tryOut.description")}),e.jsx(D,{})]})}),!!i.watch("try_out_plan_id")&&e.jsx(v,{control:i.control,name:"try_out_hour",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"",children:s("site.form.tryOut.duration.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("site.form.tryOut.duration.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),o(i.getValues())}})}),e.jsx(F,{children:s("site.form.tryOut.duration.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"currency",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.currency.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("site.form.currency.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),o(i.getValues())}})}),e.jsx(F,{children:s("site.form.currency.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:i.control,name:"currency_symbol",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.currencySymbol.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("site.form.currencySymbol.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),o(i.getValues())}})}),e.jsx(F,{children:s("site.form.currencySymbol.description")}),e.jsx(D,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("site.form.saving")})]})})}function Gd(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("site.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("site.description")})]}),e.jsx(ke,{}),e.jsx(Bd,{})]})}const Wd=Object.freeze(Object.defineProperty({__proto__:null,default:Gd},Symbol.toStringTag,{value:"Module"})),Yd=x.object({email_verify:x.boolean().nullable(),safe_mode_enable:x.boolean().nullable(),secure_path:x.string().nullable(),email_whitelist_enable:x.boolean().nullable(),email_whitelist_suffix:x.array(x.string().nullable()).nullable(),email_gmail_limit_enable:x.boolean().nullable(),recaptcha_enable:x.boolean().nullable(),recaptcha_key:x.string().nullable(),recaptcha_site_key:x.string().nullable(),register_limit_by_ip_enable:x.boolean().nullable(),register_limit_count:x.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:x.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:x.boolean().nullable(),password_limit_count:x.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:x.coerce.string().transform(s=>s===""?null:s).nullable()}),Jd={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 Qd(){const{t:s}=V("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=ye({resolver:_e(Yd),defaultValues:Jd,mode:"onBlur"}),{data:l}=ne({queryKey:["settings","safe"],queryFn:()=>me.getSettings("safe")}),{mutateAsync:i}=hs({mutationFn:me.saveSettings,onSuccess:o=>{o.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(l?.data.safe){const o=l.data.safe;Object.entries(o).forEach(([d,h])=>{typeof h=="number"?a.setValue(d,String(h)):a.setValue(d,h)}),r.current=o}},[l]);const c=m.useCallback(Se.debounce(async o=>{if(!Se.isEqual(o,r.current)){t(!0);try{await i(o),r.current=o}finally{t(!1)}}},1e3),[i]),u=m.useCallback(o=>{c(o)},[c]);return m.useEffect(()=>{const o=a.watch(d=>{u(d)});return()=>o.unsubscribe()},[a.watch,u]),e.jsx(we,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:a.control,name:"email_verify",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.emailVerify.label")}),e.jsx(F,{children:s("safe.form.emailVerify.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"email_gmail_limit_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.gmailLimit.label")}),e.jsx(F,{children:s("safe.form.gmailLimit.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"safe_mode_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.safeMode.label")}),e.jsx(F,{children:s("safe.form.safeMode.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"secure_path",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.securePath.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("safe.form.securePath.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsx(F,{children:s("safe.form.securePath.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"email_whitelist_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.emailWhitelist.label")}),e.jsx(F,{children:s("safe.form.emailWhitelist.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),a.watch("email_whitelist_enable")&&e.jsx(v,{control:a.control,name:"email_whitelist_suffix",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.emailWhitelist.suffixes.label")}),e.jsx(b,{children:e.jsx(Ds,{placeholder:s("safe.form.emailWhitelist.suffixes.placeholder"),...o,value:(o.value||[]).join(` +File: ${oi} +Line: ${ci}`}return JSON.stringify(Q,null,2)}catch{return g.context}})()})})]})]}),e.jsx(Re,{children:e.jsx(qs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common.close","关闭")})})})]})})]})}function Xd(){const{t:s}=V();return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("dashboard:title")})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Xe,{}),e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Bd,{}),e.jsx(Ad,{}),e.jsx(Gd,{}),e.jsx(Qd,{})]})})})]})}const Zd=Object.freeze(Object.defineProperty({__proto__:null,default:Xd},Symbol.toStringTag,{value:"Module"}));function em({className:s,items:a,...t}){const{pathname:l}=cn(),n=Is(),[o,r]=m.useState(l??"/settings"),c=i=>{r(i),n(i)},{t:u}=V("settings");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(X,{value:o,onValueChange:c,children:[e.jsx(Y,{className:"h-12 sm:w-48",children:e.jsx(Z,{placeholder:"Theme"})}),e.jsx(J,{children:a.map(i=>e.jsx($,{value:i.href,children:e.jsxs("div",{className:"flex gap-x-4 px-2 py-1",children:[e.jsx("span",{className:"scale-125",children:i.icon}),e.jsx("span",{className:"text-md",children:u(i.title)})]})},i.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),...t,children:a.map(i=>e.jsxs(st,{to:i.href,className:y(wt({variant:"ghost"}),l===i.href?"bg-muted hover:bg-muted":"hover:bg-transparent hover:underline","justify-start"),children:[e.jsx("span",{className:"mr-2",children:i.icon}),u(i.title)]},i.href))})})]})}const sm=[{title:"site.title",key:"site",icon:e.jsx(Zo,{size:18}),href:"/config/system",description:"site.description"},{title:"safe.title",key:"safe",icon:e.jsx(wl,{size:18}),href:"/config/system/safe",description:"safe.description"},{title:"subscribe.title",key:"subscribe",icon:e.jsx(Cl,{size:18}),href:"/config/system/subscribe",description:"subscribe.description"},{title:"invite.title",key:"invite",icon:e.jsx(ec,{size:18}),href:"/config/system/invite",description:"invite.description"},{title:"server.title",key:"server",icon:e.jsx(_l,{size:18}),href:"/config/system/server",description:"server.description"},{title:"email.title",key:"email",icon:e.jsx(sc,{size:18}),href:"/config/system/email",description:"email.description"},{title:"telegram.title",key:"telegram",icon:e.jsx(tc,{size:18}),href:"/config/system/telegram",description:"telegram.description"},{title:"app.title",key:"app",icon:e.jsx(Nl,{size:18}),href:"/config/system/app",description:"app.description"},{title:"subscribe_template.title",key:"subscribe_template",icon:e.jsx(ac,{size:18}),href:"/config/system/subscribe-template",description:"subscribe_template.description"}];function tm(){const{t:s}=V("settings");return e.jsxs(Ve,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")}),e.jsx("div",{className:"text-muted-foreground",children:s("description")})]}),e.jsx(ke,{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(em,{items:sm})}),e.jsx("div",{className:"flex-1 w-full p-1 pr-4",children:e.jsx("div",{className:"pb-16",children:e.jsx(dn,{})})})]})]})]})}const am=Object.freeze(Object.defineProperty({__proto__:null,default:tm},Symbol.toStringTag,{value:"Module"})),ee=m.forwardRef(({className:s,...a},t)=>e.jsx(Ul,{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),...a,ref:t,children:e.jsx(nc,{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")})}));ee.displayName=Ul.displayName;const Ts=m.forwardRef(({className:s,...a},t)=>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:t,...a}));Ts.displayName="Textarea";const nm=x.object({logo:x.string().nullable().default(""),force_https:x.number().nullable().default(0),stop_register:x.number().nullable().default(0),app_name:x.string().nullable().default(""),app_description:x.string().nullable().default(""),app_url:x.string().nullable().default(""),subscribe_url:x.string().nullable().default(""),try_out_plan_id:x.number().nullable().default(0),try_out_hour:x.coerce.number().nullable().default(0),tos_url:x.string().nullable().default(""),currency:x.string().nullable().default(""),currency_symbol:x.string().nullable().default("")});function lm(){const{t:s}=V("settings"),[a,t]=m.useState(!1),l=m.useRef(null),{data:n}=ne({queryKey:["settings","site"],queryFn:()=>me.getSettings("site")}),{data:o}=ne({queryKey:["plans"],queryFn:()=>es.getList()}),r=ye({resolver:_e(nm),defaultValues:{},mode:"onBlur"}),{mutateAsync:c}=gs({mutationFn:me.saveSettings,onSuccess:d=>{d.data&&A.success(s("common.autoSaved"))}});m.useEffect(()=>{if(n?.data?.site){const d=n?.data?.site;Object.entries(d).forEach(([h,_])=>{r.setValue(h,_)}),l.current=d}},[n]);const u=m.useCallback(Se.debounce(async d=>{if(!Se.isEqual(d,l.current)){t(!0);try{const h=Object.entries(d).reduce((_,[k,S])=>(_[k]=S===null?"":S,_),{});await c(h),l.current=d}finally{t(!1)}}},1e3),[c]),i=m.useCallback(d=>{u(d)},[u]);return m.useEffect(()=>{const d=r.watch(h=>{i(h)});return()=>d.unsubscribe()},[r.watch,i]),e.jsx(we,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:r.control,name:"app_name",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.siteName.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.siteName.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),i(r.getValues())}})}),e.jsx(F,{children:s("site.form.siteName.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:r.control,name:"app_description",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.siteDescription.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.siteDescription.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),i(r.getValues())}})}),e.jsx(F,{children:s("site.form.siteDescription.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:r.control,name:"app_url",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.siteUrl.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.siteUrl.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),i(r.getValues())}})}),e.jsx(F,{children:s("site.form.siteUrl.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:r.control,name:"force_https",render:({field:d})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("site.form.forceHttps.label")}),e.jsx(F,{children:s("site.form.forceHttps.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:!!d.value,onCheckedChange:h=>{d.onChange(Number(h)),i(r.getValues())}})})]})}),e.jsx(v,{control:r.control,name:"logo",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.logo.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.logo.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),i(r.getValues())}})}),e.jsx(F,{children:s("site.form.logo.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:r.control,name:"subscribe_url",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.subscribeUrl.label")}),e.jsx(b,{children:e.jsx(Ts,{placeholder:s("site.form.subscribeUrl.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),i(r.getValues())}})}),e.jsx(F,{children:s("site.form.subscribeUrl.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:r.control,name:"tos_url",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.tosUrl.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.tosUrl.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),i(r.getValues())}})}),e.jsx(F,{children:s("site.form.tosUrl.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:r.control,name:"stop_register",render:({field:d})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("site.form.stopRegister.label")}),e.jsx(F,{children:s("site.form.stopRegister.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:!!d.value,onCheckedChange:h=>{d.onChange(Number(h)),i(r.getValues())}})})]})}),e.jsx(v,{control:r.control,name:"try_out_plan_id",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.tryOut.label")}),e.jsx(b,{children:e.jsxs(X,{value:d.value?.toString(),onValueChange:h=>{d.onChange(Number(h)),i(r.getValues())},children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:s("site.form.tryOut.placeholder")})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:s("site.form.tryOut.placeholder")}),o?.data?.map(h=>e.jsx($,{value:h.id.toString(),children:h.name},h.id.toString()))]})]})}),e.jsx(F,{children:s("site.form.tryOut.description")}),e.jsx(P,{})]})}),!!r.watch("try_out_plan_id")&&e.jsx(v,{control:r.control,name:"try_out_hour",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"",children:s("site.form.tryOut.duration.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.tryOut.duration.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),i(r.getValues())}})}),e.jsx(F,{children:s("site.form.tryOut.duration.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:r.control,name:"currency",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.currency.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.currency.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),i(r.getValues())}})}),e.jsx(F,{children:s("site.form.currency.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:r.control,name:"currency_symbol",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("site.form.currencySymbol.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.currencySymbol.placeholder"),...d,value:d.value||"",onChange:h=>{d.onChange(h),i(r.getValues())}})}),e.jsx(F,{children:s("site.form.currencySymbol.description")}),e.jsx(P,{})]})}),a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("site.form.saving")})]})})}function rm(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("site.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("site.description")})]}),e.jsx(ke,{}),e.jsx(lm,{})]})}const im=Object.freeze(Object.defineProperty({__proto__:null,default:rm},Symbol.toStringTag,{value:"Module"})),om=x.object({email_verify:x.boolean().nullable(),safe_mode_enable:x.boolean().nullable(),secure_path:x.string().nullable(),email_whitelist_enable:x.boolean().nullable(),email_whitelist_suffix:x.array(x.string().nullable()).nullable(),email_gmail_limit_enable:x.boolean().nullable(),recaptcha_enable:x.boolean().nullable(),recaptcha_key:x.string().nullable(),recaptcha_site_key:x.string().nullable(),register_limit_by_ip_enable:x.boolean().nullable(),register_limit_count:x.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:x.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:x.boolean().nullable(),password_limit_count:x.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:x.coerce.string().transform(s=>s===""?null:s).nullable()}),cm={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 dm(){const{t:s}=V("settings"),[a,t]=m.useState(!1),l=m.useRef(null),n=ye({resolver:_e(om),defaultValues:cm,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","safe"],queryFn:()=>me.getSettings("safe")}),{mutateAsync:r}=gs({mutationFn:me.saveSettings,onSuccess:i=>{i.data&&A.success(s("common.autoSaved"))}});m.useEffect(()=>{if(o?.data.safe){const i=o.data.safe;Object.entries(i).forEach(([d,h])=>{typeof h=="number"?n.setValue(d,String(h)):n.setValue(d,h)}),l.current=i}},[o]);const c=m.useCallback(Se.debounce(async i=>{if(!Se.isEqual(i,l.current)){t(!0);try{await r(i),l.current=i}finally{t(!1)}}},1e3),[r]),u=m.useCallback(i=>{c(i)},[c]);return m.useEffect(()=>{const i=n.watch(d=>{u(d)});return()=>i.unsubscribe()},[n.watch,u]),e.jsx(we,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:n.control,name:"email_verify",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.emailVerify.label")}),e.jsx(F,{children:s("safe.form.emailVerify.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),e.jsx(v,{control:n.control,name:"email_gmail_limit_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.gmailLimit.label")}),e.jsx(F,{children:s("safe.form.gmailLimit.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),e.jsx(v,{control:n.control,name:"safe_mode_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.safeMode.label")}),e.jsx(F,{children:s("safe.form.safeMode.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),e.jsx(v,{control:n.control,name:"secure_path",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.securePath.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.securePath.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsx(F,{children:s("safe.form.securePath.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"email_whitelist_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.emailWhitelist.label")}),e.jsx(F,{children:s("safe.form.emailWhitelist.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),n.watch("email_whitelist_enable")&&e.jsx(v,{control:n.control,name:"email_whitelist_suffix",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.emailWhitelist.suffixes.label")}),e.jsx(b,{children:e.jsx(Ts,{placeholder:s("safe.form.emailWhitelist.suffixes.placeholder"),...i,value:(i.value||[]).join(` `),onChange:d=>{const h=d.target.value.split(` -`).filter(Boolean);o.onChange(h),u(a.getValues())}})}),e.jsx(F,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"recaptcha_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.recaptcha.enable.label")}),e.jsx(F,{children:s("safe.form.recaptcha.enable.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),a.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:a.control,name:"recaptcha_site_key",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.recaptcha.siteKey.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("safe.form.recaptcha.siteKey.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsx(F,{children:s("safe.form.recaptcha.siteKey.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"recaptcha_key",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.recaptcha.key.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("safe.form.recaptcha.key.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsx(F,{children:s("safe.form.recaptcha.key.description")}),e.jsx(D,{})]})})]}),e.jsx(v,{control:a.control,name:"register_limit_by_ip_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(F,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),a.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:a.control,name:"register_limit_count",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.registerLimit.count.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("safe.form.registerLimit.count.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsx(F,{children:s("safe.form.registerLimit.count.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"register_limit_expire",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.registerLimit.expire.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("safe.form.registerLimit.expire.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsx(F,{children:s("safe.form.registerLimit.expire.description")}),e.jsx(D,{})]})})]}),e.jsx(v,{control:a.control,name:"password_limit_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.passwordLimit.enable.label")}),e.jsx(F,{children:s("safe.form.passwordLimit.enable.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),a.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:a.control,name:"password_limit_count",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.passwordLimit.count.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("safe.form.passwordLimit.count.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsx(F,{children:s("safe.form.passwordLimit.count.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"password_limit_expire",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.passwordLimit.expire.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("safe.form.passwordLimit.expire.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsx(F,{children:s("safe.form.passwordLimit.expire.description")}),e.jsx(D,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("safe.form.saving")})]})})}function Xd(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("safe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("safe.description")})]}),e.jsx(ke,{}),e.jsx(Qd,{})]})}const Zd=Object.freeze(Object.defineProperty({__proto__:null,default:Xd},Symbol.toStringTag,{value:"Module"})),em=x.object({plan_change_enable:x.boolean().nullable().default(!1),reset_traffic_method:x.coerce.number().nullable().default(0),surplus_enable:x.boolean().nullable().default(!1),new_order_event_id:x.coerce.number().nullable().default(0),renew_order_event_id:x.coerce.number().nullable().default(0),change_order_event_id:x.coerce.number().nullable().default(0),show_info_to_server_enable:x.boolean().nullable().default(!1),show_protocol_to_server_enable:x.boolean().nullable().default(!1),default_remind_expire:x.boolean().nullable().default(!1),default_remind_traffic:x.boolean().nullable().default(!1),subscribe_path:x.string().nullable().default("s")}),sm={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,subscribe_path:"s"};function tm(){const{t:s}=V("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=ye({resolver:_e(em),defaultValues:sm,mode:"onBlur"}),{data:l}=ne({queryKey:["settings","subscribe"],queryFn:()=>me.getSettings("subscribe")}),{mutateAsync:i}=hs({mutationFn:me.saveSettings,onSuccess:o=>{o.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(l?.data?.subscribe){const o=l?.data?.subscribe;Object.entries(o).forEach(([d,h])=>{a.setValue(d,h)}),r.current=o}},[l]);const c=m.useCallback(Se.debounce(async o=>{if(!Se.isEqual(o,r.current)){t(!0);try{await i(o),r.current=o}finally{t(!1)}}},1e3),[i]),u=m.useCallback(o=>{c(o)},[c]);return m.useEffect(()=>{const o=a.watch(d=>{u(d)});return()=>o.unsubscribe()},[a.watch,u]),e.jsx(we,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:a.control,name:"plan_change_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.plan_change_enable.title")}),e.jsx(F,{children:s("subscribe.plan_change_enable.description")}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"reset_traffic_method",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.reset_traffic_method.title")}),e.jsxs(J,{onValueChange:o.onChange,value:o.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择重置方式"})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("subscribe.reset_traffic_method.options.monthly_first")}),e.jsx(A,{value:"1",children:s("subscribe.reset_traffic_method.options.monthly_reset")}),e.jsx(A,{value:"2",children:s("subscribe.reset_traffic_method.options.no_reset")}),e.jsx(A,{value:"3",children:s("subscribe.reset_traffic_method.options.yearly_first")}),e.jsx(A,{value:"4",children:s("subscribe.reset_traffic_method.options.yearly_reset")})]})]}),e.jsx(F,{children:s("subscribe.reset_traffic_method.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"surplus_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.surplus_enable.title")}),e.jsx(F,{children:s("subscribe.surplus_enable.description")}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"new_order_event_id",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.new_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(J,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择"})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("subscribe.new_order_event.options.no_action")}),e.jsx(A,{value:"1",children:s("subscribe.new_order_event.options.reset_traffic")})]})]})})}),e.jsx(F,{children:s("subscribe.new_order_event.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"renew_order_event_id",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.renew_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(J,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择"})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("subscribe.renew_order_event.options.no_action")}),e.jsx(A,{value:"1",children:s("subscribe.renew_order_event.options.reset_traffic")})]})]})})}),e.jsx(F,{children:s("subscribe.renew_order_event.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"change_order_event_id",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.change_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(J,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择"})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("subscribe.change_order_event.options.no_action")}),e.jsx(A,{value:"1",children:s("subscribe.change_order_event.options.reset_traffic")})]})]})})}),e.jsx(F,{children:s("subscribe.change_order_event.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"subscribe_path",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.subscribe_path.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:"subscribe",...o,value:o.value||"",onChange:d=>{o.onChange(d),u(a.getValues())}})}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[s("subscribe.subscribe_path.description"),e.jsx("br",{}),s("subscribe.subscribe_path.current_format",{path:o.value||"s"})]}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"show_info_to_server_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("subscribe.show_info_to_server.title")}),e.jsx(F,{children:s("subscribe.show_info_to_server.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"show_protocol_to_server_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("subscribe.show_protocol_to_server.title")}),e.jsx(F,{children:s("subscribe.show_protocol_to_server.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function am(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("subscribe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("subscribe.description")})]}),e.jsx(ke,{}),e.jsx(tm,{})]})}const nm=Object.freeze(Object.defineProperty({__proto__:null,default:am},Symbol.toStringTag,{value:"Module"})),rm=x.object({invite_force:x.boolean().default(!1),invite_commission:x.coerce.string().default("0"),invite_gen_limit:x.coerce.string().default("0"),invite_never_expire:x.boolean().default(!1),commission_first_time_enable:x.boolean().default(!1),commission_auto_check_enable:x.boolean().default(!1),commission_withdraw_limit:x.coerce.string().default("0"),commission_withdraw_method:x.array(x.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:x.boolean().default(!1),commission_distribution_enable:x.boolean().default(!1),commission_distribution_l1:x.coerce.number().default(0),commission_distribution_l2:x.coerce.number().default(0),commission_distribution_l3:x.coerce.number().default(0)}),lm={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 im(){const{t:s}=V("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=ye({resolver:_e(rm),defaultValues:lm,mode:"onBlur"}),{data:l}=ne({queryKey:["settings","invite"],queryFn:()=>me.getSettings("invite")}),{mutateAsync:i}=hs({mutationFn:me.saveSettings,onSuccess:o=>{o.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(l?.data?.invite){const o=l?.data?.invite;Object.entries(o).forEach(([d,h])=>{typeof h=="number"?a.setValue(d,String(h)):a.setValue(d,h)}),r.current=o}},[l]);const c=m.useCallback(Se.debounce(async o=>{if(!Se.isEqual(o,r.current)){t(!0);try{await i(o),r.current=o}finally{t(!1)}}},1e3),[i]),u=m.useCallback(o=>{c(o)},[c]);return m.useEffect(()=>{const o=a.watch(d=>{u(d)});return()=>o.unsubscribe()},[a.watch,u]),e.jsx(we,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:a.control,name:"invite_force",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.invite_force.title")}),e.jsx(F,{children:s("invite.invite_force.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"invite_commission",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("invite.invite_commission.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("invite.invite_commission.placeholder"),...o,value:o.value||""})}),e.jsx(F,{children:s("invite.invite_commission.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"invite_gen_limit",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("invite.invite_gen_limit.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("invite.invite_gen_limit.placeholder"),...o,value:o.value||""})}),e.jsx(F,{children:s("invite.invite_gen_limit.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"invite_never_expire",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.invite_never_expire.title")}),e.jsx(F,{children:s("invite.invite_never_expire.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"commission_first_time_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.commission_first_time.title")}),e.jsx(F,{children:s("invite.commission_first_time.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"commission_auto_check_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.commission_auto_check.title")}),e.jsx(F,{children:s("invite.commission_auto_check.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"commission_withdraw_limit",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("invite.commission_withdraw_limit.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("invite.commission_withdraw_limit.placeholder"),...o,value:o.value||""})}),e.jsx(F,{children:s("invite.commission_withdraw_limit.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"commission_withdraw_method",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("invite.commission_withdraw_method.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("invite.commission_withdraw_method.placeholder"),...o,value:Array.isArray(o.value)?o.value.join(","):"",onChange:d=>{const h=d.target.value.split(",").filter(Boolean);o.onChange(h),u(a.getValues())}})}),e.jsx(F,{children:s("invite.commission_withdraw_method.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"withdraw_close_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.withdraw_close.title")}),e.jsx(F,{children:s("invite.withdraw_close.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"commission_distribution_enable",render:({field:o})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.commission_distribution.title")}),e.jsx(F,{children:s("invite.commission_distribution.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:o.value,onCheckedChange:d=>{o.onChange(d),u(a.getValues())}})})]})}),a.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:a.control,name:"commission_distribution_l1",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:s("invite.commission_distribution.l1")}),e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...o,value:o.value||"",onChange:d=>{const h=d.target.value?Number(d.target.value):0;o.onChange(h),u(a.getValues())}})}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"commission_distribution_l2",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:s("invite.commission_distribution.l2")}),e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...o,value:o.value||"",onChange:d=>{const h=d.target.value?Number(d.target.value):0;o.onChange(h),u(a.getValues())}})}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"commission_distribution_l3",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:s("invite.commission_distribution.l3")}),e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...o,value:o.value||"",onChange:d=>{const h=d.target.value?Number(d.target.value):0;o.onChange(h),u(a.getValues())}})}),e.jsx(D,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("invite.saving")})]})})}function om(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("invite.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("invite.description")})]}),e.jsx(ke,{}),e.jsx(im,{})]})}const cm=Object.freeze(Object.defineProperty({__proto__:null,default:om},Symbol.toStringTag,{value:"Module"})),dm=x.object({frontend_theme:x.string().nullable(),frontend_theme_sidebar:x.string().nullable(),frontend_theme_header:x.string().nullable(),frontend_theme_color:x.string().nullable(),frontend_background_url:x.string().url().nullable()}),mm={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function um(){const{data:s}=ne({queryKey:["settings","frontend"],queryFn:()=>me.getSettings("frontend")}),n=ye({resolver:_e(dm),defaultValues:mm,mode:"onChange"});m.useEffect(()=>{if(s?.data?.frontend){const r=s?.data?.frontend;Object.entries(r).forEach(([a,l])=>{n.setValue(a,l)})}},[s]);function t(r){me.saveSettings(r).then(({data:a})=>{a&&$.success("更新成功")})}return e.jsx(we,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(t),className:"space-y-8",children:[e.jsx(v,{control:n.control,name:"frontend_theme_sidebar",render:({field:r})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:"边栏风格"}),e.jsx(F,{children:"边栏风格"})]}),e.jsx(b,{children:e.jsx(Z,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(v,{control:n.control,name:"frontend_theme_header",render:({field:r})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:"头部风格"}),e.jsx(F,{children:"边栏风格"})]}),e.jsx(b,{children:e.jsx(Z,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(v,{control:n.control,name:"frontend_theme_color",render:({field:r})=>e.jsxs(f,{children:[e.jsx(j,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(b,{children:e.jsxs("select",{className:y(wt({variant:"outline"}),"w-[200px] appearance-none font-normal"),...r,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(xn,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(F,{children:"主题色"}),e.jsx(D,{})]})}),e.jsx(v,{control:n.control,name:"frontend_background_url",render:({field:r})=>e.jsxs(f,{children:[e.jsx(j,{children:"背景"}),e.jsx(b,{children:e.jsx(T,{placeholder:"请输入图片地址",...r})}),e.jsx(F,{children:"将会在后台登录页面进行展示。"}),e.jsx(D,{})]})}),e.jsx(E,{type:"submit",children:"保存设置"})]})})}function xm(){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(ke,{}),e.jsx(um,{})]})}const hm=Object.freeze(Object.defineProperty({__proto__:null,default:xm},Symbol.toStringTag,{value:"Module"})),pm=x.object({server_pull_interval:x.coerce.number().nullable(),server_push_interval:x.coerce.number().nullable(),server_token:x.string().nullable(),device_limit_mode:x.coerce.number().nullable()}),gm={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function fm(){const{t:s}=V("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=ye({resolver:_e(pm),defaultValues:gm,mode:"onBlur"}),{data:l}=ne({queryKey:["settings","server"],queryFn:()=>me.getSettings("server")}),{mutateAsync:i}=hs({mutationFn:me.saveSettings,onSuccess:d=>{d.data&&$.success(s("common.AutoSaved"))}});m.useEffect(()=>{if(l?.data.server){const d=l.data.server;Object.entries(d).forEach(([h,w])=>{a.setValue(h,w)}),r.current=d}},[l]);const c=m.useCallback(Se.debounce(async d=>{if(!Se.isEqual(d,r.current)){t(!0);try{await i(d),r.current=d}finally{t(!1)}}},1e3),[i]),u=m.useCallback(d=>{c(d)},[c]);m.useEffect(()=>{const d=a.watch(h=>{u(h)});return()=>d.unsubscribe()},[a.watch,u]);const o=()=>{const d=Math.floor(Math.random()*17)+16,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let w="";for(let P=0;Pe.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("server.server_token.title")}),e.jsx(b,{children:e.jsxs("div",{className:"relative",children:[e.jsx(T,{placeholder:s("server.server_token.placeholder"),...d,value:d.value||"",className:"pr-10"}),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(B,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2",onClick:h=>{h.preventDefault(),o()},children:e.jsx(Bo,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(ce,{children:e.jsx("p",{children:s("server.server_token.generate_tooltip")})})]})})]})}),e.jsx(F,{children:s("server.server_token.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"server_pull_interval",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("server.server_pull_interval.title")}),e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:s("server.server_pull_interval.placeholder"),...d,value:d.value||"",onChange:h=>{const w=h.target.value?Number(h.target.value):null;d.onChange(w)}})}),e.jsx(F,{children:s("server.server_pull_interval.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"server_push_interval",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("server.server_push_interval.title")}),e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:s("server.server_push_interval.placeholder"),...d,value:d.value||"",onChange:h=>{const w=h.target.value?Number(h.target.value):null;d.onChange(w)}})}),e.jsx(F,{children:s("server.server_push_interval.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"device_limit_mode",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("server.device_limit_mode.title")}),e.jsxs(J,{onValueChange:d.onChange,value:d.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:s("server.device_limit_mode.placeholder")})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("server.device_limit_mode.strict")}),e.jsx(A,{value:"1",children:s("server.device_limit_mode.relaxed")})]})]}),e.jsx(F,{children:s("server.device_limit_mode.description")}),e.jsx(D,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("server.saving")})]})})}function jm(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("server.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("server.description")})]}),e.jsx(ke,{}),e.jsx(fm,{})]})}const vm=Object.freeze(Object.defineProperty({__proto__:null,default:jm},Symbol.toStringTag,{value:"Module"}));function bm({open:s,onOpenChange:n,result:t}){const r=!t.error;return e.jsx(pe,{open:s,onOpenChange:n,children:e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r?e.jsx(Lr,{className:"h-5 w-5 text-green-500"}):e.jsx(Vr,{className:"h-5 w-5 text-destructive"}),e.jsx(ge,{children:r?"邮件发送成功":"邮件发送失败"})]}),e.jsx(Le,{children:r?"测试邮件已成功发送,请检查收件箱":"发送测试邮件时遇到错误"})]}),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:t.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:t.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:t.template_name})]})]}),t.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:t.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(Nt,{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:t.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:t.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:t.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:t.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:t.config.from.address?`${t.config.from.address}${t.config.from.name?` (${t.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:t.config.username||"未设置"})]})})})]})]})]})})}const ym=x.object({email_template:x.string().nullable().default("classic"),email_host:x.string().nullable().default(""),email_port:x.coerce.number().nullable().default(465),email_username:x.string().nullable().default(""),email_password:x.string().nullable().default(""),email_encryption:x.string().nullable().default(""),email_from_address:x.string().email().nullable().default(""),remind_mail_enable:x.boolean().nullable().default(!1)});function Nm(){const{t:s}=V("settings"),[n,t]=m.useState(null),[r,a]=m.useState(!1),l=m.useRef(null),[i,c]=m.useState(!1),u=ye({resolver:_e(ym),defaultValues:{},mode:"onBlur"}),{data:o}=ne({queryKey:["settings","email"],queryFn:()=>me.getSettings("email")}),{data:d}=ne({queryKey:["emailTemplate"],queryFn:()=>me.getEmailTemplate()}),{mutateAsync:h}=hs({mutationFn:me.saveSettings,onSuccess:N=>{N.data&&$.success(s("common.autoSaved"))}}),{mutate:w,isPending:P}=hs({mutationFn:me.sendTestMail,onMutate:()=>{t(null),a(!1)},onSuccess:N=>{t(N.data),a(!0),N.data.error?$.error(s("email.test.error")):$.success(s("email.test.success"))}});m.useEffect(()=>{if(o?.data.email){const N=o.data.email;Object.entries(N).forEach(([p,S])=>{u.setValue(p,S)}),l.current=N}},[o]);const k=m.useCallback(Se.debounce(async N=>{if(!Se.isEqual(N,l.current)){c(!0);try{await h(N),l.current=N}finally{c(!1)}}},1e3),[h]),C=m.useCallback(N=>{k(N)},[k]);return m.useEffect(()=>{const N=u.watch(p=>{C(p)});return()=>N.unsubscribe()},[u.watch,C]),e.jsxs(e.Fragment,{children:[e.jsx(we,{...u,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:u.control,name:"email_host",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_host.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("common.placeholder"),...N,value:N.value||""})}),e.jsx(F,{children:s("email.email_host.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"email_port",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_port.title")}),e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:s("common.placeholder"),...N,value:N.value||"",onChange:p=>{const S=p.target.value?Number(p.target.value):null;N.onChange(S)}})}),e.jsx(F,{children:s("email.email_port.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"email_encryption",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_encryption.title")}),e.jsxs(J,{onValueChange:N.onChange,value:N.value||"none",children:[e.jsx(b,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择加密方式"})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"none",children:s("email.email_encryption.none")}),e.jsx(A,{value:"ssl",children:s("email.email_encryption.ssl")}),e.jsx(A,{value:"tls",children:s("email.email_encryption.tls")})]})]}),e.jsx(F,{children:s("email.email_encryption.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"email_username",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_username.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("common.placeholder"),...N,value:N.value||""})}),e.jsx(F,{children:s("email.email_username.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"email_password",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_password.title")}),e.jsx(b,{children:e.jsx(T,{type:"password",placeholder:s("common.placeholder"),...N,value:N.value||""})}),e.jsx(F,{children:s("email.email_password.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"email_from_address",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_from.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("common.placeholder"),...N,value:N.value||""})}),e.jsx(F,{children:s("email.email_from.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"email_template",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_template.title")}),e.jsxs(J,{onValueChange:p=>{N.onChange(p),C(u.getValues())},value:N.value||void 0,children:[e.jsx(b,{children:e.jsx(W,{className:"w-[200px]",children:e.jsx(Q,{placeholder:s("email.email_template.placeholder")})})}),e.jsx(Y,{children:d?.data?.map(p=>e.jsx(A,{value:p,children:p},p))})]}),e.jsx(F,{children:s("email.email_template.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"remind_mail_enable",render:({field:N})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("email.remind_mail.title")}),e.jsx(F,{children:s("email.remind_mail.description")})]}),e.jsx(b,{children:e.jsx(Z,{checked:N.value||!1,onCheckedChange:p=>{N.onChange(p),C(u.getValues())}})})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(E,{onClick:()=>w(),loading:P,disabled:P,children:s(P?"email.test.sending":"email.test.title")})})]})}),i&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("saving")}),n&&e.jsx(bm,{open:r,onOpenChange:a,result:n})]})}function _m(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("email.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("email.description")})]}),e.jsx(ke,{}),e.jsx(Nm,{})]})}const wm=Object.freeze(Object.defineProperty({__proto__:null,default:_m},Symbol.toStringTag,{value:"Module"})),Cm=x.object({telegram_bot_enable:x.boolean().nullable(),telegram_bot_token:x.string().nullable(),telegram_discuss_link:x.string().nullable()}),Sm={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function km(){const{t:s}=V("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=ye({resolver:_e(Cm),defaultValues:Sm,mode:"onBlur"}),{data:l}=ne({queryKey:["settings","telegram"],queryFn:()=>me.getSettings("telegram")}),{mutateAsync:i}=hs({mutationFn:me.saveSettings,onSuccess:h=>{h.data&&$.success(s("common.autoSaved"))}}),{mutate:c,isPending:u}=hs({mutationFn:me.setTelegramWebhook,onSuccess:h=>{h.data&&$.success(s("telegram.webhook.success"))}});m.useEffect(()=>{if(l?.data.telegram){const h=l.data.telegram;Object.entries(h).forEach(([w,P])=>{a.setValue(w,P)}),r.current=h}},[l]);const o=m.useCallback(Se.debounce(async h=>{if(!Se.isEqual(h,r.current)){t(!0);try{await i(h),r.current=h}finally{t(!1)}}},1e3),[i]),d=m.useCallback(h=>{o(h)},[o]);return m.useEffect(()=>{const h=a.watch(w=>{d(w)});return()=>h.unsubscribe()},[a.watch,d]),e.jsx(we,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:a.control,name:"telegram_bot_token",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("telegram.bot_token.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("telegram.bot_token.placeholder"),...h,value:h.value||""})}),e.jsx(F,{children:s("telegram.bot_token.description")}),e.jsx(D,{})]})}),a.watch("telegram_bot_token")&&e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("telegram.webhook.title")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(E,{loading:u,disabled:u,onClick:()=>c(),children:s(u?"telegram.webhook.setting":"telegram.webhook.button")}),n&&e.jsx("span",{className:"text-sm text-muted-foreground",children:s("common.saving")})]}),e.jsx(F,{children:s("telegram.webhook.description")}),e.jsx(D,{})]}),e.jsx(v,{control:a.control,name:"telegram_bot_enable",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("telegram.bot_enable.title")}),e.jsx(F,{children:s("telegram.bot_enable.description")}),e.jsx(b,{children:e.jsx(Z,{checked:h.value||!1,onCheckedChange:w=>{h.onChange(w),d(a.getValues())}})}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"telegram_discuss_link",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("telegram.discuss_link.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("telegram.discuss_link.placeholder"),...h,value:h.value||""})}),e.jsx(F,{children:s("telegram.discuss_link.description")}),e.jsx(D,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Tm(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("telegram.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("telegram.description")})]}),e.jsx(ke,{}),e.jsx(km,{})]})}const Dm=Object.freeze(Object.defineProperty({__proto__:null,default:Tm},Symbol.toStringTag,{value:"Module"})),Em=x.object({windows_version:x.string().nullable(),windows_download_url:x.string().nullable(),macos_version:x.string().nullable(),macos_download_url:x.string().nullable(),android_version:x.string().nullable(),android_download_url:x.string().nullable()}),Pm={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function Rm(){const{t:s}=V("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=ye({resolver:_e(Em),defaultValues:Pm,mode:"onBlur"}),{data:l}=ne({queryKey:["settings","app"],queryFn:()=>me.getSettings("app")}),{mutateAsync:i}=hs({mutationFn:me.saveSettings,onSuccess:o=>{o.data&&$.success(s("app.save_success"))}});m.useEffect(()=>{if(l?.data.app){const o=l.data.app;Object.entries(o).forEach(([d,h])=>{a.setValue(d,h)}),r.current=o}},[l]);const c=m.useCallback(Se.debounce(async o=>{if(!Se.isEqual(o,r.current)){t(!0);try{await i(o),r.current=o}finally{t(!1)}}},1e3),[i]),u=m.useCallback(o=>{c(o)},[c]);return m.useEffect(()=>{const o=a.watch(d=>{u(d)});return()=>o.unsubscribe()},[a.watch,u]),e.jsx(we,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:a.control,name:"windows_version",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.windows.version.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(F,{children:s("app.windows.version.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"windows_download_url",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.windows.download.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(F,{children:s("app.windows.download.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"macos_version",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.macos.version.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(F,{children:s("app.macos.version.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"macos_download_url",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.macos.download.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(F,{children:s("app.macos.download.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"android_version",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.android.version.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(F,{children:s("app.android.version.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"android_download_url",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.android.download.title")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(F,{children:s("app.android.download.description")}),e.jsx(D,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Im(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("app.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("app.description")})]}),e.jsx(ke,{}),e.jsx(Rm,{})]})}const Lm=Object.freeze(Object.defineProperty({__proto__:null,default:Im},Symbol.toStringTag,{value:"Module"}));function Vm({table:s}){const[n,t]=m.useState(""),{t:r}=V("common");m.useEffect(()=>{t((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const a=l=>{const i=parseInt(l);!isNaN(i)&&i>=1&&i<=s.getPageCount()?s.setPageIndex(i-1):t((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.jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:r("table.pagination.selected",{selected:s.getFilteredSelectedRowModel().rows.length,total: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:r("table.pagination.itemsPerPage")}),e.jsxs(J,{value:`${s.getState().pagination.pageSize}`,onValueChange:l=>{s.setPageSize(Number(l))},children:[e.jsx(W,{className:"h-8 w-[70px]",children:e.jsx(Q,{placeholder:s.getState().pagination.pageSize})}),e.jsx(Y,{side:"top",children:[10,20,30,40,50,100,500].map(l=>e.jsx(A,{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:r("table.pagination.page")}),e.jsx(T,{type:"text",value:n,onChange:l=>t(l.target.value),onBlur:l=>a(l.target.value),onKeyDown:l=>{l.key==="Enter"&&a(l.currentTarget.value)},className:"h-8 w-[50px] text-center"}),e.jsx("span",{children:r("table.pagination.pageOf",{total:s.getPageCount()})})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(E,{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:r("table.pagination.firstPage")}),e.jsx(Go,{className:"h-4 w-4"})]}),e.jsxs(E,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.previousPage(),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.previousPage")}),e.jsx(Dr,{className:"h-4 w-4"})]}),e.jsxs(E,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.nextPage(),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.nextPage")}),e.jsx(dn,{className:"h-4 w-4"})]}),e.jsxs(E,{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:r("table.pagination.lastPage")}),e.jsx(Wo,{className:"h-4 w-4"})]})]})]})]})}function bs({table:s,toolbar:n,draggable:t=!1,onDragStart:r,onDragEnd:a,onDragOver:l,onDragLeave:i,onDrop:c,showPagination:u=!0,isLoading:o=!1}){const{t:d}=V("common"),h=m.useRef(null),w=s.getAllColumns().filter(N=>N.getIsPinned()==="left"),P=s.getAllColumns().filter(N=>N.getIsPinned()==="right"),k=N=>w.slice(0,N).reduce((p,S)=>p+(S.getSize()??0),0),C=N=>P.slice(N+1).reduce((p,S)=>p+(S.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof n=="function"?n(s):n,e.jsx("div",{ref:h,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs(qt,{children:[e.jsx(Ht,{children:s.getHeaderGroups().map(N=>e.jsx(Ge,{className:"hover:bg-transparent",children:N.headers.map((p,S)=>{const R=p.column.getIsPinned()==="left",g=p.column.getIsPinned()==="right",_=R?k(w.indexOf(p.column)):void 0,I=g?C(P.indexOf(p.column)):void 0;return e.jsx(Je,{colSpan:p.colSpan,style:{width:p.getSize(),...R&&{left:_},...g&&{right:I}},className:y("h-11 bg-card px-4 text-muted-foreground",(R||g)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",R&&"before:right-0",g&&"before:left-0"]),children:p.isPlaceholder?null:oa(p.column.columnDef.header,p.getContext())},p.id)})},N.id))}),e.jsx(Ut,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((N,p)=>e.jsx(Ge,{"data-state":N.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:t,onDragStart:S=>r?.(S,p),onDragEnd:a,onDragOver:l,onDragLeave:i,onDrop:S=>c?.(S,p),children:N.getVisibleCells().map((S,R)=>{const g=S.column.getIsPinned()==="left",_=S.column.getIsPinned()==="right",I=g?k(w.indexOf(S.column)):void 0,U=_?C(P.indexOf(S.column)):void 0;return e.jsx(Ee,{style:{width:S.column.getSize(),...g&&{left:I},..._&&{right:U}},className:y("bg-card",(g||_)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",g&&"before:right-0",_&&"before:left-0"]),children:oa(S.column.columnDef.cell,S.getContext())},S.id)})},N.id)):e.jsx(Ge,{children:e.jsx(Ee,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:d("table.noData")})})})]})})}),u&&e.jsx(Vm,{table:s})]})}const Fm=s=>x.object({id:x.number().nullable(),name:x.string().min(2,s("form.validation.name.min")).max(30,s("form.validation.name.max")),icon:x.string().optional().nullable(),notify_domain:x.string().refine(t=>!t||/^https?:\/\/\S+/.test(t),s("form.validation.notify_domain.url")).optional().nullable(),handling_fee_fixed:x.coerce.number().min(0).optional().nullable(),handling_fee_percent:x.coerce.number().min(0).max(100).optional().nullable(),payment:x.string().min(1,s("form.validation.payment.required")),config:x.record(x.string(),x.string())}),$n={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function vl({refetch:s,dialogTrigger:n,type:t="add",defaultFormValues:r=$n}){const{t:a}=V("payment"),[l,i]=m.useState(!1),[c,u]=m.useState(!1),[o,d]=m.useState([]),[h,w]=m.useState([]),P=Fm(a),k=ye({resolver:_e(P),defaultValues:r,mode:"onChange"}),C=k.watch("payment");m.useEffect(()=>{l&&(async()=>{const{data:S}=await Qs.getMethodList();d(S)})()},[l]),m.useEffect(()=>{if(!C||!l)return;(async()=>{const S={payment:C,...t==="edit"&&{id:Number(k.getValues("id"))}};Qs.getMethodForm(S).then(({data:R})=>{w(R);const g=R.reduce((_,I)=>(I.field_name&&(_[I.field_name]=I.value??""),_),{});k.setValue("config",g)})})()},[C,l,k,t]);const N=async p=>{u(!0);try{(await Qs.save(p)).data&&($.success(a("form.messages.success")),k.reset($n),s(),i(!1))}finally{u(!1)}};return e.jsxs(pe,{open:l,onOpenChange:i,children:[e.jsx(as,{asChild:!0,children:n||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Oe,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add.button")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsx(ve,{children:e.jsx(ge,{children:a(t==="add"?"form.add.title":"form.edit.title")})}),e.jsx(we,{...k,children:e.jsxs("form",{onSubmit:k.handleSubmit(N),className:"space-y-4",children:[e.jsx(v,{control:k.control,name:"name",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:a("form.fields.name.placeholder"),...p})}),e.jsx(F,{children:a("form.fields.name.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:k.control,name:"icon",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.icon.label")}),e.jsx(b,{children:e.jsx(T,{...p,value:p.value||"",placeholder:a("form.fields.icon.placeholder")})}),e.jsx(F,{children:a("form.fields.icon.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:k.control,name:"notify_domain",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.notify_domain.label")}),e.jsx(b,{children:e.jsx(T,{...p,value:p.value||"",placeholder:a("form.fields.notify_domain.placeholder")})}),e.jsx(F,{children:a("form.fields.notify_domain.description")}),e.jsx(D,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(v,{control:k.control,name:"handling_fee_percent",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.handling_fee_percent.label")}),e.jsx(b,{children:e.jsx(T,{type:"number",...p,value:p.value||"",placeholder:a("form.fields.handling_fee_percent.placeholder")})}),e.jsx(D,{})]})}),e.jsx(v,{control:k.control,name:"handling_fee_fixed",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.handling_fee_fixed.label")}),e.jsx(b,{children:e.jsx(T,{type:"number",...p,value:p.value||"",placeholder:a("form.fields.handling_fee_fixed.placeholder")})}),e.jsx(D,{})]})})]}),e.jsx(v,{control:k.control,name:"payment",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.payment.label")}),e.jsxs(J,{onValueChange:p.onChange,defaultValue:p.value,children:[e.jsx(b,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:a("form.fields.payment.placeholder")})})}),e.jsx(Y,{children:o.map(S=>e.jsx(A,{value:S,children:S},S))})]}),e.jsx(F,{children:a("form.fields.payment.description")}),e.jsx(D,{})]})}),h.length>0&&e.jsx("div",{className:"space-y-4",children:h.map(p=>e.jsx(v,{control:k.control,name:`config.${p.field_name}`,render:({field:S})=>e.jsxs(f,{children:[e.jsx(j,{children:p.label}),e.jsx(b,{children:e.jsx(T,{...S,value:S.value||""})}),e.jsx(D,{})]})},p.field_name))}),e.jsxs(Pe,{children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{type:"button",variant:"outline",children:a("form.buttons.cancel")})}),e.jsx(E,{type:"submit",disabled:c,children:a("form.buttons.submit")})]})]})})]})]})}function z({column:s,title:n,tooltip:t,className:r}){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(E,{variant:"ghost",size:"default",className:y("-ml-3 flex h-8 items-center gap-2 text-nowrap font-medium hover:bg-muted/60",r),onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:[e.jsx("span",{children:n}),t&&e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(Ln,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(ce,{children:t})]})}),s.getIsSorted()==="asc"?e.jsx(Qa,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(Xa,{className:"h-4 w-4 text-foreground/70"}):e.jsx(Yo,{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",r),children:[e.jsx("span",{children:n}),t&&e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx(Ln,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(ce,{children:t})]})})]})}const fn=Jo,bl=Qo,Om=Xo,yl=m.forwardRef(({className:s,...n},t)=>e.jsx(Or,{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),...n,ref:t}));yl.displayName=Or.displayName;const ka=m.forwardRef(({className:s,...n},t)=>e.jsxs(Om,{children:[e.jsx(yl,{}),e.jsx(Mr,{ref:t,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),...n})]}));ka.displayName=Mr.displayName;const Ta=({className:s,...n})=>e.jsx("div",{className:y("flex flex-col space-y-2 text-center sm:text-left",s),...n});Ta.displayName="AlertDialogHeader";const Da=({className:s,...n})=>e.jsx("div",{className:y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Da.displayName="AlertDialogFooter";const Ea=m.forwardRef(({className:s,...n},t)=>e.jsx(zr,{ref:t,className:y("text-lg font-semibold",s),...n}));Ea.displayName=zr.displayName;const Pa=m.forwardRef(({className:s,...n},t)=>e.jsx(Ar,{ref:t,className:y("text-sm text-muted-foreground",s),...n}));Pa.displayName=Ar.displayName;const Ra=m.forwardRef(({className:s,...n},t)=>e.jsx($r,{ref:t,className:y(bt(),s),...n}));Ra.displayName=$r.displayName;const Ia=m.forwardRef(({className:s,...n},t)=>e.jsx(qr,{ref:t,className:y(bt({variant:"outline"}),"mt-2 sm:mt-0",s),...n}));Ia.displayName=qr.displayName;function ts({onConfirm:s,children:n,title:t="确认操作",description:r="确定要执行此操作吗?",cancelText:a="取消",confirmText:l="确认",variant:i="default",className:c}){return e.jsxs(fn,{children:[e.jsx(bl,{asChild:!0,children:n}),e.jsxs(ka,{className:y("sm:max-w-[425px]",c),children:[e.jsxs(Ta,{children:[e.jsx(Ea,{children:t}),e.jsx(Pa,{children:r})]}),e.jsxs(Da,{children:[e.jsx(Ia,{asChild:!0,children:e.jsx(E,{variant:"outline",children:a})}),e.jsx(Ra,{asChild:!0,children:e.jsx(E,{variant:i,onClick:s,children:l})})]})]})]})}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:"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"})}),Mm=({refetch:s,isSortMode:n=!1})=>{const{t}=V("payment");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(ba,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:r})=>e.jsx(z,{column:r,title:t("table.columns.id")}),cell:({row:r})=>e.jsx(G,{variant:"outline",children:r.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:r})=>e.jsx(z,{column:r,title:t("table.columns.enable")}),cell:({row:r})=>e.jsx(Z,{defaultChecked:r.getValue("enable"),onCheckedChange:async()=>{const{data:a}=await Qs.updateStatus({id:r.original.id});a||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:r})=>e.jsx(z,{column:r,title:t("table.columns.name")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:r.getValue("name")})}),enableSorting:!1,size:200},{accessorKey:"payment",header:({column:r})=>e.jsx(z,{column:r,title:t("table.columns.payment")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:r.getValue("payment")})}),enableSorting:!1,size:200},{accessorKey:"notify_url",header:({column:r})=>e.jsxs("div",{className:"flex items-center",children:[e.jsx(z,{column:r,title:t("table.columns.notify_url")}),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{className:"ml-1",children:e.jsx(Nl,{className:"h-4 w-4"})}),e.jsx(ce,{children:t("table.columns.notify_url_tooltip")})]})})]}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[300px] truncate font-medium",children:r.getValue("notify_url")})}),enableSorting:!1,size:3e3},{id:"actions",header:({column:r})=>e.jsx(z,{className:"justify-end",column:r,title:t("table.columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(vl,{refetch:s,dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:t("table.actions.edit")})]}),type:"edit",defaultFormValues:r.original}),e.jsx(ts,{title:t("table.actions.delete.title"),description:t("table.actions.delete.description"),onConfirm:async()=>{const{data:a}=await Qs.drop({id:r.original.id});a&&s()},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(ps,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:t("table.actions.delete.title")})]})})]}),size:100}]};function zm({table:s,refetch:n,saveOrder:t,isSortMode:r}){const{t:a}=V("payment"),l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[r?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("table.toolbar.sort.hint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(vl,{refetch:n}),e.jsx(T,{placeholder:a("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:i=>s.getColumn("name")?.setFilterValue(i.target.value),className:"h-8 w-[250px]"}),l&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[a("table.toolbar.reset"),e.jsx(ls,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(E,{variant:r?"default":"outline",onClick:t,size:"sm",children:a(r?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}function Am(){const[s,n]=m.useState([]),[t,r]=m.useState([]),[a,l]=m.useState(!1),[i,c]=m.useState([]),[u,o]=m.useState({"drag-handle":!1}),[d,h]=m.useState({pageSize:20,pageIndex:0}),{refetch:w}=ne({queryKey:["paymentList"],queryFn:async()=>{const{data:p}=await Qs.getList();return c(p?.map(S=>({...S,enable:!!S.enable}))||[]),p}});m.useEffect(()=>{o({"drag-handle":a,actions:!a}),h({pageSize:a?99999:10,pageIndex:0})},[a]);const P=(p,S)=>{a&&(p.dataTransfer.setData("text/plain",S.toString()),p.currentTarget.classList.add("opacity-50"))},k=(p,S)=>{if(!a)return;p.preventDefault(),p.currentTarget.classList.remove("bg-muted");const R=parseInt(p.dataTransfer.getData("text/plain"));if(R===S)return;const g=[...i],[_]=g.splice(R,1);g.splice(S,0,_),c(g)},C=async()=>{a?Qs.sort({ids:i.map(p=>p.id)}).then(()=>{w(),l(!1),$.success("排序保存成功")}):l(!0)},N=is({data:i,columns:Mm({refetch:w,isSortMode:a}),state:{sorting:t,columnFilters:s,columnVisibility:u,pagination:d},onSortingChange:r,onColumnFiltersChange:n,onColumnVisibilityChange:o,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),getSortedRowModel:js(),initialState:{columnPinning:{right:["actions"]}},pageCount:a?1:void 0});return e.jsx(bs,{table:N,toolbar:p=>e.jsx(zm,{table:p,refetch:w,saveOrder:C,isSortMode:a}),draggable:a,onDragStart:P,onDragEnd:p=>p.currentTarget.classList.remove("opacity-50"),onDragOver:p=>{p.preventDefault(),p.currentTarget.classList.add("bg-muted")},onDragLeave:p=>p.currentTarget.classList.remove("bg-muted"),onDrop:k,showPagination:!a})}function $m(){const{t:s}=V("payment");return e.jsxs(Ve,{children:[e.jsxs(Fe,{className:"flex items-center justify-between",children:[e.jsx(Ye,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")})}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),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(Am,{})})]})]})}const qm=Object.freeze(Object.defineProperty({__proto__:null,default:$m},Symbol.toStringTag,{value:"Module"}));function Hm({pluginName:s,onClose:n,onSuccess:t}){const{t:r}=V("plugin"),[a,l]=m.useState(!0),[i,c]=m.useState(!1),[u,o]=m.useState(null),d=Zo({config:ec(sc())}),h=ye({resolver:_e(d),defaultValues:{config:{}}});m.useEffect(()=>{(async()=>{try{const{data:C}=await Rs.getPluginConfig(s);o(C),h.reset({config:Object.fromEntries(Object.entries(C).map(([N,p])=>[N,p.value]))})}catch{$.error(r("messages.configLoadError"))}finally{l(!1)}})()},[s]);const w=async k=>{c(!0);try{await Rs.updatePluginConfig(s,k.config),$.success(r("messages.configSaveSuccess")),t()}catch{$.error(r("messages.configSaveError"))}finally{c(!1)}},P=(k,C)=>{switch(C.type){case"string":return e.jsx(v,{control:h.control,name:`config.${k}`,render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{children:C.label||C.description}),e.jsx(b,{children:e.jsx(T,{placeholder:C.placeholder,...N})}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description}),e.jsx(D,{})]})},k);case"number":case"percentage":return e.jsx(v,{control:h.control,name:`config.${k}`,render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{children:C.label||C.description}),e.jsx(b,{children:e.jsxs("div",{className:"relative",children:[e.jsx(T,{type:"number",placeholder:C.placeholder,...N,onChange:p=>{const S=Number(p.target.value);C.type==="percentage"?N.onChange(Math.min(100,Math.max(0,S))):N.onChange(S)},className:C.type==="percentage"?"pr-8":"",min:C.type==="percentage"?0:void 0,max:C.type==="percentage"?100:void 0,step:C.type==="percentage"?1:void 0}),C.type==="percentage"&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(tc,{className:"h-4 w-4 text-muted-foreground"})})]})}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description}),e.jsx(D,{})]})},k);case"select":return e.jsx(v,{control:h.control,name:`config.${k}`,render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{children:C.label||C.description}),e.jsxs(J,{onValueChange:N.onChange,defaultValue:N.value,children:[e.jsx(b,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:C.placeholder})})}),e.jsx(Y,{children:C.options?.map(p=>e.jsx(A,{value:p.value,children:p.label},p.value))})]}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description}),e.jsx(D,{})]})},k);case"boolean":return e.jsx(v,{control:h.control,name:`config.${k}`,render:({field:N})=>e.jsxs(f,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:C.label||C.description}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description})]}),e.jsx(b,{children:e.jsx(Z,{checked:N.value,onCheckedChange:N.onChange})})]})},k);case"text":return e.jsx(v,{control:h.control,name:`config.${k}`,render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{children:C.label||C.description}),e.jsx(b,{children:e.jsx(Ds,{placeholder:C.placeholder,...N})}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description}),e.jsx(D,{})]})},k);default:return null}};return a?e.jsxs("div",{className:"space-y-4",children:[e.jsx(oe,{className:"h-4 w-[200px]"}),e.jsx(oe,{className:"h-10 w-full"}),e.jsx(oe,{className:"h-4 w-[200px]"}),e.jsx(oe,{className:"h-10 w-full"})]}):e.jsx(we,{...h,children:e.jsxs("form",{onSubmit:h.handleSubmit(w),className:"space-y-4",children:[u&&Object.entries(u).map(([k,C])=>P(k,C)),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(E,{type:"button",variant:"outline",onClick:n,disabled:i,children:r("config.cancel")}),e.jsx(E,{type:"submit",loading:i,disabled:i,children:r("config.save")})]})]})})}function Um(){const{t:s}=V("plugin"),[n,t]=m.useState(null),[r,a]=m.useState(!1),[l,i]=m.useState(null),[c,u]=m.useState(""),[o,d]=m.useState("all"),[h,w]=m.useState(!1),[P,k]=m.useState(!1),[C,N]=m.useState(!1),p=m.useRef(null),{data:S,isLoading:R,refetch:g}=ne({queryKey:["pluginList"],queryFn:async()=>{const{data:L}=await Rs.getPluginList();return L}});S&&[...new Set(S.map(L=>L.category||"other"))];const _=S?.filter(L=>{const ee=L.name.toLowerCase().includes(c.toLowerCase())||L.description.toLowerCase().includes(c.toLowerCase())||L.code.toLowerCase().includes(c.toLowerCase()),cs=o==="all"||L.category===o;return ee&&cs}),I=async L=>{t(L),Rs.installPlugin(L).then(()=>{$.success(s("messages.installSuccess")),g()}).catch(ee=>{$.error(ee.message||s("messages.installError"))}).finally(()=>{t(null)})},U=async L=>{t(L),Rs.uninstallPlugin(L).then(()=>{$.success(s("messages.uninstallSuccess")),g()}).catch(ee=>{$.error(ee.message||s("messages.uninstallError"))}).finally(()=>{t(null)})},M=async(L,ee)=>{t(L),(ee?Rs.disablePlugin:Rs.enablePlugin)(L).then(()=>{$.success(s(ee?"messages.disableSuccess":"messages.enableSuccess")),g()}).catch(Te=>{$.error(Te.message||s(ee?"messages.disableError":"messages.enableError"))}).finally(()=>{t(null)})},X=L=>{S?.find(ee=>ee.code===L),i(L),a(!0)},ie=async L=>{if(!L.name.endsWith(".zip")){$.error(s("upload.error.format"));return}w(!0),Rs.uploadPlugin(L).then(()=>{$.success(s("messages.uploadSuccess")),k(!1),g()}).catch(ee=>{$.error(ee.message||s("messages.uploadError"))}).finally(()=>{w(!1),p.current&&(p.current.value="")})},H=L=>{L.preventDefault(),L.stopPropagation(),L.type==="dragenter"||L.type==="dragover"?N(!0):L.type==="dragleave"&&N(!1)},te=L=>{L.preventDefault(),L.stopPropagation(),N(!1),L.dataTransfer.files&&L.dataTransfer.files[0]&&ie(L.dataTransfer.files[0])},q=async L=>{t(L),Rs.deletePlugin(L).then(()=>{$.success(s("messages.deleteSuccess")),g()}).catch(ee=>{$.error(ee.message||s("messages.deleteError"))}).finally(()=>{t(null)})};return e.jsxs(Ve,{children:[e.jsxs(Fe,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(mn,{className:"h-6 w-6"}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s("title")})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"mb-8 space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"relative max-w-sm flex-1",children:[e.jsx(un,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(T,{placeholder:s("search.placeholder"),value:c,onChange:L=>u(L.target.value),className:"pl-9"})]}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs(E,{onClick:()=>k(!0),variant:"outline",className:"shrink-0",size:"sm",children:[e.jsx(zt,{className:"mr-2 h-4 w-4"}),s("upload.button")]})})]}),e.jsxs(wa,{defaultValue:"all",className:"w-full",children:[e.jsxs(Gt,{children:[e.jsx(Be,{value:"all",children:s("tabs.all")}),e.jsx(Be,{value:"installed",children:s("tabs.installed")}),e.jsx(Be,{value:"available",children:s("tabs.available")})]}),e.jsx(Ns,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Ua,{}),e.jsx(Ua,{}),e.jsx(Ua,{})]}):_?.map(L=>e.jsx(Ha,{plugin:L,onInstall:I,onUninstall:U,onToggleEnable:M,onOpenConfig:X,onDelete:q,isLoading:n===L.name},L.name))})}),e.jsx(Ns,{value:"installed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:_?.filter(L=>L.is_installed).map(L=>e.jsx(Ha,{plugin:L,onInstall:I,onUninstall:U,onToggleEnable:M,onOpenConfig:X,onDelete:q,isLoading:n===L.name},L.name))})}),e.jsx(Ns,{value:"available",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:_?.filter(L=>!L.is_installed).map(L=>e.jsx(Ha,{plugin:L,onInstall:I,onUninstall:U,onToggleEnable:M,onOpenConfig:X,onDelete:q,isLoading:n===L.name},L.code))})})]})]}),e.jsx(pe,{open:r,onOpenChange:a,children:e.jsxs(ue,{className:"sm:max-w-lg",children:[e.jsxs(ve,{children:[e.jsxs(ge,{children:[S?.find(L=>L.code===l)?.name," ",s("config.title")]}),e.jsx(Le,{children:s("config.description")})]}),l&&e.jsx(Hm,{pluginName:l,onClose:()=>a(!1),onSuccess:()=>{a(!1),g()}})]})}),e.jsx(pe,{open:P,onOpenChange:k,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:s("upload.title")}),e.jsx(Le,{children:s("upload.description")})]}),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",C&&"border-primary/50 bg-muted/50"),onDragEnter:H,onDragLeave:H,onDragOver:H,onDrop:te,children:[e.jsx("input",{type:"file",ref:p,className:"hidden",accept:".zip",onChange:L=>{const ee=L.target.files?.[0];ee&&ie(ee)}}),h?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:s("upload.uploading")})]}):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(zt,{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:[s("upload.dragText")," ",e.jsx("button",{type:"button",onClick:()=>p.current?.click(),className:"mx-1 text-primary hover:underline",children:s("upload.clickText")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("upload.supportText")})]})]})})]})]})})]})]})}function Ha({plugin:s,onInstall:n,onUninstall:t,onToggleEnable:r,onOpenConfig:a,onDelete:l,isLoading:i}){const{t:c}=V("plugin");return e.jsxs(We,{className:"group relative overflow-hidden transition-all hover:shadow-md",children:[e.jsxs(Ze,{children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ws,{children:s.name}),s.is_installed&&e.jsx(G,{variant:s.is_enabled?"success":"secondary",children:s.is_enabled?c("status.enabled"):c("status.disabled")})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(mn,{className:"h-4 w-4"}),e.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:s.code})]}),e.jsxs("div",{children:["v",s.version]})]})]})}),e.jsx(Xs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"mt-2",children:s.description}),e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-1",children:[c("author"),": ",s.author]})})]})})]}),e.jsx(es,{children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.is_installed?e.jsxs(e.Fragment,{children:[e.jsxs(E,{variant:"outline",size:"sm",onClick:()=>a(s.code),disabled:!s.is_enabled||i,children:[e.jsx(ac,{className:"mr-2 h-4 w-4"}),c("button.config")]}),e.jsxs(E,{variant:s.is_enabled?"destructive":"default",size:"sm",onClick:()=>r(s.code,s.is_enabled),disabled:i,children:[e.jsx(nc,{className:"mr-2 h-4 w-4"}),s.is_enabled?c("button.disable"):c("button.enable")]}),e.jsx(ts,{title:c("uninstall.title"),description:c("uninstall.description"),cancelText:c("common:cancel"),confirmText:c("uninstall.button"),variant:"destructive",onConfirm:()=>t(s.code),children:e.jsxs(E,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",disabled:i,children:[e.jsx(ps,{className:"mr-2 h-4 w-4"}),c("button.uninstall")]})})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{onClick:()=>n(s.code),disabled:i,loading:i,children:c("button.install")}),e.jsx(ts,{title:c("delete.title"),description:c("delete.description"),cancelText:c("common:cancel"),confirmText:c("delete.button"),variant:"destructive",onConfirm:()=>l(s.code),children:e.jsx(E,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",disabled:i,children:e.jsx(ps,{className:"h-4 w-4"})})})]})})})]})}function Ua(){return e.jsxs(We,{children:[e.jsxs(Ze,{children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-6 w-[200px]"}),e.jsx(oe,{className:"h-6 w-[80px]"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(oe,{className:"h-5 w-[120px]"}),e.jsx(oe,{className:"h-5 w-[60px]"})]})]})}),e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx(oe,{className:"h-4 w-[300px]"}),e.jsx(oe,{className:"h-4 w-[150px]"})]})]}),e.jsx(es,{children:e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(oe,{className:"h-9 w-[100px]"}),e.jsx(oe,{className:"h-9 w-[100px]"}),e.jsx(oe,{className:"h-8 w-8"})]})})]})}const Km=Object.freeze(Object.defineProperty({__proto__:null,default:Um},Symbol.toStringTag,{value:"Module"})),Bm=(s,n)=>{let t=null;switch(s.field_type){case"input":t=e.jsx(T,{placeholder:s.placeholder,...n});break;case"textarea":t=e.jsx(Ds,{placeholder:s.placeholder,...n});break;case"select":t=e.jsx("select",{className:y(bt({variant:"outline"}),"w-full appearance-none font-normal"),...n,children:s.select_options&&Object.keys(s.select_options).map(r=>e.jsx("option",{value:r,children:s.select_options?.[r]},r))});break;default:t=null;break}return t};function Gm({themeKey:s,themeInfo:n}){const{t}=V("theme"),[r,a]=m.useState(!1),[l,i]=m.useState(!1),[c,u]=m.useState(!1),o=ye({defaultValues:n.configs.reduce((w,P)=>(w[P.field_name]="",w),{})}),d=async()=>{i(!0),Vt.getConfig(s).then(({data:w})=>{Object.entries(w).forEach(([P,k])=>{o.setValue(P,k)})}).finally(()=>{i(!1)})},h=async w=>{u(!0),Vt.updateConfig(s,w).then(()=>{$.success(t("config.success")),a(!1)}).finally(()=>{u(!1)})};return e.jsxs(pe,{open:r,onOpenChange:w=>{a(w),w?d():o.reset()},children:[e.jsx(as,{asChild:!0,children:e.jsx(E,{variant:"outline",children:t("card.configureTheme")})}),e.jsxs(ue,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:t("config.title",{name:n.name})}),e.jsx(Le,{children:t("config.description")})]}),l?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(Lt,{className:"h-6 w-6 animate-spin"})}):e.jsx(we,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(h),className:"space-y-4",children:[n.configs.map(w=>e.jsx(v,{control:o.control,name:w.field_name,render:({field:P})=>e.jsxs(f,{children:[e.jsx(j,{children:w.label}),e.jsx(b,{children:Bm(w,P)}),e.jsx(D,{})]})},w.field_name)),e.jsxs(Pe,{className:"mt-6 gap-2",children:[e.jsx(E,{type:"button",variant:"secondary",onClick:()=>a(!1),children:t("config.cancel")}),e.jsx(E,{type:"submit",loading:c,children:t("config.save")})]})]})})]})]})}function Wm(){const{t:s}=V("theme"),[n,t]=m.useState(null),[r,a]=m.useState(!1),[l,i]=m.useState(!1),[c,u]=m.useState(!1),[o,d]=m.useState(null),h=m.useRef(null),[w,P]=m.useState(0),{data:k,isLoading:C,refetch:N}=ne({queryKey:["themeList"],queryFn:async()=>{const{data:M}=await Vt.getList();return M}}),p=async M=>{t(M),me.updateSystemConfig({frontend_theme:M}).then(()=>{$.success("主题切换成功"),N()}).finally(()=>{t(null)})},S=async M=>{if(!M.name.endsWith(".zip")){$.error(s("upload.error.format"));return}a(!0),Vt.upload(M).then(()=>{$.success("主题上传成功"),i(!1),N()}).finally(()=>{a(!1),h.current&&(h.current.value="")})},R=M=>{M.preventDefault(),M.stopPropagation(),M.type==="dragenter"||M.type==="dragover"?u(!0):M.type==="dragleave"&&u(!1)},g=M=>{M.preventDefault(),M.stopPropagation(),u(!1),M.dataTransfer.files&&M.dataTransfer.files[0]&&S(M.dataTransfer.files[0])},_=()=>{o&&P(M=>M===0?o.images.length-1:M-1)},I=()=>{o&&P(M=>M===o.images.length-1?0:M+1)},U=(M,X)=>{P(0),d({name:M,images:X})};return e.jsxs(Ve,{children:[e.jsxs(Fe,{className:"flex items-center justify-between",children:[e.jsx(Ye,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-muted-foreground",children:s("description")}),e.jsxs(E,{onClick:()=>i(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(zt,{className:"mr-2 h-4 w-4"}),s("upload.button")]})]})]}),e.jsx("section",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3",children:C?e.jsxs(e.Fragment,{children:[e.jsx(qn,{}),e.jsx(qn,{})]}):k?.themes&&Object.entries(k.themes).map(([M,X])=>e.jsx(We,{className:"group relative overflow-hidden transition-all hover:shadow-md",style:{backgroundImage:X.background_url?`url(${X.background_url})`:"none",backgroundSize:"cover",backgroundPosition:"center"},children:e.jsxs("div",{className:y("relative z-10 h-full transition-colors",X.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:[!!X.can_delete&&e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(ts,{title:s("card.delete.title"),description:s("card.delete.description"),confirmText:s("card.delete.button"),variant:"destructive",onConfirm:async()=>{if(M===k?.active){$.error(s("card.delete.error.active"));return}t(M),Vt.drop(M).then(()=>{$.success("主题删除成功"),N()}).finally(()=>{t(null)})},children:e.jsx(E,{disabled:n===M,loading:n===M,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(ps,{className:"h-4 w-4"})})})}),e.jsxs(Ze,{children:[e.jsx(ws,{children:X.name}),e.jsx(Xs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{children:X.description}),X.version&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("card.version",{version:X.version})})]})})]}),e.jsxs(es,{className:"flex items-center justify-end space-x-3",children:[X.images&&Array.isArray(X.images)&&X.images.length>0&&e.jsx(E,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>U(X.name,X.images),children:e.jsx(rc,{className:"h-4 w-4"})}),e.jsx(Gm,{themeKey:M,themeInfo:X}),e.jsx(E,{onClick:()=>p(M),disabled:n===M||M===k.active,loading:n===M,variant:M===k.active?"secondary":"default",children:M===k.active?s("card.currentTheme"):s("card.activateTheme")})]})]})},M))}),e.jsx(pe,{open:l,onOpenChange:i,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:s("upload.title")}),e.jsx(Le,{children:s("upload.description")})]}),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",c&&"border-primary/50 bg-muted/50"),onDragEnter:R,onDragLeave:R,onDragOver:R,onDrop:g,children:[e.jsx("input",{type:"file",ref:h,className:"hidden",accept:".zip",onChange:M=>{const X=M.target.files?.[0];X&&S(X)}}),r?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:s("upload.uploading")})]}):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(zt,{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:[s("upload.dragText")," ",e.jsx("button",{type:"button",onClick:()=>h.current?.click(),className:"mx-1 text-primary hover:underline",children:s("upload.clickText")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("upload.supportText")})]})]})})]})]})}),e.jsx(pe,{open:!!o,onOpenChange:M=>{M||(d(null),P(0))},children:e.jsxs(ue,{className:"max-w-4xl",children:[e.jsxs(ve,{children:[e.jsxs(ge,{children:[o?.name," ",s("preview.title")]}),e.jsx(Le,{className:"text-center",children:o&&s("preview.imageCount",{current:w+1,total:o.images.length})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"aspect-[16/9] overflow-hidden rounded-lg border bg-muted",children:o?.images[w]&&e.jsx("img",{src:o.images[w],alt:`${o.name} 预览图 ${w+1}`,className:"h-full w-full object-contain"})}),o&&o.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(E,{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:_,children:e.jsx(Za,{className:"h-4 w-4"})}),e.jsx(E,{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:I,children:e.jsx(en,{className:"h-4 w-4"})})]})]}),o&&o.images.length>1&&e.jsx("div",{className:"mt-4 flex gap-2 overflow-x-auto pb-2",children:o.images.map((M,X)=>e.jsx("button",{onClick:()=>P(X),className:y("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",w===X?"border-primary":"border-transparent"),children:e.jsx("img",{src:M,alt:`缩略图 ${X+1}`,className:"h-full w-full object-cover"})},X))})]})})]})]})}function qn(){return e.jsxs(We,{children:[e.jsxs(Ze,{children:[e.jsx(oe,{className:"h-6 w-[200px]"}),e.jsx(oe,{className:"h-4 w-[300px]"})]}),e.jsxs(es,{className:"flex items-center justify-end space-x-3",children:[e.jsx(oe,{className:"h-10 w-[100px]"}),e.jsx(oe,{className:"h-10 w-[100px]"})]})]})}const Ym=Object.freeze(Object.defineProperty({__proto__:null,default:Wm},Symbol.toStringTag,{value:"Module"})),jn=m.forwardRef(({className:s,value:n,onChange:t,...r},a)=>{const[l,i]=m.useState("");m.useEffect(()=>{if(l.includes(",")){const u=new Set([...n,...l.split(",").map(o=>o.trim())]);t(Array.from(u)),i("")}},[l,t,n]);const c=()=>{if(l){const u=new Set([...n,l]);t(Array.from(u)),i("")}};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:[n.map(u=>e.jsxs(G,{variant:"secondary",children:[u,e.jsx(B,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{t(n.filter(o=>o!==u))},children:e.jsx(sn,{className:"w-3"})})]},u)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:l,onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"||u.key===","?(u.preventDefault(),c()):u.key==="Backspace"&&l.length===0&&n.length>0&&(u.preventDefault(),t(n.slice(0,-1)))},...r,ref:a})]})});jn.displayName="InputTags";const Jm=x.object({id:x.number().nullable(),title:x.string().min(1).max(250),content:x.string().min(1),show:x.boolean(),tags:x.array(x.string()),img_url:x.string().nullable()}),Qm={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function _l({refetch:s,dialogTrigger:n,type:t="add",defaultFormValues:r=Qm}){const{t:a}=V("notice"),[l,i]=m.useState(!1),c=ye({resolver:_e(Jm),defaultValues:r,mode:"onChange",shouldFocusError:!0}),u=new hn({html:!0});return e.jsx(we,{...c,children:e.jsxs(pe,{onOpenChange:i,open:l,children:[e.jsx(as,{asChild:!0,children:n||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Oe,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add.button")})]})}),e.jsxs(ue,{className:"sm:max-w-[1025px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:a(t==="add"?"form.add.title":"form.edit.title")}),e.jsx(Le,{})]}),e.jsx(v,{control:c.control,name:"title",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.title.label")}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(T,{placeholder:a("form.fields.title.placeholder"),...o})})}),e.jsx(D,{})]})}),e.jsx(v,{control:c.control,name:"content",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.content.label")}),e.jsx(b,{children:e.jsx(pn,{style:{height:"500px"},value:o.value,renderHTML:d=>u.render(d),onChange:({text:d})=>{o.onChange(d)}})}),e.jsx(D,{})]})}),e.jsx(v,{control:c.control,name:"img_url",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.img_url.label")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(T,{type:"text",placeholder:a("form.fields.img_url.placeholder"),...o,value:o.value||""})})}),e.jsx(D,{})]})}),e.jsx(v,{control:c.control,name:"show",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.show.label")}),e.jsx("div",{className:"relative py-2",children:e.jsx(b,{children:e.jsx(Z,{checked:o.value,onCheckedChange:o.onChange})})}),e.jsx(D,{})]})}),e.jsx(v,{control:c.control,name:"tags",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.fields.tags.label")}),e.jsx(b,{children:e.jsx(jn,{value:o.value,onChange:o.onChange,placeholder:a("form.fields.tags.placeholder"),className:"w-full"})}),e.jsx(D,{})]})}),e.jsxs(Pe,{children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{type:"button",variant:"outline",children:a("form.buttons.cancel")})}),e.jsx(E,{type:"submit",onClick:o=>{o.preventDefault(),c.handleSubmit(async d=>{$t.save(d).then(({data:h})=>{h&&($.success(a("form.buttons.success")),s(),i(!1))})})()},children:a("form.buttons.submit")})]})]})]})})}function Xm({table:s,refetch:n,saveOrder:t,isSortMode:r}){const{t:a}=V("notice"),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:[!r&&e.jsx(_l,{refetch:n}),!r&&e.jsx(T,{placeholder:a("table.toolbar.search"),value:s.getColumn("title")?.getFilterValue()??"",onChange:i=>s.getColumn("title")?.setFilterValue(i.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),l&&!r&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:[a("table.toolbar.reset"),e.jsx(ls,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(E,{variant:r?"default":"outline",onClick:t,className:"h-8",size:"sm",children:a(r?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}const Zm=s=>{const{t:n}=V("notice");return[{id:"drag-handle",header:"",cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(lc,{className:"h-4 w-4 cursor-move text-muted-foreground"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.id")}),cell:({row:t})=>e.jsx(G,{variant:"outline",className:"font-mono",children:t.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.show")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(Z,{defaultChecked:t.getValue("show"),onCheckedChange:async()=>{const{data:r}=await $t.updateStatus(t.original.id);r||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.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(z,{className:"justify-end",column:t,title:n("table.columns.actions")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(_l,{refetch:s,dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),type:"edit",defaultFormValues:t.original}),e.jsx(ts,{title:n("table.actions.delete.title"),description:n("table.actions.delete.description"),onConfirm:async()=>{$t.drop(t.original.id).then(()=>{$.success(n("table.actions.delete.success")),s()})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ps,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("table.actions.delete.title")})]})})]}),size:100}]};function eu(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,l]=m.useState([]),[i,c]=m.useState([]),[u,o]=m.useState(!1),[d,h]=m.useState({}),[w,P]=m.useState({pageSize:50,pageIndex:0}),[k,C]=m.useState([]),{refetch:N}=ne({queryKey:["notices"],queryFn:async()=>{const{data:_}=await $t.getList();return C(_),_}});m.useEffect(()=>{r({"drag-handle":u,content:!u,created_at:!u,actions:!u}),P({pageSize:u?99999:50,pageIndex:0})},[u]);const p=(_,I)=>{u&&(_.dataTransfer.setData("text/plain",I.toString()),_.currentTarget.classList.add("opacity-50"))},S=(_,I)=>{if(!u)return;_.preventDefault(),_.currentTarget.classList.remove("bg-muted");const U=parseInt(_.dataTransfer.getData("text/plain"));if(U===I)return;const M=[...k],[X]=M.splice(U,1);M.splice(I,0,X),C(M)},R=async()=>{if(!u){o(!0);return}$t.sort(k.map(_=>_.id)).then(()=>{$.success("排序保存成功"),o(!1),N()}).finally(()=>{o(!1)})},g=is({data:k??[],columns:Zm(N),state:{sorting:i,columnVisibility:t,rowSelection:s,columnFilters:a,columnSizing:d,pagination:w},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:c,onColumnFiltersChange:l,onColumnVisibilityChange:r,onColumnSizingChange:h,onPaginationChange:P,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),getSortedRowModel:js(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Os(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(bs,{table:g,toolbar:_=>e.jsx(Xm,{table:_,refetch:N,saveOrder:R,isSortMode:u}),draggable:u,onDragStart:p,onDragEnd:_=>_.currentTarget.classList.remove("opacity-50"),onDragOver:_=>{_.preventDefault(),_.currentTarget.classList.add("bg-muted")},onDragLeave:_=>_.currentTarget.classList.remove("bg-muted"),onDrop:S,showPagination:!u})})}function su(){const{t:s}=V("notice");return e.jsxs(Ve,{children:[e.jsxs(Fe,{className:"flex items-center justify-between",children:[e.jsx(Ye,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")})}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),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(eu,{})})]})]})}const tu=Object.freeze(Object.defineProperty({__proto__:null,default:su},Symbol.toStringTag,{value:"Module"})),au=x.object({id:x.number().nullable(),language:x.string().max(250),category:x.string().max(250),title:x.string().min(1).max(250),body:x.string().min(1),show:x.boolean()}),nu={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function wl({refreshData:s,dialogTrigger:n,type:t="add",defaultFormValues:r=nu}){const{t:a}=V("knowledge"),[l,i]=m.useState(!1),c=ye({resolver:_e(au),defaultValues:r,mode:"onChange",shouldFocusError:!0}),u=new hn({html:!0});return m.useEffect(()=>{l&&r.id&&vt.getInfo(r.id).then(({data:o})=>{c.reset(o)})},[r.id,c,l]),e.jsxs(pe,{onOpenChange:i,open:l,children:[e.jsx(as,{asChild:!0,children:n||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Oe,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add")})]})}),e.jsxs(ue,{className:"sm:max-w-[1025px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:a(t==="add"?"form.add":"form.edit")}),e.jsx(Le,{})]}),e.jsxs(we,{...c,children:[e.jsx(v,{control:c.control,name:"title",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.title")}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(T,{placeholder:a("form.titlePlaceholder"),...o})})}),e.jsx(D,{})]})}),e.jsx(v,{control:c.control,name:"category",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.category")}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(T,{placeholder:a("form.categoryPlaceholder"),...o})})}),e.jsx(D,{})]})}),e.jsx(v,{control:c.control,name:"language",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.language")}),e.jsx(b,{children:e.jsxs(J,{value:o.value,onValueChange:o.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("form.languagePlaceholder")})}),e.jsx(Y,{children:[{value:"en-US"},{value:"ja-JP"},{value:"ko-KR"},{value:"vi-VN"},{value:"zh-CN"},{value:"zh-TW"}].map(d=>e.jsx(A,{value:d.value,className:"cursor-pointer",children:a(`languages.${d.value}`)},d.value))})]})})]})}),e.jsx(v,{control:c.control,name:"body",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.content")}),e.jsx(b,{children:e.jsx(pn,{style:{height:"500px"},value:o.value,renderHTML:d=>u.render(d),onChange:({text:d})=>{o.onChange(d)}})}),e.jsx(D,{})]})}),e.jsx(v,{control:c.control,name:"show",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.show")}),e.jsx("div",{className:"relative py-2",children:e.jsx(b,{children:e.jsx(Z,{checked:o.value,onCheckedChange:o.onChange})})}),e.jsx(D,{})]})}),e.jsxs(Pe,{children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{type:"button",variant:"outline",children:a("form.cancel")})}),e.jsx(E,{type:"submit",onClick:()=>{c.handleSubmit(o=>{vt.save(o).then(({data:d})=>{d&&(c.reset(),$.success(a("messages.operationSuccess")),i(!1),s())})})()},children:a("form.submit")})]})]})]})]})}function ru({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=new Set(s?.getFilterValue());return e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(ya,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(G,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:a.size>2?e.jsxs(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):t.filter(l=>a.has(l.value)).map(l=>e.jsx(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:l.label},l.value))})]})]})}),e.jsx(vs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:n}),e.jsxs(Ks,{children:[e.jsx(rt,{children:"No results found."}),e.jsx(ss,{children:t.map(l=>{const i=a.has(l.value);return e.jsxs(Me,{onSelect:()=>{i?a.delete(l.value):a.add(l.value);const c=Array.from(a);s?.setFilterValue(c.length?c:void 0)},children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",i?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(et,{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}),r?.get(l.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(l.value)})]},l.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ct,{}),e.jsx(ss,{children:e.jsx(Me,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function lu({table:s,refetch:n,saveOrder:t,isSortMode:r}){const a=s.getState().columnFilters.length>0,{t:l}=V("knowledge");return e.jsxs("div",{className:"flex items-center justify-between",children:[r?e.jsx("p",{className:"text-sm text-muted-foreground",children:l("toolbar.sortModeHint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wl,{refreshData:n}),e.jsx(T,{placeholder:l("toolbar.searchPlaceholder"),value:s.getColumn("title")?.getFilterValue()??"",onChange:i=>s.getColumn("title")?.setFilterValue(i.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(ru,{column:s.getColumn("category"),title:l("columns.category"),options:Array.from(new Set(s.getCoreRowModel().rows.map(i=>i.getValue("category")))).map(i=>({label:i,value:i}))}),a&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[l("toolbar.reset"),e.jsx(ls,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(E,{variant:r?"default":"outline",onClick:t,size:"sm",children:l(r?"toolbar.saveSort":"toolbar.editSort")})})]})}const iu=({refetch:s,isSortMode:n=!1})=>{const{t}=V("knowledge");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(ba,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:r})=>e.jsx(z,{column:r,title:t("columns.id")}),cell:({row:r})=>e.jsx(G,{variant:"outline",className:"justify-center",children:r.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:r})=>e.jsx(z,{column:r,title:t("columns.status")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx(Z,{defaultChecked:r.getValue("show"),onCheckedChange:async()=>{vt.updateStatus({id:r.original.id}).then(({data:a})=>{a||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:r})=>e.jsx(z,{column:r,title:t("columns.title")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"line-clamp-2 font-medium",children:r.getValue("title")})}),enableSorting:!0,size:600},{accessorKey:"category",header:({column:r})=>e.jsx(z,{column:r,title:t("columns.category")}),cell:({row:r})=>e.jsx(G,{variant:"secondary",className:"max-w-[180px] truncate",children:r.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:r})=>e.jsx(z,{className:"justify-end",column:r,title:t("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx(wl,{refreshData:s,dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:t("form.edit")})]}),type:"edit",defaultFormValues:r.original}),e.jsx(ts,{title:t("messages.deleteConfirm"),description:t("messages.deleteDescription"),confirmText:t("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{vt.drop({id:r.original.id}).then(({data:a})=>{a&&($.success(t("messages.operationSuccess")),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ps,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:t("messages.deleteButton")})]})})]}),size:100}]};function ou(){const[s,n]=m.useState([]),[t,r]=m.useState([]),[a,l]=m.useState(!1),[i,c]=m.useState([]),[u,o]=m.useState({"drag-handle":!1}),[d,h]=m.useState({pageSize:20,pageIndex:0}),{refetch:w,isLoading:P,data:k}=ne({queryKey:["knowledge"],queryFn:async()=>{const{data:R}=await vt.getList();return c(R||[]),R}});m.useEffect(()=>{o({"drag-handle":a,actions:!a}),h({pageSize:a?99999:10,pageIndex:0})},[a]);const C=(R,g)=>{a&&(R.dataTransfer.setData("text/plain",g.toString()),R.currentTarget.classList.add("opacity-50"))},N=(R,g)=>{if(!a)return;R.preventDefault(),R.currentTarget.classList.remove("bg-muted");const _=parseInt(R.dataTransfer.getData("text/plain"));if(_===g)return;const I=[...i],[U]=I.splice(_,1);I.splice(g,0,U),c(I)},p=async()=>{a?vt.sort({ids:i.map(R=>R.id)}).then(()=>{w(),l(!1),$.success("排序保存成功")}):l(!0)},S=is({data:i,columns:iu({refetch:w,isSortMode:a}),state:{sorting:t,columnFilters:s,columnVisibility:u,pagination:d},onSortingChange:r,onColumnFiltersChange:n,onColumnVisibilityChange:o,onPaginationChange:h,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),getSortedRowModel:js(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(bs,{table:S,toolbar:R=>e.jsx(lu,{table:R,refetch:w,saveOrder:p,isSortMode:a}),draggable:a,onDragStart:C,onDragEnd:R=>R.currentTarget.classList.remove("opacity-50"),onDragOver:R=>{R.preventDefault(),R.currentTarget.classList.add("bg-muted")},onDragLeave:R=>R.currentTarget.classList.remove("bg-muted"),onDrop:N,showPagination:!a})}function cu(){const{t:s}=V("knowledge");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),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(ou,{})})]})]})}const du=Object.freeze(Object.defineProperty({__proto__:null,default:cu},Symbol.toStringTag,{value:"Module"}));function mu(s,n){const[t,r]=m.useState(s);return m.useEffect(()=>{const a=setTimeout(()=>r(s),n);return()=>{clearTimeout(a)}},[s,n]),t}function Ka(s,n){if(s.length===0)return{};if(!n)return{"":s};const t={};return s.forEach(r=>{const a=r[n]||"";t[a]||(t[a]=[]),t[a].push(r)}),t}function uu(s,n){const t=JSON.parse(JSON.stringify(s));for(const[r,a]of Object.entries(t))t[r]=a.filter(l=>!n.find(i=>i.value===l.value));return t}function xu(s,n){for(const[,t]of Object.entries(s))if(t.some(r=>n.find(a=>a.value===r.value)))return!0;return!1}const Cl=m.forwardRef(({className:s,...n},t)=>ic(a=>a.filtered.count===0)?e.jsx("div",{ref:t,className:y("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...n}):null);Cl.displayName="CommandEmpty";const _t=m.forwardRef(({value:s,onChange:n,placeholder:t,defaultOptions:r=[],options:a,delay:l,onSearch:i,loadingIndicator:c,emptyIndicator:u,maxSelected:o=Number.MAX_SAFE_INTEGER,onMaxSelected:d,hidePlaceholderWhenSelected:h,disabled:w,groupBy:P,className:k,badgeClassName:C,selectFirstItem:N=!0,creatable:p=!1,triggerSearchOnFocus:S=!1,commandProps:R,inputProps:g,hideClearAllButton:_=!1},I)=>{const U=m.useRef(null),[M,X]=m.useState(!1),ie=m.useRef(!1),[H,te]=m.useState(!1),[q,L]=m.useState(s||[]),[ee,cs]=m.useState(Ka(r,P)),[Te,re]=m.useState(""),Es=mu(Te,l||500);m.useImperativeHandle(I,()=>({selectedValue:[...q],input:U.current,focus:()=>U.current?.focus()}),[q]);const Ms=m.useCallback(se=>{const de=q.filter(Re=>Re.value!==se.value);L(de),n?.(de)},[n,q]),Wt=m.useCallback(se=>{const de=U.current;de&&((se.key==="Delete"||se.key==="Backspace")&&de.value===""&&q.length>0&&(q[q.length-1].fixed||Ms(q[q.length-1])),se.key==="Escape"&&de.blur())},[Ms,q]);m.useEffect(()=>{s&&L(s)},[s]),m.useEffect(()=>{if(!a||i)return;const se=Ka(a||[],P);JSON.stringify(se)!==JSON.stringify(ee)&&cs(se)},[r,a,P,i,ee]),m.useEffect(()=>{const se=async()=>{te(!0);const Re=await i?.(Es);cs(Ka(Re||[],P)),te(!1)};(async()=>{!i||!M||(S&&await se(),Es&&await se())})()},[Es,P,M,S]);const it=()=>{if(!p||xu(ee,[{value:Te,label:Te}])||q.find(de=>de.value===Te))return;const se=e.jsx(Me,{value:Te,className:"cursor-pointer",onMouseDown:de=>{de.preventDefault(),de.stopPropagation()},onSelect:de=>{if(q.length>=o){d?.(q.length);return}re("");const Re=[...q,{value:de,label:de}];L(Re),n?.(Re)},children:`Create "${Te}"`});if(!i&&Te.length>0||i&&Es.length>0&&!H)return se},Yt=m.useCallback(()=>{if(u)return i&&!p&&Object.keys(ee).length===0?e.jsx(Me,{value:"-",disabled:!0,children:u}):e.jsx(Cl,{children:u})},[p,u,i,ee]),ot=m.useMemo(()=>uu(ee,q),[ee,q]),Va=m.useCallback(()=>{if(R?.filter)return R.filter;if(p)return(se,de)=>se.toLowerCase().includes(de.toLowerCase())?1:-1},[p,R?.filter]),Jt=m.useCallback(()=>{const se=q.filter(de=>de.fixed);L(se),n?.(se)},[n,q]);return e.jsxs(Us,{...R,onKeyDown:se=>{Wt(se),R?.onKeyDown?.(se)},className:y("h-auto overflow-visible bg-transparent",R?.className),shouldFilter:R?.shouldFilter!==void 0?R.shouldFilter:!i,filter:Va(),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":q.length!==0,"cursor-text":!w&&q.length!==0},k),onClick:()=>{w||U.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[q.map(se=>e.jsxs(G,{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",C),"data-fixed":se.fixed,"data-disabled":w||void 0,children:[se.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",(w||se.fixed)&&"hidden"),onKeyDown:de=>{de.key==="Enter"&&Ms(se)},onMouseDown:de=>{de.preventDefault(),de.stopPropagation()},onClick:()=>Ms(se),children:e.jsx(sn,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},se.value)),e.jsx($e.Input,{...g,ref:U,value:Te,disabled:w,onValueChange:se=>{re(se),g?.onValueChange?.(se)},onBlur:se=>{ie.current===!1&&X(!1),g?.onBlur?.(se)},onFocus:se=>{X(!0),S&&i?.(Es),g?.onFocus?.(se)},placeholder:h&&q.length!==0?"":t,className:y("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":h,"px-3 py-2":q.length===0,"ml-1":q.length!==0},g?.className)}),e.jsx("button",{type:"button",onClick:Jt,className:y((_||w||q.length<1||q.filter(se=>se.fixed).length===q.length)&&"hidden"),children:e.jsx(sn,{})})]})}),e.jsx("div",{className:"relative",children:M&&e.jsx(Ks,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{ie.current=!1},onMouseEnter:()=>{ie.current=!0},onMouseUp:()=>{U.current?.focus()},children:H?e.jsx(e.Fragment,{children:c}):e.jsxs(e.Fragment,{children:[Yt(),it(),!N&&e.jsx(Me,{value:"-",className:"hidden"}),Object.entries(ot).map(([se,de])=>e.jsx(ss,{heading:se,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:de.map(Re=>e.jsx(Me,{value:Re.value,disabled:Re.disable,onMouseDown:zs=>{zs.preventDefault(),zs.stopPropagation()},onSelect:()=>{if(q.length>=o){d?.(q.length);return}re("");const zs=[...q,Re];L(zs),n?.(zs)},className:y("cursor-pointer",Re.disable&&"cursor-default text-muted-foreground"),children:Re.label},Re.value))})},se))]})})})]})});_t.displayName="MultipleSelector";const hu=s=>x.object({id:x.number().optional(),name:x.string().min(2,s("messages.nameValidation.min")).max(50,s("messages.nameValidation.max")).regex(/^[a-zA-Z0-9\u4e00-\u9fa5_-]+$/,s("messages.nameValidation.pattern"))});function La({refetch:s,dialogTrigger:n,defaultValues:t={name:""},type:r="add"}){const{t:a}=V("group"),l=ye({resolver:_e(hu(a)),defaultValues:t,mode:"onChange"}),[i,c]=m.useState(!1),[u,o]=m.useState(!1),d=async h=>{o(!0),at.save(h).then(()=>{$.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),s&&s(),l.reset(),c(!1)}).finally(()=>{o(!1)})};return e.jsxs(pe,{open:i,onOpenChange:c,children:[e.jsx(as,{asChild:!0,children:n||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Oe,{icon:"ion:add"}),e.jsx("span",{children:a("form.add")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:a(r==="edit"?"form.edit":"form.create")}),e.jsx(Le,{children:a(r==="edit"?"form.editDescription":"form.createDescription")})]}),e.jsx(we,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(d),className:"space-y-4",children:[e.jsx(v,{control:l.control,name:"name",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.name")}),e.jsx(b,{children:e.jsx(T,{placeholder:a("form.namePlaceholder"),...h,className:"w-full"})}),e.jsx(F,{children:a("form.nameDescription")}),e.jsx(D,{})]})}),e.jsxs(Pe,{className:"gap-2",children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{type:"button",variant:"outline",children:a("form.cancel")})}),e.jsxs(E,{type:"submit",disabled:u||!l.formState.isValid,children:[u&&e.jsx(Lt,{className:"mr-2 h-4 w-4 animate-spin"}),a(r==="edit"?"form.update":"form.create")]})]})]})})]})]})}const Sl=m.createContext(void 0);function pu({children:s,refetch:n}){const[t,r]=m.useState(!1),[a,l]=m.useState(null),[i,c]=m.useState(le.Shadowsocks);return e.jsx(Sl.Provider,{value:{isOpen:t,setIsOpen:r,editingServer:a,setEditingServer:l,serverType:i,setServerType:c,refetch:n},children:s})}function kl(){const s=m.useContext(Sl);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function Ba({dialogTrigger:s,value:n,setValue:t,templateType:r}){const{t:a}=V("server");m.useEffect(()=>{console.log(n)},[n]);const[l,i]=m.useState(!1),[c,u]=m.useState(()=>{if(!n||Object.keys(n).length===0)return"";try{return JSON.stringify(n,null,2)}catch{return""}}),[o,d]=m.useState(null),h=p=>{if(!p)return null;try{const S=JSON.parse(p);return typeof S!="object"||S===null?a("network_settings.validation.must_be_object"):null}catch{return a("network_settings.validation.invalid_json")}},w={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"}}},httpupgrade:{label:"HttpUpgrade",content:{acceptProxyProtocol:!1,path:"/",host:"xray.com",headers:{key:"value"}}},xhttp:{label:"XHTTP",content:{host:"example.com",path:"/yourpath",mode:"auto",extra:{headers:{},xPaddingBytes:"100-1000",noGRPCHeader:!1,noSSEHeader:!1,scMaxEachPostBytes:1e6,scMinPostsIntervalMs:30,scMaxBufferedPosts:30,xmux:{maxConcurrency:"16-32",maxConnections:0,cMaxReuseTimes:"64-128",cMaxLifetimeMs:0,hMaxRequestTimes:"800-900",hKeepAlivePeriod:0},downloadSettings:{address:"",port:443,network:"xhttp",security:"tls",tlsSettings:{},xhttpSettings:{path:"/yourpath"},sockopt:{}}}}}},P=()=>{switch(r){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];case"httpupgrade":return["httpupgrade"];case"xhttp":return["xhttp"];default:return[]}},k=()=>{const p=h(c||"");if(p){$.error(p);return}try{if(!c){t(null),i(!1);return}t(JSON.parse(c)),i(!1)}catch{$.error(a("network_settings.errors.save_failed"))}},C=p=>{u(p),d(h(p))},N=p=>{const S=w[p];if(S){const R=JSON.stringify(S.content,null,2);u(R),d(null)}};return m.useEffect(()=>{l&&console.log(n)},[l,n]),m.useEffect(()=>{l&&n&&Object.keys(n).length>0&&u(JSON.stringify(n,null,2))},[l,n]),e.jsxs(pe,{open:l,onOpenChange:p=>{!p&&l&&k(),i(p)},children:[e.jsx(as,{asChild:!0,children:s??e.jsx(B,{variant:"link",children:a("network_settings.edit_protocol")})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsx(ve,{children:e.jsx(ge,{children:a("network_settings.edit_protocol_config")})}),e.jsxs("div",{className:"space-y-4",children:[P().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:P().map(p=>e.jsx(B,{variant:"outline",size:"sm",onClick:()=>N(p),children:a("network_settings.use_template",{template:w[p].label})},p))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ds,{className:`min-h-[200px] font-mono text-sm ${o?"border-red-500 focus-visible:ring-red-500":""}`,value:c,placeholder:P().length>0?a("network_settings.json_config_placeholder_with_template"):a("network_settings.json_config_placeholder"),onChange:p=>C(p.target.value)}),o&&e.jsx("p",{className:"text-sm text-red-500",children:o})]})]}),e.jsxs(Pe,{className:"gap-2",children:[e.jsx(B,{variant:"outline",onClick:()=>i(!1),children:a("common.cancel")}),e.jsx(B,{onClick:k,disabled:!!o,children:a("common.confirm")})]})]})]})}function Eh(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 gu={},fu=Object.freeze(Object.defineProperty({__proto__:null,default:gu},Symbol.toStringTag,{value:"Module"})),Ph=yc(fu),Hn=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),ju=()=>{try{const s=oc.box.keyPair(),n=Hn(Vn.encodeBase64(s.secretKey)),t=Hn(Vn.encodeBase64(s.publicKey));return{privateKey:n,publicKey:t}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},vu=()=>{try{return ju()}catch(s){throw console.error("Error generating key pair:",s),s}},bu=s=>{const n=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(n),Array.from(n).map(t=>t.toString(16).padStart(2,"0")).join("").substring(0,s)},yu=()=>{const s=Math.floor(Math.random()*8)*2+2;return bu(s)},Nu=x.object({cipher:x.string().default("aes-128-gcm"),plugin:x.string().optional().default("none"),plugin_opts:x.string().optional().default(""),client_fingerprint:x.string().optional().default("chrome")}),_u=x.object({tls:x.coerce.number().default(0),tls_settings:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({}),network:x.string().default("tcp"),network_settings:x.record(x.any()).default({})}),wu=x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1),network:x.string().default("tcp"),network_settings:x.record(x.any()).default({})}),Cu=x.object({version:x.coerce.number().default(2),alpn:x.string().default("h2"),obfs:x.object({open:x.coerce.boolean().default(!1),type:x.string().default("salamander"),password:x.string().default("")}).default({}),tls:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({}),bandwidth:x.object({up:x.string().default(""),down:x.string().default("")}).default({}),hop_interval:x.number().optional(),port_range:x.string().optional()}),Su=x.object({tls:x.coerce.number().default(0),tls_settings:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({}),reality_settings:x.object({server_port:x.coerce.number().default(443),server_name:x.string().default(""),allow_insecure:x.boolean().default(!1),public_key:x.string().default(""),private_key:x.string().default(""),short_id:x.string().default("")}).default({}),network:x.string().default("tcp"),network_settings:x.record(x.any()).default({}),flow:x.string().default("")}),ku=x.object({version:x.coerce.number().default(5),congestion_control:x.string().default("bbr"),alpn:x.array(x.string()).default(["h3"]),udp_relay_mode:x.string().default("native"),tls:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({})}),Tu=x.object({}),Du=x.object({tls:x.coerce.number().default(0),tls_settings:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({})}),Eu=x.object({tls:x.coerce.number().default(0),tls_settings:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({})}),Pu=x.object({transport:x.string().default("tcp"),multiplexing:x.string().default("MULTIPLEXING_LOW")}),Ru=x.object({padding_scheme:x.array(x.string()).optional().default([]),tls:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({})}),De={shadowsocks:{schema:Nu,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"],plugins:[{value:"none",label:"None"},{value:"obfs",label:"Simple Obfs"},{value:"v2ray-plugin",label:"V2Ray Plugin"}],clientFingerprints:[{value:"chrome",label:"Chrome"},{value:"firefox",label:"Firefox"},{value:"safari",label:"Safari"},{value:"ios",label:"iOS"}]},vmess:{schema:_u,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:wu,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Cu,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:Su,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"]},tuic:{schema:ku,versions:["5","4"],congestionControls:["bbr","cubic","new_reno"],alpnOptions:[{value:"h3",label:"HTTP/3"},{value:"h2",label:"HTTP/2"},{value:"http/1.1",label:"HTTP/1.1"}],udpRelayModes:[{value:"native",label:"Native"},{value:"quic",label:"QUIC"}]},socks:{schema:Tu},naive:{schema:Eu},http:{schema:Du},mieru:{schema:Pu,transportOptions:[{value:"tcp",label:"TCP"},{value:"udp",label:"UDP"}],multiplexingOptions:[{value:"MULTIPLEXING_OFF",label:"Off"},{value:"MULTIPLEXING_LOW",label:"Low"},{value:"MULTIPLEXING_MIDDLE",label:"Middle"},{value:"MULTIPLEXING_HIGH",label:"High"}]},anytls:{schema:Ru,defaultPaddingScheme:["stop=8","0=30-30","1=100-400","2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000","3=9-9,500-1000","4=500-1000","5=500-1000","6=500-1000","7=500-1000"]}},Iu=({serverType:s,value:n,onChange:t})=>{const{t:r}=V("server"),a=s?De[s]:null,l=a?.schema||x.record(x.any()),i=s?l.parse({}):{},c=ye({resolver:_e(l),defaultValues:i,mode:"onChange"});if(m.useEffect(()=>{if(!n||Object.keys(n).length===0){if(s){const g=l.parse({});c.reset(g)}}else c.reset(n)},[s,n,t,c,l]),m.useEffect(()=>{const g=c.watch(_=>{t(_)});return()=>g.unsubscribe()},[c,t]),!s||!a)return null;const R={shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"cipher",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.shadowsocks.cipher.label")}),e.jsx(b,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.shadowsocks.cipher.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.shadowsocks.ciphers.map(_=>e.jsx(A,{value:_,children:_},_))})})]})})]})}),e.jsx(v,{control:c.control,name:"plugin",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.shadowsocks.plugin.label","插件")}),e.jsx(b,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value||"none",children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.shadowsocks.plugin.placeholder","选择插件")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.shadowsocks.plugins.map(_=>e.jsx(A,{value:_.value,children:_.label},_.value))})})]})}),e.jsx(F,{children:g.value&&g.value!=="none"&&e.jsxs(e.Fragment,{children:[g.value==="obfs"&&r("dynamic_form.shadowsocks.plugin.obfs_hint","提示:配置格式如 obfs=http;obfs-host=www.bing.com;path=/"),g.value==="v2ray-plugin"&&r("dynamic_form.shadowsocks.plugin.v2ray_hint","提示:WebSocket模式格式为 mode=websocket;host=mydomain.me;path=/;tls=true,QUIC模式格式为 mode=quic;host=mydomain.me")]})})]})}),c.watch("plugin")&&c.watch("plugin")!=="none"&&e.jsx(v,{control:c.control,name:"plugin_opts",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.shadowsocks.plugin_opts.label","插件选项")}),e.jsx(F,{children:r("dynamic_form.shadowsocks.plugin_opts.description","按照 key=value;key2=value2 格式输入插件选项")}),e.jsx(b,{children:e.jsx(T,{type:"text",placeholder:r("dynamic_form.shadowsocks.plugin_opts.placeholder","例如: mode=tls;host=bing.com"),...g})})]})}),(c.watch("plugin")==="shadow-tls"||c.watch("plugin")==="restls")&&e.jsx(v,{control:c.control,name:"client_fingerprint",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.shadowsocks.client_fingerprint","客户端指纹")}),e.jsx(b,{children:e.jsxs(J,{value:g.value||"chrome",onValueChange:g.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.shadowsocks.client_fingerprint_placeholder","选择客户端指纹")})}),e.jsx(Y,{children:De.shadowsocks.clientFingerprints.map(_=>e.jsx(A,{value:_.value,children:_.label},_.value))})]})}),e.jsx(F,{children:r("dynamic_form.shadowsocks.client_fingerprint_description","客户端伪装指纹,用于降低被识别风险")})]})})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"tls",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.vmess.tls.label")}),e.jsx(b,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:_=>g.onChange(Number(_)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vmess.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:r("dynamic_form.vmess.tls.disabled")}),e.jsx(A,{value:"1",children:r("dynamic_form.vmess.tls.enabled")})]})]})})]})}),c.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.vmess.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.vmess.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:c.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.vmess.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),e.jsx(v,{control:c.control,name:"network",render:({field:g})=>e.jsxs(f,{children:[e.jsxs(j,{children:[r("dynamic_form.vmess.network.label"),e.jsx(Ba,{value:c.watch("network_settings"),setValue:_=>c.setValue("network_settings",_),templateType:c.watch("network")})]}),e.jsx(b,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vmess.network.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.vmess.networkOptions.map(_=>e.jsx(A,{value:_.value,className:"cursor-pointer",children:_.label},_.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.trojan.server_name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.trojan.server_name.placeholder"),...g,value:g.value||""})})]})}),e.jsx(v,{control:c.control,name:"allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.trojan.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value||!1,onCheckedChange:g.onChange})})})]})})]}),e.jsx(v,{control:c.control,name:"network",render:({field:g})=>e.jsxs(f,{children:[e.jsxs(j,{children:[r("dynamic_form.trojan.network.label"),e.jsx(Ba,{value:c.watch("network_settings")||{},setValue:_=>c.setValue("network_settings",_),templateType:c.watch("network")||"tcp"})]}),e.jsx(b,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value||"tcp",children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.trojan.network.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.trojan.networkOptions.map(_=>e.jsx(A,{value:_.value,className:"cursor-pointer",children:_.label},_.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"version",render:({field:g})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:r("dynamic_form.hysteria.version.label")}),e.jsx(b,{children:e.jsxs(J,{value:(g.value||2).toString(),onValueChange:_=>g.onChange(Number(_)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.hysteria.version.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.hysteria.versions.map(_=>e.jsxs(A,{value:_,className:"cursor-pointer",children:["V",_]},_))})})]})})]})}),c.watch("version")==1&&e.jsx(v,{control:c.control,name:"alpn",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.hysteria.alpn.label")}),e.jsx(b,{children:e.jsxs(J,{value:g.value||"h2",onValueChange:g.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.hysteria.alpn.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.hysteria.alpnOptions.map(_=>e.jsx(A,{value:_,children:_},_))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"obfs.open",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.hysteria.obfs.label")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value||!1,onCheckedChange:g.onChange})})})]})}),!!c.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[c.watch("version")=="2"&&e.jsx(v,{control:c.control,name:"obfs.type",render:({field:g})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:r("dynamic_form.hysteria.obfs.type.label")}),e.jsx(b,{children:e.jsxs(J,{value:g.value||"salamander",onValueChange:g.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.hysteria.obfs.type.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:e.jsx(A,{value:"salamander",children:r("dynamic_form.hysteria.obfs.type.salamander")})})})]})})]})}),e.jsx(v,{control:c.control,name:"obfs.password",render:({field:g})=>e.jsxs(f,{className:c.watch("version")==2?"w-full":"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.hysteria.obfs.password.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.hysteria.obfs.password.placeholder"),...g,value:g.value||"",className:"pr-9"})}),e.jsx(B,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",I=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(U=>_[U%_.length]).join("");c.setValue("obfs.password",I),$.success(r("dynamic_form.hysteria.obfs.password.generate_success"))},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(Oe,{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(v,{control:c.control,name:"tls.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.hysteria.tls.server_name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.hysteria.tls.server_name.placeholder"),...g,value:g.value||""})})]})}),e.jsx(v,{control:c.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.hysteria.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value||!1,onCheckedChange:g.onChange})})})]})})]}),e.jsx(v,{control:c.control,name:"bandwidth.up",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.hysteria.bandwidth.up.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:r("dynamic_form.hysteria.bandwidth.up.placeholder")+(c.watch("version")==2?r("dynamic_form.hysteria.bandwidth.up.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...g,value:g.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:r("dynamic_form.hysteria.bandwidth.up.suffix")})})]})]})}),e.jsx(v,{control:c.control,name:"bandwidth.down",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.hysteria.bandwidth.down.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:r("dynamic_form.hysteria.bandwidth.down.placeholder")+(c.watch("version")==2?r("dynamic_form.hysteria.bandwidth.down.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...g,value:g.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:r("dynamic_form.hysteria.bandwidth.down.suffix")})})]})]})}),e.jsx(e.Fragment,{children:e.jsx(v,{control:c.control,name:"hop_interval",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.hysteria.hop_interval.label","Hop 间隔 (秒)")}),e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:r("dynamic_form.hysteria.hop_interval.placeholder","例如: 30"),...g,value:g.value||"",onChange:_=>{const I=_.target.value?parseInt(_.target.value):void 0;g.onChange(I)}})}),e.jsx(F,{children:r("dynamic_form.hysteria.hop_interval.description","Hop 间隔时间,单位为秒")})]})})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"tls",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.vless.tls.label")}),e.jsx(b,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:_=>g.onChange(Number(_)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vless.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:r("dynamic_form.vless.tls.none")}),e.jsx(A,{value:"1",children:r("dynamic_form.vless.tls.tls")}),e.jsx(A,{value:"2",children:r("dynamic_form.vless.tls.reality")})]})]})})]})}),c.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.vless.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.vless.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:c.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.vless.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),c.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"reality_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.vless.reality_settings.server_name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.vless.reality_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:c.control,name:"reality_settings.server_port",render:({field:g})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:r("dynamic_form.vless.reality_settings.server_port.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.vless.reality_settings.server_port.placeholder"),...g})})]})}),e.jsx(v,{control:c.control,name:"reality_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.vless.reality_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx(v,{control:c.control,name:"reality_settings.private_key",render:({field:g})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:r("dynamic_form.vless.reality_settings.private_key.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(T,{...g,className:"pr-9"})}),e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(B,{type:"button",variant:"ghost",size:"icon",onClick:()=>{try{const _=vu();c.setValue("reality_settings.private_key",_.privateKey),c.setValue("reality_settings.public_key",_.publicKey),$.success(r("dynamic_form.vless.reality_settings.key_pair.success"))}catch{$.error(r("dynamic_form.vless.reality_settings.key_pair.error"))}},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(Oe,{icon:"ion:key-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(ca,{children:e.jsx(ce,{children:e.jsx("p",{children:r("dynamic_form.vless.reality_settings.key_pair.generate")})})})]})]})]})})}),e.jsx(v,{control:c.control,name:"reality_settings.public_key",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.vless.reality_settings.public_key.label")}),e.jsx(b,{children:e.jsx(T,{...g})})]})}),e.jsx(v,{control:c.control,name:"reality_settings.short_id",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.vless.reality_settings.short_id.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(T,{...g,className:"pr-9",placeholder:r("dynamic_form.vless.reality_settings.short_id.placeholder")})}),e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(B,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const _=yu();c.setValue("reality_settings.short_id",_),$.success(r("dynamic_form.vless.reality_settings.short_id.success"))},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(Oe,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(ca,{children:e.jsx(ce,{children:e.jsx("p",{children:r("dynamic_form.vless.reality_settings.short_id.generate")})})})]})]}),e.jsx(F,{className:"text-xs text-muted-foreground",children:r("dynamic_form.vless.reality_settings.short_id.description")})]})})]}),e.jsx(v,{control:c.control,name:"network",render:({field:g})=>e.jsxs(f,{children:[e.jsxs(j,{children:[r("dynamic_form.vless.network.label"),e.jsx(Ba,{value:c.watch("network_settings"),setValue:_=>c.setValue("network_settings",_),templateType:c.watch("network")})]}),e.jsx(b,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vless.network.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.vless.networkOptions.map(_=>e.jsx(A,{value:_.value,className:"cursor-pointer",children:_.label},_.value))})})]})})]})}),e.jsx(v,{control:c.control,name:"flow",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.vless.flow.label")}),e.jsx(b,{children:e.jsxs(J,{onValueChange:_=>g.onChange(_==="none"?null:_),value:g.value||"none",children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vless.flow.placeholder")})}),e.jsx(Y,{children:De.vless.flowOptions.map(_=>e.jsx(A,{value:_,children:_},_))})]})})]})})]}),tuic:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"version",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.tuic.version.label")}),e.jsx(b,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:_=>g.onChange(Number(_)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.tuic.version.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.tuic.versions.map(_=>e.jsxs(A,{value:_,children:["V",_]},_))})})]})})]})}),e.jsx(v,{control:c.control,name:"congestion_control",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.tuic.congestion_control.label")}),e.jsx(b,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.tuic.congestion_control.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.tuic.congestionControls.map(_=>e.jsx(A,{value:_,children:_.toUpperCase()},_))})})]})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.tuic.tls.server_name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.tuic.tls.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:c.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.tuic.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),e.jsx(v,{control:c.control,name:"alpn",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.tuic.tls.alpn.label")}),e.jsx(b,{children:e.jsx(_t,{options:De.tuic.alpnOptions,onChange:_=>g.onChange(_.map(I=>I.value)),value:De.tuic.alpnOptions.filter(_=>g.value?.includes(_.value)),placeholder:r("dynamic_form.tuic.tls.alpn.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:r("dynamic_form.tuic.tls.alpn.empty")})})})]})}),e.jsx(v,{control:c.control,name:"udp_relay_mode",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.tuic.udp_relay_mode.label")}),e.jsx(b,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.tuic.udp_relay_mode.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.tuic.udpRelayModes.map(_=>e.jsx(A,{value:_.value,children:_.label},_.value))})})]})})]})})]}),socks:()=>e.jsx(e.Fragment,{}),naive:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"tls",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.naive.tls.label")}),e.jsx(b,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:_=>g.onChange(Number(_)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.naive.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:r("dynamic_form.naive.tls.disabled")}),e.jsx(A,{value:"1",children:r("dynamic_form.naive.tls.enabled")})]})]})})]})}),c.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.naive.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.naive.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:c.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.naive.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]}),http:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"tls",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.http.tls.label")}),e.jsx(b,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:_=>g.onChange(Number(_)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.http.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:r("dynamic_form.http.tls.disabled")}),e.jsx(A,{value:"1",children:r("dynamic_form.http.tls.enabled")})]})]})})]})}),c.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.http.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.http.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:c.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.http.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]}),mieru:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"transport",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.mieru.transport.label")}),e.jsx(b,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.mieru.transport.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.mieru.transportOptions.map(_=>e.jsx(A,{value:_.value,children:_.label},_.value))})})]})})]})}),e.jsx(v,{control:c.control,name:"multiplexing",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.mieru.multiplexing.label")}),e.jsx(b,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.mieru.multiplexing.placeholder")})}),e.jsx(Y,{children:e.jsx(Ue,{children:De.mieru.multiplexingOptions.map(_=>e.jsx(A,{value:_.value,children:_.label},_.value))})})]})})]})})]}),anytls:()=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:c.control,name:"padding_scheme",render:({field:g})=>e.jsxs(f,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(j,{children:r("dynamic_form.anytls.padding_scheme.label","AnyTLS 填充方案")}),e.jsx(B,{type:"button",variant:"outline",size:"sm",onClick:()=>{c.setValue("padding_scheme",De.anytls.defaultPaddingScheme),$.success(r("dynamic_form.anytls.padding_scheme.default_success","已设置默认填充方案"))},className:"h-7 px-2",children:r("dynamic_form.anytls.padding_scheme.use_default","使用默认方案")})]}),e.jsx(F,{children:r("dynamic_form.anytls.padding_scheme.description","每行一个填充规则,格式如: stop=8, 0=30-30")}),e.jsx(b,{children:e.jsx("textarea",{className:"flex min-h-[100px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:r("dynamic_form.anytls.padding_scheme.placeholder",`例如: +`).filter(Boolean);i.onChange(h),u(n.getValues())}})}),e.jsx(F,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"recaptcha_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.recaptcha.enable.label")}),e.jsx(F,{children:s("safe.form.recaptcha.enable.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),n.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:n.control,name:"recaptcha_site_key",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.recaptcha.siteKey.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.recaptcha.siteKey.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsx(F,{children:s("safe.form.recaptcha.siteKey.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"recaptcha_key",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.recaptcha.key.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.recaptcha.key.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsx(F,{children:s("safe.form.recaptcha.key.description")}),e.jsx(P,{})]})})]}),e.jsx(v,{control:n.control,name:"register_limit_by_ip_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(F,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),n.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:n.control,name:"register_limit_count",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.registerLimit.count.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.registerLimit.count.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsx(F,{children:s("safe.form.registerLimit.count.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"register_limit_expire",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.registerLimit.expire.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.registerLimit.expire.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsx(F,{children:s("safe.form.registerLimit.expire.description")}),e.jsx(P,{})]})})]}),e.jsx(v,{control:n.control,name:"password_limit_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("safe.form.passwordLimit.enable.label")}),e.jsx(F,{children:s("safe.form.passwordLimit.enable.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),n.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:n.control,name:"password_limit_count",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.passwordLimit.count.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.passwordLimit.count.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsx(F,{children:s("safe.form.passwordLimit.count.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"password_limit_expire",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("safe.form.passwordLimit.expire.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.passwordLimit.expire.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsx(F,{children:s("safe.form.passwordLimit.expire.description")}),e.jsx(P,{})]})})]}),a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("safe.form.saving")})]})})}function mm(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("safe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("safe.description")})]}),e.jsx(ke,{}),e.jsx(dm,{})]})}const um=Object.freeze(Object.defineProperty({__proto__:null,default:mm},Symbol.toStringTag,{value:"Module"})),xm=x.object({plan_change_enable:x.boolean().nullable().default(!1),reset_traffic_method:x.coerce.number().nullable().default(0),surplus_enable:x.boolean().nullable().default(!1),new_order_event_id:x.coerce.number().nullable().default(0),renew_order_event_id:x.coerce.number().nullable().default(0),change_order_event_id:x.coerce.number().nullable().default(0),show_info_to_server_enable:x.boolean().nullable().default(!1),show_protocol_to_server_enable:x.boolean().nullable().default(!1),default_remind_expire:x.boolean().nullable().default(!1),default_remind_traffic:x.boolean().nullable().default(!1),subscribe_path:x.string().nullable().default("s")}),hm={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,subscribe_path:"s"};function pm(){const{t:s}=V("settings"),[a,t]=m.useState(!1),l=m.useRef(null),n=ye({resolver:_e(xm),defaultValues:hm,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","subscribe"],queryFn:()=>me.getSettings("subscribe")}),{mutateAsync:r}=gs({mutationFn:me.saveSettings,onSuccess:i=>{i.data&&A.success(s("common.autoSaved"))}});m.useEffect(()=>{if(o?.data?.subscribe){const i=o?.data?.subscribe;Object.entries(i).forEach(([d,h])=>{n.setValue(d,h)}),l.current=i}},[o]);const c=m.useCallback(Se.debounce(async i=>{if(!Se.isEqual(i,l.current)){t(!0);try{await r(i),l.current=i}finally{t(!1)}}},1e3),[r]),u=m.useCallback(i=>{c(i)},[c]);return m.useEffect(()=>{const i=n.watch(d=>{u(d)});return()=>i.unsubscribe()},[n.watch,u]),e.jsx(we,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:n.control,name:"plan_change_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.plan_change_enable.title")}),e.jsx(F,{children:s("subscribe.plan_change_enable.description")}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"reset_traffic_method",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.reset_traffic_method.title")}),e.jsxs(X,{onValueChange:i.onChange,value:i.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(Y,{children:e.jsx(Z,{placeholder:"请选择重置方式"})})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:s("subscribe.reset_traffic_method.options.monthly_first")}),e.jsx($,{value:"1",children:s("subscribe.reset_traffic_method.options.monthly_reset")}),e.jsx($,{value:"2",children:s("subscribe.reset_traffic_method.options.no_reset")}),e.jsx($,{value:"3",children:s("subscribe.reset_traffic_method.options.yearly_first")}),e.jsx($,{value:"4",children:s("subscribe.reset_traffic_method.options.yearly_reset")})]})]}),e.jsx(F,{children:s("subscribe.reset_traffic_method.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"surplus_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.surplus_enable.title")}),e.jsx(F,{children:s("subscribe.surplus_enable.description")}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"new_order_event_id",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.new_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(X,{onValueChange:i.onChange,value:i.value?.toString(),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:"请选择"})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:s("subscribe.new_order_event.options.no_action")}),e.jsx($,{value:"1",children:s("subscribe.new_order_event.options.reset_traffic")})]})]})})}),e.jsx(F,{children:s("subscribe.new_order_event.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"renew_order_event_id",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.renew_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(X,{onValueChange:i.onChange,value:i.value?.toString(),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:"请选择"})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:s("subscribe.renew_order_event.options.no_action")}),e.jsx($,{value:"1",children:s("subscribe.renew_order_event.options.reset_traffic")})]})]})})}),e.jsx(F,{children:s("subscribe.renew_order_event.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"change_order_event_id",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.change_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(X,{onValueChange:i.onChange,value:i.value?.toString(),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:"请选择"})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:s("subscribe.change_order_event.options.no_action")}),e.jsx($,{value:"1",children:s("subscribe.change_order_event.options.reset_traffic")})]})]})})}),e.jsx(F,{children:s("subscribe.change_order_event.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"subscribe_path",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("subscribe.subscribe_path.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:"subscribe",...i,value:i.value||"",onChange:d=>{i.onChange(d),u(n.getValues())}})}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[s("subscribe.subscribe_path.description"),e.jsx("br",{}),s("subscribe.subscribe_path.current_format",{path:i.value||"s"})]}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"show_info_to_server_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("subscribe.show_info_to_server.title")}),e.jsx(F,{children:s("subscribe.show_info_to_server.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),e.jsx(v,{control:n.control,name:"show_protocol_to_server_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("subscribe.show_protocol_to_server.title")}),e.jsx(F,{children:s("subscribe.show_protocol_to_server.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function gm(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("subscribe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("subscribe.description")})]}),e.jsx(ke,{}),e.jsx(pm,{})]})}const fm=Object.freeze(Object.defineProperty({__proto__:null,default:gm},Symbol.toStringTag,{value:"Module"})),jm=x.object({invite_force:x.boolean().default(!1),invite_commission:x.coerce.string().default("0"),invite_gen_limit:x.coerce.string().default("0"),invite_never_expire:x.boolean().default(!1),commission_first_time_enable:x.boolean().default(!1),commission_auto_check_enable:x.boolean().default(!1),commission_withdraw_limit:x.coerce.string().default("0"),commission_withdraw_method:x.array(x.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:x.boolean().default(!1),commission_distribution_enable:x.boolean().default(!1),commission_distribution_l1:x.coerce.number().default(0),commission_distribution_l2:x.coerce.number().default(0),commission_distribution_l3:x.coerce.number().default(0)}),vm={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 bm(){const{t:s}=V("settings"),[a,t]=m.useState(!1),l=m.useRef(null),n=ye({resolver:_e(jm),defaultValues:vm,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","invite"],queryFn:()=>me.getSettings("invite")}),{mutateAsync:r}=gs({mutationFn:me.saveSettings,onSuccess:i=>{i.data&&A.success(s("common.autoSaved"))}});m.useEffect(()=>{if(o?.data?.invite){const i=o?.data?.invite;Object.entries(i).forEach(([d,h])=>{typeof h=="number"?n.setValue(d,String(h)):n.setValue(d,h)}),l.current=i}},[o]);const c=m.useCallback(Se.debounce(async i=>{if(!Se.isEqual(i,l.current)){t(!0);try{await r(i),l.current=i}finally{t(!1)}}},1e3),[r]),u=m.useCallback(i=>{c(i)},[c]);return m.useEffect(()=>{const i=n.watch(d=>{u(d)});return()=>i.unsubscribe()},[n.watch,u]),e.jsx(we,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:n.control,name:"invite_force",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.invite_force.title")}),e.jsx(F,{children:s("invite.invite_force.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),e.jsx(v,{control:n.control,name:"invite_commission",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("invite.invite_commission.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("invite.invite_commission.placeholder"),...i,value:i.value||""})}),e.jsx(F,{children:s("invite.invite_commission.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"invite_gen_limit",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("invite.invite_gen_limit.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("invite.invite_gen_limit.placeholder"),...i,value:i.value||""})}),e.jsx(F,{children:s("invite.invite_gen_limit.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"invite_never_expire",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.invite_never_expire.title")}),e.jsx(F,{children:s("invite.invite_never_expire.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),e.jsx(v,{control:n.control,name:"commission_first_time_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.commission_first_time.title")}),e.jsx(F,{children:s("invite.commission_first_time.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),e.jsx(v,{control:n.control,name:"commission_auto_check_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.commission_auto_check.title")}),e.jsx(F,{children:s("invite.commission_auto_check.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),e.jsx(v,{control:n.control,name:"commission_withdraw_limit",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("invite.commission_withdraw_limit.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("invite.commission_withdraw_limit.placeholder"),...i,value:i.value||""})}),e.jsx(F,{children:s("invite.commission_withdraw_limit.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"commission_withdraw_method",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("invite.commission_withdraw_method.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("invite.commission_withdraw_method.placeholder"),...i,value:Array.isArray(i.value)?i.value.join(","):"",onChange:d=>{const h=d.target.value.split(",").filter(Boolean);i.onChange(h),u(n.getValues())}})}),e.jsx(F,{children:s("invite.commission_withdraw_method.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"withdraw_close_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.withdraw_close.title")}),e.jsx(F,{children:s("invite.withdraw_close.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),e.jsx(v,{control:n.control,name:"commission_distribution_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("invite.commission_distribution.title")}),e.jsx(F,{children:s("invite.commission_distribution.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:d=>{i.onChange(d),u(n.getValues())}})})]})}),n.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:n.control,name:"commission_distribution_l1",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:s("invite.commission_distribution.l1")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...i,value:i.value||"",onChange:d=>{const h=d.target.value?Number(d.target.value):0;i.onChange(h),u(n.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"commission_distribution_l2",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:s("invite.commission_distribution.l2")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...i,value:i.value||"",onChange:d=>{const h=d.target.value?Number(d.target.value):0;i.onChange(h),u(n.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"commission_distribution_l3",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:s("invite.commission_distribution.l3")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...i,value:i.value||"",onChange:d=>{const h=d.target.value?Number(d.target.value):0;i.onChange(h),u(n.getValues())}})}),e.jsx(P,{})]})})]}),a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("invite.saving")})]})})}function ym(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("invite.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("invite.description")})]}),e.jsx(ke,{}),e.jsx(bm,{})]})}const Nm=Object.freeze(Object.defineProperty({__proto__:null,default:ym},Symbol.toStringTag,{value:"Module"})),_m=x.object({frontend_theme:x.string().nullable(),frontend_theme_sidebar:x.string().nullable(),frontend_theme_header:x.string().nullable(),frontend_theme_color:x.string().nullable(),frontend_background_url:x.string().url().nullable()}),wm={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function Cm(){const{data:s}=ne({queryKey:["settings","frontend"],queryFn:()=>me.getSettings("frontend")}),a=ye({resolver:_e(_m),defaultValues:wm,mode:"onChange"});m.useEffect(()=>{if(s?.data?.frontend){const l=s?.data?.frontend;Object.entries(l).forEach(([n,o])=>{a.setValue(n,o)})}},[s]);function t(l){me.saveSettings(l).then(({data:n})=>{n&&A.success("更新成功")})}return e.jsx(we,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(t),className:"space-y-8",children:[e.jsx(v,{control:a.control,name:"frontend_theme_sidebar",render:({field:l})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:"边栏风格"}),e.jsx(F,{children:"边栏风格"})]}),e.jsx(b,{children:e.jsx(ee,{checked:l.value,onCheckedChange:l.onChange})})]})}),e.jsx(v,{control:a.control,name:"frontend_theme_header",render:({field:l})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:"头部风格"}),e.jsx(F,{children:"边栏风格"})]}),e.jsx(b,{children:e.jsx(ee,{checked:l.value,onCheckedChange:l.onChange})})]})}),e.jsx(v,{control:a.control,name:"frontend_theme_color",render:({field:l})=>e.jsxs(f,{children:[e.jsx(j,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(b,{children:e.jsxs("select",{className:y(wt({variant:"outline"}),"w-[200px] appearance-none font-normal"),...l,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(pn,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(F,{children:"主题色"}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"frontend_background_url",render:({field:l})=>e.jsxs(f,{children:[e.jsx(j,{children:"背景"}),e.jsx(b,{children:e.jsx(D,{placeholder:"请输入图片地址",...l})}),e.jsx(F,{children:"将会在后台登录页面进行展示。"}),e.jsx(P,{})]})}),e.jsx(E,{type:"submit",children:"保存设置"})]})})}function Sm(){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(ke,{}),e.jsx(Cm,{})]})}const km=Object.freeze(Object.defineProperty({__proto__:null,default:Sm},Symbol.toStringTag,{value:"Module"})),Tm=x.object({server_pull_interval:x.coerce.number().nullable(),server_push_interval:x.coerce.number().nullable(),server_token:x.string().nullable(),device_limit_mode:x.coerce.number().nullable()}),Dm={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function Pm(){const{t:s}=V("settings"),[a,t]=m.useState(!1),l=m.useRef(null),n=ye({resolver:_e(Tm),defaultValues:Dm,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","server"],queryFn:()=>me.getSettings("server")}),{mutateAsync:r}=gs({mutationFn:me.saveSettings,onSuccess:d=>{d.data&&A.success(s("common.AutoSaved"))}});m.useEffect(()=>{if(o?.data.server){const d=o.data.server;Object.entries(d).forEach(([h,_])=>{n.setValue(h,_)}),l.current=d}},[o]);const c=m.useCallback(Se.debounce(async d=>{if(!Se.isEqual(d,l.current)){t(!0);try{await r(d),l.current=d}finally{t(!1)}}},1e3),[r]),u=m.useCallback(d=>{c(d)},[c]);m.useEffect(()=>{const d=n.watch(h=>{u(h)});return()=>d.unsubscribe()},[n.watch,u]);const i=()=>{const d=Math.floor(Math.random()*17)+16,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let _="";for(let k=0;ke.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("server.server_token.title")}),e.jsx(b,{children:e.jsxs("div",{className:"relative",children:[e.jsx(D,{placeholder:s("server.server_token.placeholder"),...d,value:d.value||"",className:"pr-10"}),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2",onClick:h=>{h.preventDefault(),i()},children:e.jsx(lc,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(de,{children:e.jsx("p",{children:s("server.server_token.generate_tooltip")})})]})})]})}),e.jsx(F,{children:s("server.server_token.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"server_pull_interval",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("server.server_pull_interval.title")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("server.server_pull_interval.placeholder"),...d,value:d.value||"",onChange:h=>{const _=h.target.value?Number(h.target.value):null;d.onChange(_)}})}),e.jsx(F,{children:s("server.server_pull_interval.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"server_push_interval",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("server.server_push_interval.title")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("server.server_push_interval.placeholder"),...d,value:d.value||"",onChange:h=>{const _=h.target.value?Number(h.target.value):null;d.onChange(_)}})}),e.jsx(F,{children:s("server.server_push_interval.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"device_limit_mode",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("server.device_limit_mode.title")}),e.jsxs(X,{onValueChange:d.onChange,value:d.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(Y,{children:e.jsx(Z,{placeholder:s("server.device_limit_mode.placeholder")})})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:s("server.device_limit_mode.strict")}),e.jsx($,{value:"1",children:s("server.device_limit_mode.relaxed")})]})]}),e.jsx(F,{children:s("server.device_limit_mode.description")}),e.jsx(P,{})]})}),a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("server.saving")})]})})}function Em(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("server.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("server.description")})]}),e.jsx(ke,{}),e.jsx(Pm,{})]})}const Rm=Object.freeze(Object.defineProperty({__proto__:null,default:Em},Symbol.toStringTag,{value:"Module"}));function Im({open:s,onOpenChange:a,result:t}){const l=!t.error;return e.jsx(pe,{open:s,onOpenChange:a,children:e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l?e.jsx(ql,{className:"h-5 w-5 text-green-500"}):e.jsx(Hl,{className:"h-5 w-5 text-destructive"}),e.jsx(ge,{children:l?"邮件发送成功":"邮件发送失败"})]}),e.jsx(Le,{children:l?"测试邮件已成功发送,请检查收件箱":"发送测试邮件时遇到错误"})]}),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:t.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:t.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:t.template_name})]})]}),t.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:t.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(Nt,{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:t.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:t.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:t.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:t.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:t.config.from.address?`${t.config.from.address}${t.config.from.name?` (${t.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:t.config.username||"未设置"})]})})})]})]})]})})}const Lm=x.object({email_template:x.string().nullable().default("classic"),email_host:x.string().nullable().default(""),email_port:x.coerce.number().nullable().default(465),email_username:x.string().nullable().default(""),email_password:x.string().nullable().default(""),email_encryption:x.string().nullable().default(""),email_from_address:x.string().email().nullable().default(""),remind_mail_enable:x.boolean().nullable().default(!1)});function Vm(){const{t:s}=V("settings"),[a,t]=m.useState(null),[l,n]=m.useState(!1),o=m.useRef(null),[r,c]=m.useState(!1),u=ye({resolver:_e(Lm),defaultValues:{},mode:"onBlur"}),{data:i}=ne({queryKey:["settings","email"],queryFn:()=>me.getSettings("email")}),{data:d}=ne({queryKey:["emailTemplate"],queryFn:()=>me.getEmailTemplate()}),{mutateAsync:h}=gs({mutationFn:me.saveSettings,onSuccess:N=>{N.data&&A.success(s("common.autoSaved"))}}),{mutate:_,isPending:k}=gs({mutationFn:me.sendTestMail,onMutate:()=>{t(null),n(!1)},onSuccess:N=>{t(N.data),n(!0),N.data.error?A.error(s("email.test.error")):A.success(s("email.test.success"))}});m.useEffect(()=>{if(i?.data.email){const N=i.data.email;Object.entries(N).forEach(([g,T])=>{u.setValue(g,T)}),o.current=N}},[i]);const S=m.useCallback(Se.debounce(async N=>{if(!Se.isEqual(N,o.current)){c(!0);try{await h(N),o.current=N}finally{c(!1)}}},1e3),[h]),C=m.useCallback(N=>{S(N)},[S]);return m.useEffect(()=>{const N=u.watch(g=>{C(g)});return()=>N.unsubscribe()},[u.watch,C]),e.jsxs(e.Fragment,{children:[e.jsx(we,{...u,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:u.control,name:"email_host",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_host.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...N,value:N.value||""})}),e.jsx(F,{children:s("email.email_host.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"email_port",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_port.title")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("common.placeholder"),...N,value:N.value||"",onChange:g=>{const T=g.target.value?Number(g.target.value):null;N.onChange(T)}})}),e.jsx(F,{children:s("email.email_port.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"email_encryption",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_encryption.title")}),e.jsxs(X,{onValueChange:N.onChange,value:N.value||"none",children:[e.jsx(b,{children:e.jsx(Y,{children:e.jsx(Z,{placeholder:"请选择加密方式"})})}),e.jsxs(J,{children:[e.jsx($,{value:"none",children:s("email.email_encryption.none")}),e.jsx($,{value:"ssl",children:s("email.email_encryption.ssl")}),e.jsx($,{value:"tls",children:s("email.email_encryption.tls")})]})]}),e.jsx(F,{children:s("email.email_encryption.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"email_username",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_username.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...N,value:N.value||""})}),e.jsx(F,{children:s("email.email_username.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"email_password",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_password.title")}),e.jsx(b,{children:e.jsx(D,{type:"password",placeholder:s("common.placeholder"),...N,value:N.value||""})}),e.jsx(F,{children:s("email.email_password.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"email_from_address",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_from.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...N,value:N.value||""})}),e.jsx(F,{children:s("email.email_from.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"email_template",render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("email.email_template.title")}),e.jsxs(X,{onValueChange:g=>{N.onChange(g),C(u.getValues())},value:N.value||void 0,children:[e.jsx(b,{children:e.jsx(Y,{className:"w-[200px]",children:e.jsx(Z,{placeholder:s("email.email_template.placeholder")})})}),e.jsx(J,{children:d?.data?.map(g=>e.jsx($,{value:g,children:g},g))})]}),e.jsx(F,{children:s("email.email_template.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"remind_mail_enable",render:({field:N})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:s("email.remind_mail.title")}),e.jsx(F,{children:s("email.remind_mail.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:N.value||!1,onCheckedChange:g=>{N.onChange(g),C(u.getValues())}})})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(E,{onClick:()=>_(),loading:k,disabled:k,children:s(k?"email.test.sending":"email.test.title")})})]})}),r&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("saving")}),a&&e.jsx(Im,{open:l,onOpenChange:n,result:a})]})}function Fm(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("email.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("email.description")})]}),e.jsx(ke,{}),e.jsx(Vm,{})]})}const Mm=Object.freeze(Object.defineProperty({__proto__:null,default:Fm},Symbol.toStringTag,{value:"Module"})),Om=x.object({telegram_bot_enable:x.boolean().nullable(),telegram_bot_token:x.string().nullable(),telegram_discuss_link:x.string().nullable()}),zm={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function $m(){const{t:s}=V("settings"),[a,t]=m.useState(!1),l=m.useRef(null),n=ye({resolver:_e(Om),defaultValues:zm,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","telegram"],queryFn:()=>me.getSettings("telegram")}),{mutateAsync:r}=gs({mutationFn:me.saveSettings,onSuccess:h=>{h.data&&A.success(s("common.autoSaved"))}}),{mutate:c,isPending:u}=gs({mutationFn:me.setTelegramWebhook,onSuccess:h=>{h.data&&A.success(s("telegram.webhook.success"))}});m.useEffect(()=>{if(o?.data.telegram){const h=o.data.telegram;Object.entries(h).forEach(([_,k])=>{n.setValue(_,k)}),l.current=h}},[o]);const i=m.useCallback(Se.debounce(async h=>{if(!Se.isEqual(h,l.current)){t(!0);try{await r(h),l.current=h}finally{t(!1)}}},1e3),[r]),d=m.useCallback(h=>{i(h)},[i]);return m.useEffect(()=>{const h=n.watch(_=>{d(_)});return()=>h.unsubscribe()},[n.watch,d]),e.jsx(we,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:n.control,name:"telegram_bot_token",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("telegram.bot_token.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("telegram.bot_token.placeholder"),...h,value:h.value||""})}),e.jsx(F,{children:s("telegram.bot_token.description")}),e.jsx(P,{})]})}),n.watch("telegram_bot_token")&&e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("telegram.webhook.title")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(E,{loading:u,disabled:u,onClick:()=>c(),children:s(u?"telegram.webhook.setting":"telegram.webhook.button")}),a&&e.jsx("span",{className:"text-sm text-muted-foreground",children:s("common.saving")})]}),e.jsx(F,{children:s("telegram.webhook.description")}),e.jsx(P,{})]}),e.jsx(v,{control:n.control,name:"telegram_bot_enable",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("telegram.bot_enable.title")}),e.jsx(F,{children:s("telegram.bot_enable.description")}),e.jsx(b,{children:e.jsx(ee,{checked:h.value||!1,onCheckedChange:_=>{h.onChange(_),d(n.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"telegram_discuss_link",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("telegram.discuss_link.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("telegram.discuss_link.placeholder"),...h,value:h.value||""})}),e.jsx(F,{children:s("telegram.discuss_link.description")}),e.jsx(P,{})]})}),a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Am(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("telegram.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("telegram.description")})]}),e.jsx(ke,{}),e.jsx($m,{})]})}const qm=Object.freeze(Object.defineProperty({__proto__:null,default:Am},Symbol.toStringTag,{value:"Module"})),Hm=x.object({windows_version:x.string().nullable(),windows_download_url:x.string().nullable(),macos_version:x.string().nullable(),macos_download_url:x.string().nullable(),android_version:x.string().nullable(),android_download_url:x.string().nullable()}),Um={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function Km(){const{t:s}=V("settings"),[a,t]=m.useState(!1),l=m.useRef(null),n=ye({resolver:_e(Hm),defaultValues:Um,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","app"],queryFn:()=>me.getSettings("app")}),{mutateAsync:r}=gs({mutationFn:me.saveSettings,onSuccess:i=>{i.data&&A.success(s("app.save_success"))}});m.useEffect(()=>{if(o?.data.app){const i=o.data.app;Object.entries(i).forEach(([d,h])=>{n.setValue(d,h)}),l.current=i}},[o]);const c=m.useCallback(Se.debounce(async i=>{if(!Se.isEqual(i,l.current)){t(!0);try{await r(i),l.current=i}finally{t(!1)}}},1e3),[r]),u=m.useCallback(i=>{c(i)},[c]);return m.useEffect(()=>{const i=n.watch(d=>{u(d)});return()=>i.unsubscribe()},[n.watch,u]),e.jsx(we,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:n.control,name:"windows_version",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.windows.version.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(F,{children:s("app.windows.version.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"windows_download_url",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.windows.download.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(F,{children:s("app.windows.download.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"macos_version",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.macos.version.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(F,{children:s("app.macos.version.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"macos_download_url",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.macos.download.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(F,{children:s("app.macos.download.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"android_version",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.android.version.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(F,{children:s("app.android.version.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"android_download_url",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{className:"text-base",children:s("app.android.download.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(F,{children:s("app.android.download.description")}),e.jsx(P,{})]})}),a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Bm(){const{t:s}=V("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("app.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("app.description")})]}),e.jsx(ke,{}),e.jsx(Km,{})]})}const Gm=Object.freeze(Object.defineProperty({__proto__:null,default:Bm},Symbol.toStringTag,{value:"Module"})),Wm=s=>x.object({id:x.number().nullable(),name:x.string().min(2,s("form.validation.name.min")).max(30,s("form.validation.name.max")),icon:x.string().optional().nullable(),notify_domain:x.string().refine(t=>!t||/^https?:\/\/\S+/.test(t),s("form.validation.notify_domain.url")).optional().nullable(),handling_fee_fixed:x.coerce.number().min(0).optional().nullable(),handling_fee_percent:x.coerce.number().min(0).max(100).optional().nullable(),payment:x.string().min(1,s("form.validation.payment.required")),config:x.record(x.string(),x.string())}),Wn={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function kr({refetch:s,dialogTrigger:a,type:t="add",defaultFormValues:l=Wn}){const{t:n}=V("payment"),[o,r]=m.useState(!1),[c,u]=m.useState(!1),[i,d]=m.useState([]),[h,_]=m.useState([]),k=Wm(n),S=ye({resolver:_e(k),defaultValues:l,mode:"onChange"}),C=S.watch("payment");m.useEffect(()=>{o&&(async()=>{const{data:T}=await Qs.getMethodList();d(T)})()},[o]),m.useEffect(()=>{if(!C||!o)return;(async()=>{const T={payment:C,...t==="edit"&&{id:Number(S.getValues("id"))}};Qs.getMethodForm(T).then(({data:R})=>{_(R);const p=R.reduce((w,I)=>(I.field_name&&(w[I.field_name]=I.value??""),w),{});S.setValue("config",p)})})()},[C,o,S,t]);const N=async g=>{u(!0);try{(await Qs.save(g)).data&&(A.success(n("form.messages.success")),S.reset(Wn),s(),r(!1))}finally{u(!1)}};return e.jsxs(pe,{open:o,onOpenChange:r,children:[e.jsx(rs,{asChild:!0,children:a||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ze,{icon:"ion:add"})," ",e.jsx("div",{children:n("form.add.button")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsx(ve,{children:e.jsx(ge,{children:n(t==="add"?"form.add.title":"form.edit.title")})}),e.jsx(we,{...S,children:e.jsxs("form",{onSubmit:S.handleSubmit(N),className:"space-y-4",children:[e.jsx(v,{control:S.control,name:"name",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:n("form.fields.name.placeholder"),...g})}),e.jsx(F,{children:n("form.fields.name.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:S.control,name:"icon",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.icon.label")}),e.jsx(b,{children:e.jsx(D,{...g,value:g.value||"",placeholder:n("form.fields.icon.placeholder")})}),e.jsx(F,{children:n("form.fields.icon.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:S.control,name:"notify_domain",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.notify_domain.label")}),e.jsx(b,{children:e.jsx(D,{...g,value:g.value||"",placeholder:n("form.fields.notify_domain.placeholder")})}),e.jsx(F,{children:n("form.fields.notify_domain.description")}),e.jsx(P,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(v,{control:S.control,name:"handling_fee_percent",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.handling_fee_percent.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",...g,value:g.value||"",placeholder:n("form.fields.handling_fee_percent.placeholder")})}),e.jsx(P,{})]})}),e.jsx(v,{control:S.control,name:"handling_fee_fixed",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.handling_fee_fixed.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",...g,value:g.value||"",placeholder:n("form.fields.handling_fee_fixed.placeholder")})}),e.jsx(P,{})]})})]}),e.jsx(v,{control:S.control,name:"payment",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.payment.label")}),e.jsxs(X,{onValueChange:g.onChange,defaultValue:g.value,children:[e.jsx(b,{children:e.jsx(Y,{children:e.jsx(Z,{placeholder:n("form.fields.payment.placeholder")})})}),e.jsx(J,{children:i.map(T=>e.jsx($,{value:T,children:T},T))})]}),e.jsx(F,{children:n("form.fields.payment.description")}),e.jsx(P,{})]})}),h.length>0&&e.jsx("div",{className:"space-y-4",children:h.map(g=>e.jsx(v,{control:S.control,name:`config.${g.field_name}`,render:({field:T})=>e.jsxs(f,{children:[e.jsx(j,{children:g.label}),e.jsx(b,{children:e.jsx(D,{...T,value:T.value||""})}),e.jsx(P,{})]})},g.field_name))}),e.jsxs(Re,{children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{type:"button",variant:"outline",children:n("form.buttons.cancel")})}),e.jsx(E,{type:"submit",disabled:c,children:n("form.buttons.submit")})]})]})})]})]})}function z({column:s,title:a,tooltip:t,className:l}){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(E,{variant:"ghost",size:"default",className:y("-ml-3 flex h-8 items-center gap-2 text-nowrap font-medium hover:bg-muted/60",l),onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:[e.jsx("span",{children:a}),t&&e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(An,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(de,{children:t})]})}),s.getIsSorted()==="asc"?e.jsx(Xa,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(Za,{className:"h-4 w-4 text-foreground/70"}):e.jsx(rc,{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",l),children:[e.jsx("span",{children:a}),t&&e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx(An,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(de,{children:t})]})})]})}const Cn=ic,Tr=oc,Ym=cc,Dr=m.forwardRef(({className:s,...a},t)=>e.jsx(Kl,{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),...a,ref:t}));Dr.displayName=Kl.displayName;const Ta=m.forwardRef(({className:s,...a},t)=>e.jsxs(Ym,{children:[e.jsx(Dr,{}),e.jsx(Bl,{ref:t,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),...a})]}));Ta.displayName=Bl.displayName;const Da=({className:s,...a})=>e.jsx("div",{className:y("flex flex-col space-y-2 text-center sm:text-left",s),...a});Da.displayName="AlertDialogHeader";const Pa=({className:s,...a})=>e.jsx("div",{className:y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...a});Pa.displayName="AlertDialogFooter";const Ea=m.forwardRef(({className:s,...a},t)=>e.jsx(Gl,{ref:t,className:y("text-lg font-semibold",s),...a}));Ea.displayName=Gl.displayName;const Ra=m.forwardRef(({className:s,...a},t)=>e.jsx(Wl,{ref:t,className:y("text-sm text-muted-foreground",s),...a}));Ra.displayName=Wl.displayName;const Ia=m.forwardRef(({className:s,...a},t)=>e.jsx(Yl,{ref:t,className:y(bt(),s),...a}));Ia.displayName=Yl.displayName;const La=m.forwardRef(({className:s,...a},t)=>e.jsx(Jl,{ref:t,className:y(bt({variant:"outline"}),"mt-2 sm:mt-0",s),...a}));La.displayName=Jl.displayName;function ns({onConfirm:s,children:a,title:t="确认操作",description:l="确定要执行此操作吗?",cancelText:n="取消",confirmText:o="确认",variant:r="default",className:c}){return e.jsxs(Cn,{children:[e.jsx(Tr,{asChild:!0,children:a}),e.jsxs(Ta,{className:y("sm:max-w-[425px]",c),children:[e.jsxs(Da,{children:[e.jsx(Ea,{children:t}),e.jsx(Ra,{children:l})]}),e.jsxs(Pa,{children:[e.jsx(La,{asChild:!0,children:e.jsx(E,{variant:"outline",children:n})}),e.jsx(Ia,{asChild:!0,children:e.jsx(E,{variant:r,onClick:s,children:o})})]})]})]})}const Pr=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"})}),Jm=({refetch:s,isSortMode:a=!1})=>{const{t}=V("payment");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:a?"cursor-move":"opacity-0",children:e.jsx(Na,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(z,{column:l,title:t("table.columns.id")}),cell:({row:l})=>e.jsx(B,{variant:"outline",children:l.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:l})=>e.jsx(z,{column:l,title:t("table.columns.enable")}),cell:({row:l})=>e.jsx(ee,{defaultChecked:l.getValue("enable"),onCheckedChange:async()=>{const{data:n}=await Qs.updateStatus({id:l.original.id});n||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:l})=>e.jsx(z,{column:l,title:t("table.columns.name")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:l.getValue("name")})}),enableSorting:!1,size:200},{accessorKey:"payment",header:({column:l})=>e.jsx(z,{column:l,title:t("table.columns.payment")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:l.getValue("payment")})}),enableSorting:!1,size:200},{accessorKey:"notify_url",header:({column:l})=>e.jsxs("div",{className:"flex items-center",children:[e.jsx(z,{column:l,title:t("table.columns.notify_url")}),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{className:"ml-1",children:e.jsx(Pr,{className:"h-4 w-4"})}),e.jsx(de,{children:t("table.columns.notify_url_tooltip")})]})})]}),cell:({row:l})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[300px] truncate font-medium",children:l.getValue("notify_url")})}),enableSorting:!1,size:3e3},{id:"actions",header:({column:l})=>e.jsx(z,{className:"justify-end",column:l,title:t("table.columns.actions")}),cell:({row:l})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(kr,{refetch:s,dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:t("table.actions.edit")})]}),type:"edit",defaultFormValues:l.original}),e.jsx(ns,{title:t("table.actions.delete.title"),description:t("table.actions.delete.description"),onConfirm:async()=>{const{data:n}=await Qs.drop({id:l.original.id});n&&s()},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(fs,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:t("table.actions.delete.title")})]})})]}),size:100}]};function Qm({table:s,refetch:a,saveOrder:t,isSortMode:l}){const{t:n}=V("payment"),o=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[l?e.jsx("p",{className:"text-sm text-muted-foreground",children:n("table.toolbar.sort.hint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(kr,{refetch:a}),e.jsx(D,{placeholder:n("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:r=>s.getColumn("name")?.setFilterValue(r.target.value),className:"h-8 w-[250px]"}),o&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[n("table.toolbar.reset"),e.jsx(ds,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(E,{variant:l?"default":"outline",onClick:t,size:"sm",children:n(l?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}function Xm(){const[s,a]=m.useState([]),[t,l]=m.useState([]),[n,o]=m.useState(!1),[r,c]=m.useState([]),[u,i]=m.useState({"drag-handle":!1}),[d,h]=m.useState({pageSize:20,pageIndex:0}),{refetch:_}=ne({queryKey:["paymentList"],queryFn:async()=>{const{data:g}=await Qs.getList();return c(g?.map(T=>({...T,enable:!!T.enable}))||[]),g}});m.useEffect(()=>{i({"drag-handle":n,actions:!n}),h({pageSize:n?99999:10,pageIndex:0})},[n]);const k=(g,T)=>{n&&(g.dataTransfer.setData("text/plain",T.toString()),g.currentTarget.classList.add("opacity-50"))},S=(g,T)=>{if(!n)return;g.preventDefault(),g.currentTarget.classList.remove("bg-muted");const R=parseInt(g.dataTransfer.getData("text/plain"));if(R===T)return;const p=[...r],[w]=p.splice(R,1);p.splice(T,0,w),c(p)},C=async()=>{n?Qs.sort({ids:r.map(g=>g.id)}).then(()=>{_(),o(!1),A.success("排序保存成功")}):o(!0)},N=Je({data:r,columns:Jm({refetch:_,isSortMode:n}),state:{sorting:t,columnFilters:s,columnVisibility:u,pagination:d},onSortingChange:l,onColumnFiltersChange:a,onColumnVisibilityChange:i,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),getSortedRowModel:vs(),initialState:{columnPinning:{right:["actions"]}},pageCount:n?1:void 0});return e.jsx(is,{table:N,toolbar:g=>e.jsx(Qm,{table:g,refetch:_,saveOrder:C,isSortMode:n}),draggable:n,onDragStart:k,onDragEnd:g=>g.currentTarget.classList.remove("opacity-50"),onDragOver:g=>{g.preventDefault(),g.currentTarget.classList.add("bg-muted")},onDragLeave:g=>g.currentTarget.classList.remove("bg-muted"),onDrop:S,showPagination:!n})}function Zm(){const{t:s}=V("payment");return e.jsxs(Ve,{children:[e.jsxs(Fe,{className:"flex items-center justify-between",children:[e.jsx(Xe,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")})}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),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(Xm,{})})]})]})}const eu=Object.freeze(Object.defineProperty({__proto__:null,default:Zm},Symbol.toStringTag,{value:"Module"}));function su({pluginName:s,onClose:a,onSuccess:t}){const{t:l}=V("plugin"),[n,o]=m.useState(!0),[r,c]=m.useState(!1),[u,i]=m.useState(null),d=dc({config:mc(uc())}),h=ye({resolver:_e(d),defaultValues:{config:{}}});m.useEffect(()=>{(async()=>{try{const{data:C}=await Ps.getPluginConfig(s);i(C),h.reset({config:Object.fromEntries(Object.entries(C).map(([N,g])=>[N,g.value]))})}catch{A.error(l("messages.configLoadError"))}finally{o(!1)}})()},[s]);const _=async S=>{c(!0);try{await Ps.updatePluginConfig(s,S.config),A.success(l("messages.configSaveSuccess")),t()}catch{A.error(l("messages.configSaveError"))}finally{c(!1)}},k=(S,C)=>{switch(C.type){case"string":return e.jsx(v,{control:h.control,name:`config.${S}`,render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{children:C.label||C.description}),e.jsx(b,{children:e.jsx(D,{placeholder:C.placeholder,...N})}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description}),e.jsx(P,{})]})},S);case"number":case"percentage":return e.jsx(v,{control:h.control,name:`config.${S}`,render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{children:C.label||C.description}),e.jsx(b,{children:e.jsxs("div",{className:"relative",children:[e.jsx(D,{type:"number",placeholder:C.placeholder,...N,onChange:g=>{const T=Number(g.target.value);C.type==="percentage"?N.onChange(Math.min(100,Math.max(0,T))):N.onChange(T)},className:C.type==="percentage"?"pr-8":"",min:C.type==="percentage"?0:void 0,max:C.type==="percentage"?100:void 0,step:C.type==="percentage"?1:void 0}),C.type==="percentage"&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(xc,{className:"h-4 w-4 text-muted-foreground"})})]})}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description}),e.jsx(P,{})]})},S);case"select":return e.jsx(v,{control:h.control,name:`config.${S}`,render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{children:C.label||C.description}),e.jsxs(X,{onValueChange:N.onChange,defaultValue:N.value,children:[e.jsx(b,{children:e.jsx(Y,{children:e.jsx(Z,{placeholder:C.placeholder})})}),e.jsx(J,{children:C.options?.map(g=>e.jsx($,{value:g.value,children:g.label},g.value))})]}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description}),e.jsx(P,{})]})},S);case"boolean":return e.jsx(v,{control:h.control,name:`config.${S}`,render:({field:N})=>e.jsxs(f,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(j,{className:"text-base",children:C.label||C.description}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description})]}),e.jsx(b,{children:e.jsx(ee,{checked:N.value,onCheckedChange:N.onChange})})]})},S);case"text":return e.jsx(v,{control:h.control,name:`config.${S}`,render:({field:N})=>e.jsxs(f,{children:[e.jsx(j,{children:C.label||C.description}),e.jsx(b,{children:e.jsx(Ts,{placeholder:C.placeholder,...N})}),C.description&&C.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C.description}),e.jsx(P,{})]})},S);default:return null}};return n?e.jsxs("div",{className:"space-y-4",children:[e.jsx(ce,{className:"h-4 w-[200px]"}),e.jsx(ce,{className:"h-10 w-full"}),e.jsx(ce,{className:"h-4 w-[200px]"}),e.jsx(ce,{className:"h-10 w-full"})]}):e.jsx(we,{...h,children:e.jsxs("form",{onSubmit:h.handleSubmit(_),className:"space-y-4",children:[u&&Object.entries(u).map(([S,C])=>k(S,C)),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(E,{type:"button",variant:"outline",onClick:a,disabled:r,children:l("config.cancel")}),e.jsx(E,{type:"submit",loading:r,disabled:r,children:l("config.save")})]})]})})}function tu(){const{t:s}=V("plugin"),[a,t]=m.useState(null),[l,n]=m.useState(!1),[o,r]=m.useState(null),[c,u]=m.useState(""),[i,d]=m.useState("all"),[h,_]=m.useState(!1),[k,S]=m.useState(!1),[C,N]=m.useState(!1),g=m.useRef(null),{data:T,isLoading:R,refetch:p}=ne({queryKey:["pluginList"],queryFn:async()=>{const{data:L}=await Ps.getPluginList();return L}});T&&[...new Set(T.map(L=>L.category||"other"))];const w=T?.filter(L=>{const U=L.name.toLowerCase().includes(c.toLowerCase())||L.description.toLowerCase().includes(c.toLowerCase())||L.code.toLowerCase().includes(c.toLowerCase()),ms=i==="all"||L.category===i;return U&&ms}),I=async L=>{t(L),Ps.installPlugin(L).then(()=>{A.success(s("messages.installSuccess")),p()}).catch(U=>{A.error(U.message||s("messages.installError"))}).finally(()=>{t(null)})},H=async L=>{t(L),Ps.uninstallPlugin(L).then(()=>{A.success(s("messages.uninstallSuccess")),p()}).catch(U=>{A.error(U.message||s("messages.uninstallError"))}).finally(()=>{t(null)})},O=async(L,U)=>{t(L),(U?Ps.disablePlugin:Ps.enablePlugin)(L).then(()=>{A.success(s(U?"messages.disableSuccess":"messages.enableSuccess")),p()}).catch(De=>{A.error(De.message||s(U?"messages.disableError":"messages.enableError"))}).finally(()=>{t(null)})},K=L=>{T?.find(U=>U.code===L),r(L),n(!0)},oe=async L=>{if(!L.name.endsWith(".zip")){A.error(s("upload.error.format"));return}_(!0),Ps.uploadPlugin(L).then(()=>{A.success(s("messages.uploadSuccess")),S(!1),p()}).catch(U=>{A.error(U.message||s("messages.uploadError"))}).finally(()=>{_(!1),g.current&&(g.current.value="")})},W=L=>{L.preventDefault(),L.stopPropagation(),L.type==="dragenter"||L.type==="dragover"?N(!0):L.type==="dragleave"&&N(!1)},te=L=>{L.preventDefault(),L.stopPropagation(),N(!1),L.dataTransfer.files&&L.dataTransfer.files[0]&&oe(L.dataTransfer.files[0])},q=async L=>{t(L),Ps.deletePlugin(L).then(()=>{A.success(s("messages.deleteSuccess")),p()}).catch(U=>{A.error(U.message||s("messages.deleteError"))}).finally(()=>{t(null)})};return e.jsxs(Ve,{children:[e.jsxs(Fe,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(xn,{className:"h-6 w-6"}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s("title")})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"mb-8 space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"relative max-w-sm flex-1",children:[e.jsx(hn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(D,{placeholder:s("search.placeholder"),value:c,onChange:L=>u(L.target.value),className:"pl-9"})]}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs(E,{onClick:()=>S(!0),variant:"outline",className:"shrink-0",size:"sm",children:[e.jsx(At,{className:"mr-2 h-4 w-4"}),s("upload.button")]})})]}),e.jsxs(Bt,{defaultValue:"all",className:"w-full",children:[e.jsxs(Ct,{children:[e.jsx(Ee,{value:"all",children:s("tabs.all")}),e.jsx(Ee,{value:"installed",children:s("tabs.installed")}),e.jsx(Ee,{value:"available",children:s("tabs.available")})]}),e.jsx(We,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Ka,{}),e.jsx(Ka,{}),e.jsx(Ka,{})]}):w?.map(L=>e.jsx(Ua,{plugin:L,onInstall:I,onUninstall:H,onToggleEnable:O,onOpenConfig:K,onDelete:q,isLoading:a===L.name},L.name))})}),e.jsx(We,{value:"installed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:w?.filter(L=>L.is_installed).map(L=>e.jsx(Ua,{plugin:L,onInstall:I,onUninstall:H,onToggleEnable:O,onOpenConfig:K,onDelete:q,isLoading:a===L.name},L.name))})}),e.jsx(We,{value:"available",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:w?.filter(L=>!L.is_installed).map(L=>e.jsx(Ua,{plugin:L,onInstall:I,onUninstall:H,onToggleEnable:O,onOpenConfig:K,onDelete:q,isLoading:a===L.name},L.code))})})]})]}),e.jsx(pe,{open:l,onOpenChange:n,children:e.jsxs(ue,{className:"sm:max-w-lg",children:[e.jsxs(ve,{children:[e.jsxs(ge,{children:[T?.find(L=>L.code===o)?.name," ",s("config.title")]}),e.jsx(Le,{children:s("config.description")})]}),o&&e.jsx(su,{pluginName:o,onClose:()=>n(!1),onSuccess:()=>{n(!1),p()}})]})}),e.jsx(pe,{open:k,onOpenChange:S,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:s("upload.title")}),e.jsx(Le,{children:s("upload.description")})]}),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",C&&"border-primary/50 bg-muted/50"),onDragEnter:W,onDragLeave:W,onDragOver:W,onDrop:te,children:[e.jsx("input",{type:"file",ref:g,className:"hidden",accept:".zip",onChange:L=>{const U=L.target.files?.[0];U&&oe(U)}}),h?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:s("upload.uploading")})]}):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(At,{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:[s("upload.dragText")," ",e.jsx("button",{type:"button",onClick:()=>g.current?.click(),className:"mx-1 text-primary hover:underline",children:s("upload.clickText")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("upload.supportText")})]})]})})]})]})})]})]})}function Ua({plugin:s,onInstall:a,onUninstall:t,onToggleEnable:l,onOpenConfig:n,onDelete:o,isLoading:r}){const{t:c}=V("plugin");return e.jsxs(Ye,{className:"group relative overflow-hidden transition-all hover:shadow-md",children:[e.jsxs(ss,{children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_s,{children:s.name}),s.is_installed&&e.jsx(B,{variant:s.is_enabled?"success":"secondary",children:s.is_enabled?c("status.enabled"):c("status.disabled")})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(xn,{className:"h-4 w-4"}),e.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:s.code})]}),e.jsxs("div",{children:["v",s.version]})]})]})}),e.jsx(Xs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"mt-2",children:s.description}),e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-1",children:[c("author"),": ",s.author]})})]})})]}),e.jsx(ts,{children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.is_installed?e.jsxs(e.Fragment,{children:[e.jsxs(E,{variant:"outline",size:"sm",onClick:()=>n(s.code),disabled:!s.is_enabled||r,children:[e.jsx(hc,{className:"mr-2 h-4 w-4"}),c("button.config")]}),e.jsxs(E,{variant:s.is_enabled?"destructive":"default",size:"sm",onClick:()=>l(s.code,s.is_enabled),disabled:r,children:[e.jsx(pc,{className:"mr-2 h-4 w-4"}),s.is_enabled?c("button.disable"):c("button.enable")]}),e.jsx(ns,{title:c("uninstall.title"),description:c("uninstall.description"),cancelText:c("common:cancel"),confirmText:c("uninstall.button"),variant:"destructive",onConfirm:()=>t(s.code),children:e.jsxs(E,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",disabled:r,children:[e.jsx(fs,{className:"mr-2 h-4 w-4"}),c("button.uninstall")]})})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{onClick:()=>a(s.code),disabled:r,loading:r,children:c("button.install")}),e.jsx(ns,{title:c("delete.title"),description:c("delete.description"),cancelText:c("common:cancel"),confirmText:c("delete.button"),variant:"destructive",onConfirm:()=>o(s.code),children:e.jsx(E,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",disabled:r,children:e.jsx(fs,{className:"h-4 w-4"})})})]})})})]})}function Ka(){return e.jsxs(Ye,{children:[e.jsxs(ss,{children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-6 w-[200px]"}),e.jsx(ce,{className:"h-6 w-[80px]"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ce,{className:"h-5 w-[120px]"}),e.jsx(ce,{className:"h-5 w-[60px]"})]})]})}),e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx(ce,{className:"h-4 w-[300px]"}),e.jsx(ce,{className:"h-4 w-[150px]"})]})]}),e.jsx(ts,{children:e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(ce,{className:"h-9 w-[100px]"}),e.jsx(ce,{className:"h-9 w-[100px]"}),e.jsx(ce,{className:"h-8 w-8"})]})})]})}const au=Object.freeze(Object.defineProperty({__proto__:null,default:tu},Symbol.toStringTag,{value:"Module"})),nu=(s,a)=>{let t=null;switch(s.field_type){case"input":t=e.jsx(D,{placeholder:s.placeholder,...a});break;case"textarea":t=e.jsx(Ts,{placeholder:s.placeholder,...a});break;case"select":t=e.jsx("select",{className:y(bt({variant:"outline"}),"w-full appearance-none font-normal"),...a,children:s.select_options&&Object.keys(s.select_options).map(l=>e.jsx("option",{value:l,children:s.select_options?.[l]},l))});break;default:t=null;break}return t};function lu({themeKey:s,themeInfo:a}){const{t}=V("theme"),[l,n]=m.useState(!1),[o,r]=m.useState(!1),[c,u]=m.useState(!1),i=ye({defaultValues:a.configs.reduce((_,k)=>(_[k.field_name]="",_),{})}),d=async()=>{r(!0),Mt.getConfig(s).then(({data:_})=>{Object.entries(_).forEach(([k,S])=>{i.setValue(k,S)})}).finally(()=>{r(!1)})},h=async _=>{u(!0),Mt.updateConfig(s,_).then(()=>{A.success(t("config.success")),n(!1)}).finally(()=>{u(!1)})};return e.jsxs(pe,{open:l,onOpenChange:_=>{n(_),_?d():i.reset()},children:[e.jsx(rs,{asChild:!0,children:e.jsx(E,{variant:"outline",children:t("card.configureTheme")})}),e.jsxs(ue,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:t("config.title",{name:a.name})}),e.jsx(Le,{children:t("config.description")})]}),o?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(gn,{className:"h-6 w-6 animate-spin"})}):e.jsx(we,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(h),className:"space-y-4",children:[a.configs.map(_=>e.jsx(v,{control:i.control,name:_.field_name,render:({field:k})=>e.jsxs(f,{children:[e.jsx(j,{children:_.label}),e.jsx(b,{children:nu(_,k)}),e.jsx(P,{})]})},_.field_name)),e.jsxs(Re,{className:"mt-6 gap-2",children:[e.jsx(E,{type:"button",variant:"secondary",onClick:()=>n(!1),children:t("config.cancel")}),e.jsx(E,{type:"submit",loading:c,children:t("config.save")})]})]})})]})]})}function ru(){const{t:s}=V("theme"),[a,t]=m.useState(null),[l,n]=m.useState(!1),[o,r]=m.useState(!1),[c,u]=m.useState(!1),[i,d]=m.useState(null),h=m.useRef(null),[_,k]=m.useState(0),{data:S,isLoading:C,refetch:N}=ne({queryKey:["themeList"],queryFn:async()=>{const{data:O}=await Mt.getList();return O}}),g=async O=>{t(O),me.updateSystemConfig({frontend_theme:O}).then(()=>{A.success("主题切换成功"),N()}).finally(()=>{t(null)})},T=async O=>{if(!O.name.endsWith(".zip")){A.error(s("upload.error.format"));return}n(!0),Mt.upload(O).then(()=>{A.success("主题上传成功"),r(!1),N()}).finally(()=>{n(!1),h.current&&(h.current.value="")})},R=O=>{O.preventDefault(),O.stopPropagation(),O.type==="dragenter"||O.type==="dragover"?u(!0):O.type==="dragleave"&&u(!1)},p=O=>{O.preventDefault(),O.stopPropagation(),u(!1),O.dataTransfer.files&&O.dataTransfer.files[0]&&T(O.dataTransfer.files[0])},w=()=>{i&&k(O=>O===0?i.images.length-1:O-1)},I=()=>{i&&k(O=>O===i.images.length-1?0:O+1)},H=(O,K)=>{k(0),d({name:O,images:K})};return e.jsxs(Ve,{children:[e.jsxs(Fe,{className:"flex items-center justify-between",children:[e.jsx(Xe,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-muted-foreground",children:s("description")}),e.jsxs(E,{onClick:()=>r(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(At,{className:"mr-2 h-4 w-4"}),s("upload.button")]})]})]}),e.jsx("section",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3",children:C?e.jsxs(e.Fragment,{children:[e.jsx(Yn,{}),e.jsx(Yn,{})]}):S?.themes&&Object.entries(S.themes).map(([O,K])=>e.jsx(Ye,{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(ns,{title:s("card.delete.title"),description:s("card.delete.description"),confirmText:s("card.delete.button"),variant:"destructive",onConfirm:async()=>{if(O===S?.active){A.error(s("card.delete.error.active"));return}t(O),Mt.drop(O).then(()=>{A.success("主题删除成功"),N()}).finally(()=>{t(null)})},children:e.jsx(E,{disabled:a===O,loading:a===O,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(fs,{className:"h-4 w-4"})})})}),e.jsxs(ss,{children:[e.jsx(_s,{children:K.name}),e.jsx(Xs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{children:K.description}),K.version&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("card.version",{version:K.version})})]})})]}),e.jsxs(ts,{className:"flex items-center justify-end space-x-3",children:[K.images&&Array.isArray(K.images)&&K.images.length>0&&e.jsx(E,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>H(K.name,K.images),children:e.jsx(gc,{className:"h-4 w-4"})}),e.jsx(lu,{themeKey:O,themeInfo:K}),e.jsx(E,{onClick:()=>g(O),disabled:a===O||O===S.active,loading:a===O,variant:O===S.active?"secondary":"default",children:O===S.active?s("card.currentTheme"):s("card.activateTheme")})]})]})},O))}),e.jsx(pe,{open:o,onOpenChange:r,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:s("upload.title")}),e.jsx(Le,{children:s("upload.description")})]}),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",c&&"border-primary/50 bg-muted/50"),onDragEnter:R,onDragLeave:R,onDragOver:R,onDrop:p,children:[e.jsx("input",{type:"file",ref:h,className:"hidden",accept:".zip",onChange:O=>{const K=O.target.files?.[0];K&&T(K)}}),l?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:s("upload.uploading")})]}):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(At,{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:[s("upload.dragText")," ",e.jsx("button",{type:"button",onClick:()=>h.current?.click(),className:"mx-1 text-primary hover:underline",children:s("upload.clickText")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("upload.supportText")})]})]})})]})]})}),e.jsx(pe,{open:!!i,onOpenChange:O=>{O||(d(null),k(0))},children:e.jsxs(ue,{className:"max-w-4xl",children:[e.jsxs(ve,{children:[e.jsxs(ge,{children:[i?.name," ",s("preview.title")]}),e.jsx(Le,{className:"text-center",children:i&&s("preview.imageCount",{current:_+1,total:i.images.length})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"aspect-[16/9] overflow-hidden rounded-lg border bg-muted",children:i?.images[_]&&e.jsx("img",{src:i.images[_],alt:`${i.name} 预览图 ${_+1}`,className:"h-full w-full object-contain"})}),i&&i.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(E,{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:w,children:e.jsx(fc,{className:"h-4 w-4"})}),e.jsx(E,{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:I,children:e.jsx(jc,{className:"h-4 w-4"})})]})]}),i&&i.images.length>1&&e.jsx("div",{className:"mt-4 flex gap-2 overflow-x-auto pb-2",children:i.images.map((O,K)=>e.jsx("button",{onClick:()=>k(K),className:y("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",_===K?"border-primary":"border-transparent"),children:e.jsx("img",{src:O,alt:`缩略图 ${K+1}`,className:"h-full w-full object-cover"})},K))})]})})]})]})}function Yn(){return e.jsxs(Ye,{children:[e.jsxs(ss,{children:[e.jsx(ce,{className:"h-6 w-[200px]"}),e.jsx(ce,{className:"h-4 w-[300px]"})]}),e.jsxs(ts,{className:"flex items-center justify-end space-x-3",children:[e.jsx(ce,{className:"h-10 w-[100px]"}),e.jsx(ce,{className:"h-10 w-[100px]"})]})]})}const iu=Object.freeze(Object.defineProperty({__proto__:null,default:ru},Symbol.toStringTag,{value:"Module"})),Sn=m.forwardRef(({className:s,value:a,onChange:t,...l},n)=>{const[o,r]=m.useState("");m.useEffect(()=>{if(o.includes(",")){const u=new Set([...a,...o.split(",").map(i=>i.trim())]);t(Array.from(u)),r("")}},[o,t,a]);const c=()=>{if(o){const u=new Set([...a,o]);t(Array.from(u)),r("")}};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:[a.map(u=>e.jsxs(B,{variant:"secondary",children:[u,e.jsx(G,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{t(a.filter(i=>i!==u))},children:e.jsx(an,{className:"w-3"})})]},u)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:o,onChange:u=>r(u.target.value),onKeyDown:u=>{u.key==="Enter"||u.key===","?(u.preventDefault(),c()):u.key==="Backspace"&&o.length===0&&a.length>0&&(u.preventDefault(),t(a.slice(0,-1)))},...l,ref:n})]})});Sn.displayName="InputTags";const ou=x.object({id:x.number().nullable(),title:x.string().min(1).max(250),content:x.string().min(1),show:x.boolean(),tags:x.array(x.string()),img_url:x.string().nullable()}),cu={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function Er({refetch:s,dialogTrigger:a,type:t="add",defaultFormValues:l=cu}){const{t:n}=V("notice"),[o,r]=m.useState(!1),c=ye({resolver:_e(ou),defaultValues:l,mode:"onChange",shouldFocusError:!0}),u=new fn({html:!0});return e.jsx(we,{...c,children:e.jsxs(pe,{onOpenChange:r,open:o,children:[e.jsx(rs,{asChild:!0,children:a||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ze,{icon:"ion:add"})," ",e.jsx("div",{children:n("form.add.button")})]})}),e.jsxs(ue,{className:"sm:max-w-[1025px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:n(t==="add"?"form.add.title":"form.edit.title")}),e.jsx(Le,{})]}),e.jsx(v,{control:c.control,name:"title",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.title.label")}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(D,{placeholder:n("form.fields.title.placeholder"),...i})})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"content",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.content.label")}),e.jsx(b,{children:e.jsx(jn,{style:{height:"500px"},value:i.value,renderHTML:d=>u.render(d),onChange:({text:d})=>{i.onChange(d)}})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"img_url",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.img_url.label")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(D,{type:"text",placeholder:n("form.fields.img_url.placeholder"),...i,value:i.value||""})})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"show",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.show.label")}),e.jsx("div",{className:"relative py-2",children:e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:i.onChange})})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"tags",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.fields.tags.label")}),e.jsx(b,{children:e.jsx(Sn,{value:i.value,onChange:i.onChange,placeholder:n("form.fields.tags.placeholder"),className:"w-full"})}),e.jsx(P,{})]})}),e.jsxs(Re,{children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{type:"button",variant:"outline",children:n("form.buttons.cancel")})}),e.jsx(E,{type:"submit",onClick:i=>{i.preventDefault(),c.handleSubmit(async d=>{Ht.save(d).then(({data:h})=>{h&&(A.success(n("form.buttons.success")),s(),r(!1))})})()},children:n("form.buttons.submit")})]})]})]})})}function du({table:s,refetch:a,saveOrder:t,isSortMode:l}){const{t:n}=V("notice"),o=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:[!l&&e.jsx(Er,{refetch:a}),!l&&e.jsx(D,{placeholder:n("table.toolbar.search"),value:s.getColumn("title")?.getFilterValue()??"",onChange:r=>s.getColumn("title")?.setFilterValue(r.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),o&&!l&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:[n("table.toolbar.reset"),e.jsx(ds,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(E,{variant:l?"default":"outline",onClick:t,className:"h-8",size:"sm",children:n(l?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}const mu=s=>{const{t:a}=V("notice");return[{id:"drag-handle",header:"",cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(vc,{className:"h-4 w-4 cursor-move text-muted-foreground"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.id")}),cell:({row:t})=>e.jsx(B,{variant:"outline",className:"font-mono",children:t.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.show")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(ee,{defaultChecked:t.getValue("show"),onCheckedChange:async()=>{const{data:l}=await Ht.updateStatus(t.original.id);l||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.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(z,{className:"justify-end",column:t,title:a("table.columns.actions")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Er,{refetch:s,dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:a("table.actions.edit")})]}),type:"edit",defaultFormValues:t.original}),e.jsx(ns,{title:a("table.actions.delete.title"),description:a("table.actions.delete.description"),onConfirm:async()=>{Ht.drop(t.original.id).then(()=>{A.success(a("table.actions.delete.success")),s()})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(fs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:a("table.actions.delete.title")})]})})]}),size:100}]};function uu(){const[s,a]=m.useState({}),[t,l]=m.useState({}),[n,o]=m.useState([]),[r,c]=m.useState([]),[u,i]=m.useState(!1),[d,h]=m.useState({}),[_,k]=m.useState({pageSize:50,pageIndex:0}),[S,C]=m.useState([]),{refetch:N}=ne({queryKey:["notices"],queryFn:async()=>{const{data:w}=await Ht.getList();return C(w),w}});m.useEffect(()=>{l({"drag-handle":u,content:!u,created_at:!u,actions:!u}),k({pageSize:u?99999:50,pageIndex:0})},[u]);const g=(w,I)=>{u&&(w.dataTransfer.setData("text/plain",I.toString()),w.currentTarget.classList.add("opacity-50"))},T=(w,I)=>{if(!u)return;w.preventDefault(),w.currentTarget.classList.remove("bg-muted");const H=parseInt(w.dataTransfer.getData("text/plain"));if(H===I)return;const O=[...S],[K]=O.splice(H,1);O.splice(I,0,K),C(O)},R=async()=>{if(!u){i(!0);return}Ht.sort(S.map(w=>w.id)).then(()=>{A.success("排序保存成功"),i(!1),N()}).finally(()=>{i(!1)})},p=Je({data:S??[],columns:mu(N),state:{sorting:r,columnVisibility:t,rowSelection:s,columnFilters:n,columnSizing:d,pagination:_},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:c,onColumnFiltersChange:o,onColumnVisibilityChange:l,onColumnSizingChange:h,onPaginationChange:k,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),getSortedRowModel:vs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Vs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(is,{table:p,toolbar:w=>e.jsx(du,{table:w,refetch:N,saveOrder:R,isSortMode:u}),draggable:u,onDragStart:g,onDragEnd:w=>w.currentTarget.classList.remove("opacity-50"),onDragOver:w=>{w.preventDefault(),w.currentTarget.classList.add("bg-muted")},onDragLeave:w=>w.currentTarget.classList.remove("bg-muted"),onDrop:T,showPagination:!u})})}function xu(){const{t:s}=V("notice");return e.jsxs(Ve,{children:[e.jsxs(Fe,{className:"flex items-center justify-between",children:[e.jsx(Xe,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")})}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),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(uu,{})})]})]})}const hu=Object.freeze(Object.defineProperty({__proto__:null,default:xu},Symbol.toStringTag,{value:"Module"})),pu=x.object({id:x.number().nullable(),language:x.string().max(250),category:x.string().max(250),title:x.string().min(1).max(250),body:x.string().min(1),show:x.boolean()}),gu={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function Rr({refreshData:s,dialogTrigger:a,type:t="add",defaultFormValues:l=gu}){const{t:n}=V("knowledge"),[o,r]=m.useState(!1),c=ye({resolver:_e(pu),defaultValues:l,mode:"onChange",shouldFocusError:!0}),u=new fn({html:!0});return m.useEffect(()=>{o&&l.id&&vt.getInfo(l.id).then(({data:i})=>{c.reset(i)})},[l.id,c,o]),e.jsxs(pe,{onOpenChange:r,open:o,children:[e.jsx(rs,{asChild:!0,children:a||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ze,{icon:"ion:add"})," ",e.jsx("div",{children:n("form.add")})]})}),e.jsxs(ue,{className:"sm:max-w-[1025px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:n(t==="add"?"form.add":"form.edit")}),e.jsx(Le,{})]}),e.jsxs(we,{...c,children:[e.jsx(v,{control:c.control,name:"title",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.title")}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(D,{placeholder:n("form.titlePlaceholder"),...i})})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"category",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.category")}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(D,{placeholder:n("form.categoryPlaceholder"),...i})})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"language",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.language")}),e.jsx(b,{children:e.jsxs(X,{value:i.value,onValueChange:i.onChange,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:n("form.languagePlaceholder")})}),e.jsx(J,{children:[{value:"en-US"},{value:"ja-JP"},{value:"ko-KR"},{value:"vi-VN"},{value:"zh-CN"},{value:"zh-TW"}].map(d=>e.jsx($,{value:d.value,className:"cursor-pointer",children:n(`languages.${d.value}`)},d.value))})]})})]})}),e.jsx(v,{control:c.control,name:"body",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.content")}),e.jsx(b,{children:e.jsx(jn,{style:{height:"500px"},value:i.value,renderHTML:d=>u.render(d),onChange:({text:d})=>{i.onChange(d)}})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"show",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.show")}),e.jsx("div",{className:"relative py-2",children:e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:i.onChange})})}),e.jsx(P,{})]})}),e.jsxs(Re,{children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{type:"button",variant:"outline",children:n("form.cancel")})}),e.jsx(E,{type:"submit",onClick:()=>{c.handleSubmit(i=>{vt.save(i).then(({data:d})=>{d&&(c.reset(),A.success(n("messages.operationSuccess")),r(!1),s())})})()},children:n("form.submit")})]})]})]})]})}function fu({column:s,title:a,options:t}){const l=s?.getFacetedUniqueValues(),n=new Set(s?.getFilterValue());return e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(_a,{className:"mr-2 h-4 w-4"}),a,n?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(B,{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(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[n.size," selected"]}):t.filter(o=>n.has(o.value)).map(o=>e.jsx(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(bs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:a}),e.jsxs(Ks,{children:[e.jsx(lt,{children:"No results found."}),e.jsx(as,{children:t.map(o=>{const r=n.has(o.value);return e.jsxs($e,{onSelect:()=>{r?n.delete(o.value):n.add(o.value);const c=Array.from(n);s?.setFilterValue(c.length?c:void 0)},children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",r?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(et,{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}),l?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(o.value)})]},o.value)})}),n.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(St,{}),e.jsx(as,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function ju({table:s,refetch:a,saveOrder:t,isSortMode:l}){const n=s.getState().columnFilters.length>0,{t:o}=V("knowledge");return e.jsxs("div",{className:"flex items-center justify-between",children:[l?e.jsx("p",{className:"text-sm text-muted-foreground",children:o("toolbar.sortModeHint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Rr,{refreshData:a}),e.jsx(D,{placeholder:o("toolbar.searchPlaceholder"),value:s.getColumn("title")?.getFilterValue()??"",onChange:r=>s.getColumn("title")?.setFilterValue(r.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(fu,{column:s.getColumn("category"),title:o("columns.category"),options:Array.from(new Set(s.getCoreRowModel().rows.map(r=>r.getValue("category")))).map(r=>({label:r,value:r}))}),n&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[o("toolbar.reset"),e.jsx(ds,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(E,{variant:l?"default":"outline",onClick:t,size:"sm",children:o(l?"toolbar.saveSort":"toolbar.editSort")})})]})}const vu=({refetch:s,isSortMode:a=!1})=>{const{t}=V("knowledge");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:a?"cursor-move":"opacity-0",children:e.jsx(Na,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(z,{column:l,title:t("columns.id")}),cell:({row:l})=>e.jsx(B,{variant:"outline",className:"justify-center",children:l.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:l})=>e.jsx(z,{column:l,title:t("columns.status")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center",children:e.jsx(ee,{defaultChecked:l.getValue("show"),onCheckedChange:async()=>{vt.updateStatus({id:l.original.id}).then(({data:n})=>{n||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:l})=>e.jsx(z,{column:l,title:t("columns.title")}),cell:({row:l})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"line-clamp-2 font-medium",children:l.getValue("title")})}),enableSorting:!0,size:600},{accessorKey:"category",header:({column:l})=>e.jsx(z,{column:l,title:t("columns.category")}),cell:({row:l})=>e.jsx(B,{variant:"secondary",className:"max-w-[180px] truncate",children:l.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:l})=>e.jsx(z,{className:"justify-end",column:l,title:t("columns.actions")}),cell:({row:l})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx(Rr,{refreshData:s,dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:t("form.edit")})]}),type:"edit",defaultFormValues:l.original}),e.jsx(ns,{title:t("messages.deleteConfirm"),description:t("messages.deleteDescription"),confirmText:t("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{vt.drop({id:l.original.id}).then(({data:n})=>{n&&(A.success(t("messages.operationSuccess")),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(fs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:t("messages.deleteButton")})]})})]}),size:100}]};function bu(){const[s,a]=m.useState([]),[t,l]=m.useState([]),[n,o]=m.useState(!1),[r,c]=m.useState([]),[u,i]=m.useState({"drag-handle":!1}),[d,h]=m.useState({pageSize:20,pageIndex:0}),{refetch:_,isLoading:k,data:S}=ne({queryKey:["knowledge"],queryFn:async()=>{const{data:R}=await vt.getList();return c(R||[]),R}});m.useEffect(()=>{i({"drag-handle":n,actions:!n}),h({pageSize:n?99999:10,pageIndex:0})},[n]);const C=(R,p)=>{n&&(R.dataTransfer.setData("text/plain",p.toString()),R.currentTarget.classList.add("opacity-50"))},N=(R,p)=>{if(!n)return;R.preventDefault(),R.currentTarget.classList.remove("bg-muted");const w=parseInt(R.dataTransfer.getData("text/plain"));if(w===p)return;const I=[...r],[H]=I.splice(w,1);I.splice(p,0,H),c(I)},g=async()=>{n?vt.sort({ids:r.map(R=>R.id)}).then(()=>{_(),o(!1),A.success("排序保存成功")}):o(!0)},T=Je({data:r,columns:vu({refetch:_,isSortMode:n}),state:{sorting:t,columnFilters:s,columnVisibility:u,pagination:d},onSortingChange:l,onColumnFiltersChange:a,onColumnVisibilityChange:i,onPaginationChange:h,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),getSortedRowModel:vs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(is,{table:T,toolbar:R=>e.jsx(ju,{table:R,refetch:_,saveOrder:g,isSortMode:n}),draggable:n,onDragStart:C,onDragEnd:R=>R.currentTarget.classList.remove("opacity-50"),onDragOver:R=>{R.preventDefault(),R.currentTarget.classList.add("bg-muted")},onDragLeave:R=>R.currentTarget.classList.remove("bg-muted"),onDrop:N,showPagination:!n})}function yu(){const{t:s}=V("knowledge");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),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(bu,{})})]})]})}const Nu=Object.freeze(Object.defineProperty({__proto__:null,default:yu},Symbol.toStringTag,{value:"Module"}));function _u(s,a){const[t,l]=m.useState(s);return m.useEffect(()=>{const n=setTimeout(()=>l(s),a);return()=>{clearTimeout(n)}},[s,a]),t}function Ba(s,a){if(s.length===0)return{};if(!a)return{"":s};const t={};return s.forEach(l=>{const n=l[a]||"";t[n]||(t[n]=[]),t[n].push(l)}),t}function wu(s,a){const t=JSON.parse(JSON.stringify(s));for(const[l,n]of Object.entries(t))t[l]=n.filter(o=>!a.find(r=>r.value===o.value));return t}function Cu(s,a){for(const[,t]of Object.entries(s))if(t.some(l=>a.find(n=>n.value===l.value)))return!0;return!1}const Ir=m.forwardRef(({className:s,...a},t)=>bc(n=>n.filtered.count===0)?e.jsx("div",{ref:t,className:y("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...a}):null);Ir.displayName="CommandEmpty";const _t=m.forwardRef(({value:s,onChange:a,placeholder:t,defaultOptions:l=[],options:n,delay:o,onSearch:r,loadingIndicator:c,emptyIndicator:u,maxSelected:i=Number.MAX_SAFE_INTEGER,onMaxSelected:d,hidePlaceholderWhenSelected:h,disabled:_,groupBy:k,className:S,badgeClassName:C,selectFirstItem:N=!0,creatable:g=!1,triggerSearchOnFocus:T=!1,commandProps:R,inputProps:p,hideClearAllButton:w=!1},I)=>{const H=m.useRef(null),[O,K]=m.useState(!1),oe=m.useRef(!1),[W,te]=m.useState(!1),[q,L]=m.useState(s||[]),[U,ms]=m.useState(Ba(l,k)),[De,le]=m.useState(""),ys=_u(De,o||500);m.useImperativeHandle(I,()=>({selectedValue:[...q],input:H.current,focus:()=>H.current?.focus()}),[q]);const Fs=m.useCallback(se=>{const ie=q.filter(Me=>Me.value!==se.value);L(ie),a?.(ie)},[a,q]),Fa=m.useCallback(se=>{const ie=H.current;ie&&((se.key==="Delete"||se.key==="Backspace")&&ie.value===""&&q.length>0&&(q[q.length-1].fixed||Fs(q[q.length-1])),se.key==="Escape"&&ie.blur())},[Fs,q]);m.useEffect(()=>{s&&L(s)},[s]),m.useEffect(()=>{if(!n||r)return;const se=Ba(n||[],k);JSON.stringify(se)!==JSON.stringify(U)&&ms(se)},[l,n,k,r,U]),m.useEffect(()=>{const se=async()=>{te(!0);const Me=await r?.(ys);ms(Ba(Me||[],k)),te(!1)};(async()=>{!r||!O||(T&&await se(),ys&&await se())})()},[ys,k,O,T]);const Gt=()=>{if(!g||Cu(U,[{value:De,label:De}])||q.find(ie=>ie.value===De))return;const se=e.jsx($e,{value:De,className:"cursor-pointer",onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation()},onSelect:ie=>{if(q.length>=i){d?.(q.length);return}le("");const Me=[...q,{value:ie,label:ie}];L(Me),a?.(Me)},children:`Create "${De}"`});if(!r&&De.length>0||r&&ys.length>0&&!W)return se},it=m.useCallback(()=>{if(u)return r&&!g&&Object.keys(U).length===0?e.jsx($e,{value:"-",disabled:!0,children:u}):e.jsx(Ir,{children:u})},[g,u,r,U]),Ma=m.useMemo(()=>wu(U,q),[U,q]),Wt=m.useCallback(()=>{if(R?.filter)return R.filter;if(g)return(se,ie)=>se.toLowerCase().includes(ie.toLowerCase())?1:-1},[g,R?.filter]),Oa=m.useCallback(()=>{const se=q.filter(ie=>ie.fixed);L(se),a?.(se)},[a,q]);return e.jsxs(Us,{...R,onKeyDown:se=>{Fa(se),R?.onKeyDown?.(se)},className:y("h-auto overflow-visible bg-transparent",R?.className),shouldFilter:R?.shouldFilter!==void 0?R.shouldFilter:!r,filter:Wt(),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":q.length!==0,"cursor-text":!_&&q.length!==0},S),onClick:()=>{_||H.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[q.map(se=>e.jsxs(B,{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",C),"data-fixed":se.fixed,"data-disabled":_||void 0,children:[se.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",(_||se.fixed)&&"hidden"),onKeyDown:ie=>{ie.key==="Enter"&&Fs(se)},onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation()},onClick:()=>Fs(se),children:e.jsx(an,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},se.value)),e.jsx(He.Input,{...p,ref:H,value:De,disabled:_,onValueChange:se=>{le(se),p?.onValueChange?.(se)},onBlur:se=>{oe.current===!1&&K(!1),p?.onBlur?.(se)},onFocus:se=>{K(!0),T&&r?.(ys),p?.onFocus?.(se)},placeholder:h&&q.length!==0?"":t,className:y("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":h,"px-3 py-2":q.length===0,"ml-1":q.length!==0},p?.className)}),e.jsx("button",{type:"button",onClick:Oa,className:y((w||_||q.length<1||q.filter(se=>se.fixed).length===q.length)&&"hidden"),children:e.jsx(an,{})})]})}),e.jsx("div",{className:"relative",children:O&&e.jsx(Ks,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{oe.current=!1},onMouseEnter:()=>{oe.current=!0},onMouseUp:()=>{H.current?.focus()},children:W?e.jsx(e.Fragment,{children:c}):e.jsxs(e.Fragment,{children:[it(),Gt(),!N&&e.jsx($e,{value:"-",className:"hidden"}),Object.entries(Ma).map(([se,ie])=>e.jsx(as,{heading:se,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:ie.map(Me=>e.jsx($e,{value:Me.value,disabled:Me.disable,onMouseDown:Ms=>{Ms.preventDefault(),Ms.stopPropagation()},onSelect:()=>{if(q.length>=i){d?.(q.length);return}le("");const Ms=[...q,Me];L(Ms),a?.(Ms)},className:y("cursor-pointer",Me.disable&&"cursor-default text-muted-foreground"),children:Me.label},Me.value))})},se))]})})})]})});_t.displayName="MultipleSelector";const Su=s=>x.object({id:x.number().optional(),name:x.string().min(2,s("messages.nameValidation.min")).max(50,s("messages.nameValidation.max")).regex(/^[a-zA-Z0-9\u4e00-\u9fa5_-]+$/,s("messages.nameValidation.pattern"))});function Va({refetch:s,dialogTrigger:a,defaultValues:t={name:""},type:l="add"}){const{t:n}=V("group"),o=ye({resolver:_e(Su(n)),defaultValues:t,mode:"onChange"}),[r,c]=m.useState(!1),[u,i]=m.useState(!1),d=async h=>{i(!0),at.save(h).then(()=>{A.success(n(l==="edit"?"messages.updateSuccess":"messages.createSuccess")),s&&s(),o.reset(),c(!1)}).finally(()=>{i(!1)})};return e.jsxs(pe,{open:r,onOpenChange:c,children:[e.jsx(rs,{asChild:!0,children:a||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ze,{icon:"ion:add"}),e.jsx("span",{children:n("form.add")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:n(l==="edit"?"form.edit":"form.create")}),e.jsx(Le,{children:n(l==="edit"?"form.editDescription":"form.createDescription")})]}),e.jsx(we,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(d),className:"space-y-4",children:[e.jsx(v,{control:o.control,name:"name",render:({field:h})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.name")}),e.jsx(b,{children:e.jsx(D,{placeholder:n("form.namePlaceholder"),...h,className:"w-full"})}),e.jsx(F,{children:n("form.nameDescription")}),e.jsx(P,{})]})}),e.jsxs(Re,{className:"gap-2",children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{type:"button",variant:"outline",children:n("form.cancel")})}),e.jsxs(E,{type:"submit",disabled:u||!o.formState.isValid,children:[u&&e.jsx(gn,{className:"mr-2 h-4 w-4 animate-spin"}),n(l==="edit"?"form.update":"form.create")]})]})]})})]})]})}const Lr=m.createContext(void 0);function ku({children:s,refetch:a}){const[t,l]=m.useState(!1),[n,o]=m.useState(null),[r,c]=m.useState(re.Shadowsocks);return e.jsx(Lr.Provider,{value:{isOpen:t,setIsOpen:l,editingServer:n,setEditingServer:o,serverType:r,setServerType:c,refetch:a},children:s})}function Vr(){const s=m.useContext(Lr);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function Ga({dialogTrigger:s,value:a,setValue:t,templateType:l}){const{t:n}=V("server");m.useEffect(()=>{console.log(a)},[a]);const[o,r]=m.useState(!1),[c,u]=m.useState(()=>{if(!a||Object.keys(a).length===0)return"";try{return JSON.stringify(a,null,2)}catch{return""}}),[i,d]=m.useState(null),h=g=>{if(!g)return null;try{const T=JSON.parse(g);return typeof T!="object"||T===null?n("network_settings.validation.must_be_object"):null}catch{return n("network_settings.validation.invalid_json")}},_={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"}}},httpupgrade:{label:"HttpUpgrade",content:{acceptProxyProtocol:!1,path:"/",host:"xray.com",headers:{key:"value"}}},xhttp:{label:"XHTTP",content:{host:"example.com",path:"/yourpath",mode:"auto",extra:{headers:{},xPaddingBytes:"100-1000",noGRPCHeader:!1,noSSEHeader:!1,scMaxEachPostBytes:1e6,scMinPostsIntervalMs:30,scMaxBufferedPosts:30,xmux:{maxConcurrency:"16-32",maxConnections:0,cMaxReuseTimes:"64-128",cMaxLifetimeMs:0,hMaxRequestTimes:"800-900",hKeepAlivePeriod:0},downloadSettings:{address:"",port:443,network:"xhttp",security:"tls",tlsSettings:{},xhttpSettings:{path:"/yourpath"},sockopt:{}}}}}},k=()=>{switch(l){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];case"httpupgrade":return["httpupgrade"];case"xhttp":return["xhttp"];default:return[]}},S=()=>{const g=h(c||"");if(g){A.error(g);return}try{if(!c){t(null),r(!1);return}t(JSON.parse(c)),r(!1)}catch{A.error(n("network_settings.errors.save_failed"))}},C=g=>{u(g),d(h(g))},N=g=>{const T=_[g];if(T){const R=JSON.stringify(T.content,null,2);u(R),d(null)}};return m.useEffect(()=>{o&&console.log(a)},[o,a]),m.useEffect(()=>{o&&a&&Object.keys(a).length>0&&u(JSON.stringify(a,null,2))},[o,a]),e.jsxs(pe,{open:o,onOpenChange:g=>{!g&&o&&S(),r(g)},children:[e.jsx(rs,{asChild:!0,children:s??e.jsx(G,{variant:"link",children:n("network_settings.edit_protocol")})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsx(ve,{children:e.jsx(ge,{children:n("network_settings.edit_protocol_config")})}),e.jsxs("div",{className:"space-y-4",children:[k().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:k().map(g=>e.jsx(G,{variant:"outline",size:"sm",onClick:()=>N(g),children:n("network_settings.use_template",{template:_[g].label})},g))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ts,{className:`min-h-[200px] font-mono text-sm ${i?"border-red-500 focus-visible:ring-red-500":""}`,value:c,placeholder:k().length>0?n("network_settings.json_config_placeholder_with_template"):n("network_settings.json_config_placeholder"),onChange:g=>C(g.target.value)}),i&&e.jsx("p",{className:"text-sm text-red-500",children:i})]})]}),e.jsxs(Re,{className:"gap-2",children:[e.jsx(G,{variant:"outline",onClick:()=>r(!1),children:n("common.cancel")}),e.jsx(G,{onClick:S,disabled:!!i,children:n("common.confirm")})]})]})]})}function qh(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 Tu={},Du=Object.freeze(Object.defineProperty({__proto__:null,default:Tu},Symbol.toStringTag,{value:"Module"})),Hh=Lc(Du),Jn=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Pu=()=>{try{const s=yc.box.keyPair(),a=Jn(qn.encodeBase64(s.secretKey)),t=Jn(qn.encodeBase64(s.publicKey));return{privateKey:a,publicKey:t}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},Eu=()=>{try{return Pu()}catch(s){throw console.error("Error generating key pair:",s),s}},Ru=s=>{const a=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(a),Array.from(a).map(t=>t.toString(16).padStart(2,"0")).join("").substring(0,s)},Iu=()=>{const s=Math.floor(Math.random()*8)*2+2;return Ru(s)},Lu=x.object({cipher:x.string().default("aes-128-gcm"),plugin:x.string().optional().default("none"),plugin_opts:x.string().optional().default(""),client_fingerprint:x.string().optional().default("chrome")}),Vu=x.object({tls:x.coerce.number().default(0),tls_settings:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({}),network:x.string().default("tcp"),network_settings:x.record(x.any()).default({})}),Fu=x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1),network:x.string().default("tcp"),network_settings:x.record(x.any()).default({})}),Mu=x.object({version:x.coerce.number().default(2),alpn:x.string().default("h2"),obfs:x.object({open:x.coerce.boolean().default(!1),type:x.string().default("salamander"),password:x.string().default("")}).default({}),tls:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({}),bandwidth:x.object({up:x.string().default(""),down:x.string().default("")}).default({}),hop_interval:x.number().optional(),port_range:x.string().optional()}),Ou=x.object({tls:x.coerce.number().default(0),tls_settings:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({}),reality_settings:x.object({server_port:x.coerce.number().default(443),server_name:x.string().default(""),allow_insecure:x.boolean().default(!1),public_key:x.string().default(""),private_key:x.string().default(""),short_id:x.string().default("")}).default({}),network:x.string().default("tcp"),network_settings:x.record(x.any()).default({}),flow:x.string().default("")}),zu=x.object({version:x.coerce.number().default(5),congestion_control:x.string().default("bbr"),alpn:x.array(x.string()).default(["h3"]),udp_relay_mode:x.string().default("native"),tls:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({})}),$u=x.object({}),Au=x.object({tls:x.coerce.number().default(0),tls_settings:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({})}),qu=x.object({tls:x.coerce.number().default(0),tls_settings:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({})}),Hu=x.object({transport:x.string().default("tcp"),multiplexing:x.string().default("MULTIPLEXING_LOW")}),Uu=x.object({padding_scheme:x.array(x.string()).optional().default([]),tls:x.object({server_name:x.string().default(""),allow_insecure:x.boolean().default(!1)}).default({})}),Te={shadowsocks:{schema:Lu,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"],plugins:[{value:"none",label:"None"},{value:"obfs",label:"Simple Obfs"},{value:"v2ray-plugin",label:"V2Ray Plugin"}],clientFingerprints:[{value:"chrome",label:"Chrome"},{value:"firefox",label:"Firefox"},{value:"safari",label:"Safari"},{value:"ios",label:"iOS"}]},vmess:{schema:Vu,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:Fu,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Mu,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:Ou,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"]},tuic:{schema:zu,versions:["5","4"],congestionControls:["bbr","cubic","new_reno"],alpnOptions:[{value:"h3",label:"HTTP/3"},{value:"h2",label:"HTTP/2"},{value:"http/1.1",label:"HTTP/1.1"}],udpRelayModes:[{value:"native",label:"Native"},{value:"quic",label:"QUIC"}]},socks:{schema:$u},naive:{schema:qu},http:{schema:Au},mieru:{schema:Hu,transportOptions:[{value:"tcp",label:"TCP"},{value:"udp",label:"UDP"}],multiplexingOptions:[{value:"MULTIPLEXING_OFF",label:"Off"},{value:"MULTIPLEXING_LOW",label:"Low"},{value:"MULTIPLEXING_MIDDLE",label:"Middle"},{value:"MULTIPLEXING_HIGH",label:"High"}]},anytls:{schema:Uu,defaultPaddingScheme:["stop=8","0=30-30","1=100-400","2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000","3=9-9,500-1000","4=500-1000","5=500-1000","6=500-1000","7=500-1000"]}},Ku=({serverType:s,value:a,onChange:t})=>{const{t:l}=V("server"),n=s?Te[s]:null,o=n?.schema||x.record(x.any()),r=s?o.parse({}):{},c=ye({resolver:_e(o),defaultValues:r,mode:"onChange"});if(m.useEffect(()=>{if(!a||Object.keys(a).length===0){if(s){const p=o.parse({});c.reset(p)}}else c.reset(a)},[s,a,t,c,o]),m.useEffect(()=>{const p=c.watch(w=>{t(w)});return()=>p.unsubscribe()},[c,t]),!s||!n)return null;const R={shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"cipher",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.shadowsocks.cipher.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:p.onChange,value:p.value,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.shadowsocks.cipher.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.shadowsocks.ciphers.map(w=>e.jsx($,{value:w,children:w},w))})})]})})]})}),e.jsx(v,{control:c.control,name:"plugin",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.shadowsocks.plugin.label","插件")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:p.onChange,value:p.value||"none",children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.shadowsocks.plugin.placeholder","选择插件")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.shadowsocks.plugins.map(w=>e.jsx($,{value:w.value,children:w.label},w.value))})})]})}),e.jsx(F,{children:p.value&&p.value!=="none"&&e.jsxs(e.Fragment,{children:[p.value==="obfs"&&l("dynamic_form.shadowsocks.plugin.obfs_hint","提示:配置格式如 obfs=http;obfs-host=www.bing.com;path=/"),p.value==="v2ray-plugin"&&l("dynamic_form.shadowsocks.plugin.v2ray_hint","提示:WebSocket模式格式为 mode=websocket;host=mydomain.me;path=/;tls=true,QUIC模式格式为 mode=quic;host=mydomain.me")]})})]})}),c.watch("plugin")&&c.watch("plugin")!=="none"&&e.jsx(v,{control:c.control,name:"plugin_opts",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.shadowsocks.plugin_opts.label","插件选项")}),e.jsx(F,{children:l("dynamic_form.shadowsocks.plugin_opts.description","按照 key=value;key2=value2 格式输入插件选项")}),e.jsx(b,{children:e.jsx(D,{type:"text",placeholder:l("dynamic_form.shadowsocks.plugin_opts.placeholder","例如: mode=tls;host=bing.com"),...p})})]})}),(c.watch("plugin")==="shadow-tls"||c.watch("plugin")==="restls")&&e.jsx(v,{control:c.control,name:"client_fingerprint",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.shadowsocks.client_fingerprint","客户端指纹")}),e.jsx(b,{children:e.jsxs(X,{value:p.value||"chrome",onValueChange:p.onChange,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.shadowsocks.client_fingerprint_placeholder","选择客户端指纹")})}),e.jsx(J,{children:Te.shadowsocks.clientFingerprints.map(w=>e.jsx($,{value:w.value,children:w.label},w.value))})]})}),e.jsx(F,{children:l("dynamic_form.shadowsocks.client_fingerprint_description","客户端伪装指纹,用于降低被识别风险")})]})})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"tls",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.vmess.tls.label")}),e.jsx(b,{children:e.jsxs(X,{value:p.value?.toString(),onValueChange:w=>p.onChange(Number(w)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.vmess.tls.placeholder")})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:l("dynamic_form.vmess.tls.disabled")}),e.jsx($,{value:"1",children:l("dynamic_form.vmess.tls.enabled")})]})]})})]})}),c.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls_settings.server_name",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.vmess.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.vmess.tls_settings.server_name.placeholder"),...p})})]})}),e.jsx(v,{control:c.control,name:"tls_settings.allow_insecure",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.vmess.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value,onCheckedChange:p.onChange})})})]})})]}),e.jsx(v,{control:c.control,name:"network",render:({field:p})=>e.jsxs(f,{children:[e.jsxs(j,{children:[l("dynamic_form.vmess.network.label"),e.jsx(Ga,{value:c.watch("network_settings"),setValue:w=>c.setValue("network_settings",w),templateType:c.watch("network")})]}),e.jsx(b,{children:e.jsxs(X,{onValueChange:p.onChange,value:p.value,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.vmess.network.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.vmess.networkOptions.map(w=>e.jsx($,{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(v,{control:c.control,name:"server_name",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.trojan.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.trojan.server_name.placeholder"),...p,value:p.value||""})})]})}),e.jsx(v,{control:c.control,name:"allow_insecure",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.trojan.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value||!1,onCheckedChange:p.onChange})})})]})})]}),e.jsx(v,{control:c.control,name:"network",render:({field:p})=>e.jsxs(f,{children:[e.jsxs(j,{children:[l("dynamic_form.trojan.network.label"),e.jsx(Ga,{value:c.watch("network_settings")||{},setValue:w=>c.setValue("network_settings",w),templateType:c.watch("network")||"tcp"})]}),e.jsx(b,{children:e.jsxs(X,{onValueChange:p.onChange,value:p.value||"tcp",children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.trojan.network.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.trojan.networkOptions.map(w=>e.jsx($,{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(v,{control:c.control,name:"version",render:({field:p})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:l("dynamic_form.hysteria.version.label")}),e.jsx(b,{children:e.jsxs(X,{value:(p.value||2).toString(),onValueChange:w=>p.onChange(Number(w)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.hysteria.version.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.hysteria.versions.map(w=>e.jsxs($,{value:w,className:"cursor-pointer",children:["V",w]},w))})})]})})]})}),c.watch("version")==1&&e.jsx(v,{control:c.control,name:"alpn",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.hysteria.alpn.label")}),e.jsx(b,{children:e.jsxs(X,{value:p.value||"h2",onValueChange:p.onChange,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.hysteria.alpn.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.hysteria.alpnOptions.map(w=>e.jsx($,{value:w,children:w},w))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"obfs.open",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.hysteria.obfs.label")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value||!1,onCheckedChange:p.onChange})})})]})}),!!c.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[c.watch("version")=="2"&&e.jsx(v,{control:c.control,name:"obfs.type",render:({field:p})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:l("dynamic_form.hysteria.obfs.type.label")}),e.jsx(b,{children:e.jsxs(X,{value:p.value||"salamander",onValueChange:p.onChange,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.hysteria.obfs.type.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:e.jsx($,{value:"salamander",children:l("dynamic_form.hysteria.obfs.type.salamander")})})})]})})]})}),e.jsx(v,{control:c.control,name:"obfs.password",render:({field:p})=>e.jsxs(f,{className:c.watch("version")==2?"w-full":"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.hysteria.obfs.password.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.hysteria.obfs.password.placeholder"),...p,value:p.value||"",className:"pr-9"})}),e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",I=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(H=>w[H%w.length]).join("");c.setValue("obfs.password",I),A.success(l("dynamic_form.hysteria.obfs.password.generate_success"))},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(ze,{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(v,{control:c.control,name:"tls.server_name",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.hysteria.tls.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.hysteria.tls.server_name.placeholder"),...p,value:p.value||""})})]})}),e.jsx(v,{control:c.control,name:"tls.allow_insecure",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.hysteria.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value||!1,onCheckedChange:p.onChange})})})]})})]}),e.jsx(v,{control:c.control,name:"bandwidth.up",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.hysteria.bandwidth.up.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:l("dynamic_form.hysteria.bandwidth.up.placeholder")+(c.watch("version")==2?l("dynamic_form.hysteria.bandwidth.up.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...p,value:p.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:l("dynamic_form.hysteria.bandwidth.up.suffix")})})]})]})}),e.jsx(v,{control:c.control,name:"bandwidth.down",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.hysteria.bandwidth.down.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:l("dynamic_form.hysteria.bandwidth.down.placeholder")+(c.watch("version")==2?l("dynamic_form.hysteria.bandwidth.down.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...p,value:p.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:l("dynamic_form.hysteria.bandwidth.down.suffix")})})]})]})}),e.jsx(e.Fragment,{children:e.jsx(v,{control:c.control,name:"hop_interval",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.hysteria.hop_interval.label","Hop 间隔 (秒)")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:l("dynamic_form.hysteria.hop_interval.placeholder","例如: 30"),...p,value:p.value||"",onChange:w=>{const I=w.target.value?parseInt(w.target.value):void 0;p.onChange(I)}})}),e.jsx(F,{children:l("dynamic_form.hysteria.hop_interval.description","Hop 间隔时间,单位为秒")})]})})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"tls",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.vless.tls.label")}),e.jsx(b,{children:e.jsxs(X,{value:p.value?.toString(),onValueChange:w=>p.onChange(Number(w)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.vless.tls.placeholder")})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:l("dynamic_form.vless.tls.none")}),e.jsx($,{value:"1",children:l("dynamic_form.vless.tls.tls")}),e.jsx($,{value:"2",children:l("dynamic_form.vless.tls.reality")})]})]})})]})}),c.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls_settings.server_name",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.vless.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.vless.tls_settings.server_name.placeholder"),...p})})]})}),e.jsx(v,{control:c.control,name:"tls_settings.allow_insecure",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.vless.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value,onCheckedChange:p.onChange})})})]})})]}),c.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"reality_settings.server_name",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.vless.reality_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.vless.reality_settings.server_name.placeholder"),...p})})]})}),e.jsx(v,{control:c.control,name:"reality_settings.server_port",render:({field:p})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:l("dynamic_form.vless.reality_settings.server_port.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.vless.reality_settings.server_port.placeholder"),...p})})]})}),e.jsx(v,{control:c.control,name:"reality_settings.allow_insecure",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.vless.reality_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value,onCheckedChange:p.onChange})})})]})})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx(v,{control:c.control,name:"reality_settings.private_key",render:({field:p})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:l("dynamic_form.vless.reality_settings.private_key.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(D,{...p,className:"pr-9"})}),e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{try{const w=Eu();c.setValue("reality_settings.private_key",w.privateKey),c.setValue("reality_settings.public_key",w.publicKey),A.success(l("dynamic_form.vless.reality_settings.key_pair.success"))}catch{A.error(l("dynamic_form.vless.reality_settings.key_pair.error"))}},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(ze,{icon:"ion:key-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(ma,{children:e.jsx(de,{children:e.jsx("p",{children:l("dynamic_form.vless.reality_settings.key_pair.generate")})})})]})]})]})})}),e.jsx(v,{control:c.control,name:"reality_settings.public_key",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.vless.reality_settings.public_key.label")}),e.jsx(b,{children:e.jsx(D,{...p})})]})}),e.jsx(v,{control:c.control,name:"reality_settings.short_id",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.vless.reality_settings.short_id.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(D,{...p,className:"pr-9",placeholder:l("dynamic_form.vless.reality_settings.short_id.placeholder")})}),e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const w=Iu();c.setValue("reality_settings.short_id",w),A.success(l("dynamic_form.vless.reality_settings.short_id.success"))},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(ze,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(ma,{children:e.jsx(de,{children:e.jsx("p",{children:l("dynamic_form.vless.reality_settings.short_id.generate")})})})]})]}),e.jsx(F,{className:"text-xs text-muted-foreground",children:l("dynamic_form.vless.reality_settings.short_id.description")})]})})]}),e.jsx(v,{control:c.control,name:"network",render:({field:p})=>e.jsxs(f,{children:[e.jsxs(j,{children:[l("dynamic_form.vless.network.label"),e.jsx(Ga,{value:c.watch("network_settings"),setValue:w=>c.setValue("network_settings",w),templateType:c.watch("network")})]}),e.jsx(b,{children:e.jsxs(X,{onValueChange:p.onChange,value:p.value,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.vless.network.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.vless.networkOptions.map(w=>e.jsx($,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})}),e.jsx(v,{control:c.control,name:"flow",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.vless.flow.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:w=>p.onChange(w==="none"?null:w),value:p.value||"none",children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.vless.flow.placeholder")})}),e.jsx(J,{children:Te.vless.flowOptions.map(w=>e.jsx($,{value:w,children:w},w))})]})})]})})]}),tuic:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"version",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.tuic.version.label")}),e.jsx(b,{children:e.jsxs(X,{value:p.value?.toString(),onValueChange:w=>p.onChange(Number(w)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.tuic.version.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.tuic.versions.map(w=>e.jsxs($,{value:w,children:["V",w]},w))})})]})})]})}),e.jsx(v,{control:c.control,name:"congestion_control",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.tuic.congestion_control.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:p.onChange,value:p.value,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.tuic.congestion_control.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.tuic.congestionControls.map(w=>e.jsx($,{value:w,children:w.toUpperCase()},w))})})]})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls.server_name",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.tuic.tls.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.tuic.tls.server_name.placeholder"),...p})})]})}),e.jsx(v,{control:c.control,name:"tls.allow_insecure",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.tuic.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value,onCheckedChange:p.onChange})})})]})})]}),e.jsx(v,{control:c.control,name:"alpn",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.tuic.tls.alpn.label")}),e.jsx(b,{children:e.jsx(_t,{options:Te.tuic.alpnOptions,onChange:w=>p.onChange(w.map(I=>I.value)),value:Te.tuic.alpnOptions.filter(w=>p.value?.includes(w.value)),placeholder:l("dynamic_form.tuic.tls.alpn.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:l("dynamic_form.tuic.tls.alpn.empty")})})})]})}),e.jsx(v,{control:c.control,name:"udp_relay_mode",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.tuic.udp_relay_mode.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:p.onChange,value:p.value,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.tuic.udp_relay_mode.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.tuic.udpRelayModes.map(w=>e.jsx($,{value:w.value,children:w.label},w.value))})})]})})]})})]}),socks:()=>e.jsx(e.Fragment,{}),naive:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"tls",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.naive.tls.label")}),e.jsx(b,{children:e.jsxs(X,{value:p.value?.toString(),onValueChange:w=>p.onChange(Number(w)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.naive.tls.placeholder")})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:l("dynamic_form.naive.tls.disabled")}),e.jsx($,{value:"1",children:l("dynamic_form.naive.tls.enabled")})]})]})})]})}),c.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls_settings.server_name",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.naive.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.naive.tls_settings.server_name.placeholder"),...p})})]})}),e.jsx(v,{control:c.control,name:"tls_settings.allow_insecure",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.naive.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value,onCheckedChange:p.onChange})})})]})})]})]}),http:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"tls",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.http.tls.label")}),e.jsx(b,{children:e.jsxs(X,{value:p.value?.toString(),onValueChange:w=>p.onChange(Number(w)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.http.tls.placeholder")})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:l("dynamic_form.http.tls.disabled")}),e.jsx($,{value:"1",children:l("dynamic_form.http.tls.enabled")})]})]})})]})}),c.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls_settings.server_name",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.http.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.http.tls_settings.server_name.placeholder"),...p})})]})}),e.jsx(v,{control:c.control,name:"tls_settings.allow_insecure",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.http.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value,onCheckedChange:p.onChange})})})]})})]})]}),mieru:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:c.control,name:"transport",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.mieru.transport.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:p.onChange,value:p.value,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.mieru.transport.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.mieru.transportOptions.map(w=>e.jsx($,{value:w.value,children:w.label},w.value))})})]})})]})}),e.jsx(v,{control:c.control,name:"multiplexing",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.mieru.multiplexing.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:p.onChange,value:p.value,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dynamic_form.mieru.multiplexing.placeholder")})}),e.jsx(J,{children:e.jsx(Be,{children:Te.mieru.multiplexingOptions.map(w=>e.jsx($,{value:w.value,children:w.label},w.value))})})]})})]})})]}),anytls:()=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:c.control,name:"padding_scheme",render:({field:p})=>e.jsxs(f,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(j,{children:l("dynamic_form.anytls.padding_scheme.label","AnyTLS 填充方案")}),e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:()=>{c.setValue("padding_scheme",Te.anytls.defaultPaddingScheme),A.success(l("dynamic_form.anytls.padding_scheme.default_success","已设置默认填充方案"))},className:"h-7 px-2",children:l("dynamic_form.anytls.padding_scheme.use_default","使用默认方案")})]}),e.jsx(F,{children:l("dynamic_form.anytls.padding_scheme.description","每行一个填充规则,格式如: stop=8, 0=30-30")}),e.jsx(b,{children:e.jsx("textarea",{className:"flex min-h-[100px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:l("dynamic_form.anytls.padding_scheme.placeholder",`例如: stop=8 0=30-30 1=100-400 -2=400-500,c,500-1000`),...g,value:Array.isArray(g.value)?g.value.join(` -`):"",onChange:_=>{const U=_.target.value.split(` -`).filter(M=>M.trim()!=="");g.onChange(U)}})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:r("dynamic_form.anytls.tls.server_name.label","SNI")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dynamic_form.anytls.tls.server_name.placeholder","服务器名称"),...g})})]})}),e.jsx(v,{control:c.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dynamic_form.anytls.tls.allow_insecure","允许不安全连接")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]})})};return e.jsx(be,{children:R[s]?.()})};function Lu(){const{t:s}=V("server"),n=x.object({id:x.number().optional().nullable(),specific_key:x.string().optional().nullable(),code:x.string().optional(),show:x.boolean().optional().nullable(),name:x.string().min(1,s("form.name.error")),rate:x.string().min(1,s("form.rate.error")).refine(I=>!isNaN(parseFloat(I))&&isFinite(Number(I)),{message:s("form.rate.error_numeric")}).refine(I=>parseFloat(I)>=0,{message:s("form.rate.error_gte_zero")}),tags:x.array(x.string()).default([]),excludes:x.array(x.string()).default([]),ips:x.array(x.string()).default([]),group_ids:x.array(x.string()).default([]),host:x.string().min(1,s("form.host.error")),port:x.string().min(1,s("form.port.error")),server_port:x.string().min(1,s("form.server_port.error")),parent_id:x.string().default("0").nullable(),route_ids:x.array(x.string()).default([]),protocol_settings:x.record(x.any()).default({}).nullable()}),t={id:null,specific_key:null,code:"",show:!1,name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null},{isOpen:r,setIsOpen:a,editingServer:l,setEditingServer:i,serverType:c,setServerType:u,refetch:o}=kl(),[d,h]=m.useState([]),[w,P]=m.useState([]),[k,C]=m.useState([]),N=ye({resolver:_e(n),defaultValues:t,mode:"onChange"});m.useEffect(()=>{p()},[r]),m.useEffect(()=>{l?.type&&l.type!==c&&u(l.type)},[l,c,u]),m.useEffect(()=>{l?l.type===c&&N.reset({...t,...l}):N.reset({...t,protocol_settings:De[c].schema.parse({})})},[l,N,c]);const p=async()=>{if(!r)return;const[I,U,M]=await Promise.all([at.getList(),Ca.getList(),Js.getList()]);h(I.data?.map(X=>({label:X.name,value:X.id.toString()}))||[]),P(U.data?.map(X=>({label:X.remarks,value:X.id.toString()}))||[]),C(M.data||[])},S=m.useMemo(()=>k?.filter(I=>(I.parent_id===0||I.parent_id===null)&&I.type===c&&I.id!==N.watch("id")),[c,k,N]),R=()=>e.jsxs(Is,{children:[e.jsx(Ls,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Oe,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(Ss,{align:"start",children:e.jsx(rd,{children:rs.map(({type:I,label:U})=>e.jsx(Ne,{onClick:()=>{u(I),a(!0)},className:"cursor-pointer",children:e.jsx(G,{variant:"outline",className:"text-white",style:{background:Ke[I]},children:U})},I))})})]}),g=()=>{a(!1),i(null),N.reset(t)},_=async()=>{const I=N.getValues();(await Js.save({...I,type:c})).data&&(g(),$.success(s("form.success")),o())};return e.jsxs(pe,{open:r,onOpenChange:g,children:[R(),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:s(l?"form.edit_node":"form.new_node")}),e.jsx(Le,{})]}),e.jsxs(we,{...N,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:N.control,name:"name",render:({field:I})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:s("form.name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("form.name.placeholder"),...I})}),e.jsx(D,{})]})}),e.jsx(v,{control:N.control,name:"rate",render:({field:I})=>e.jsxs(f,{className:"flex-[1]",children:[e.jsx(j,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(b,{children:e.jsx(T,{type:"number",min:"0",step:"0.1",...I})})}),e.jsx(D,{})]})})]}),e.jsx(v,{control:N.control,name:"code",render:({field:I})=>e.jsxs(f,{children:[e.jsxs(j,{children:[s("form.code.label"),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:s("form.code.optional")})]}),e.jsx(b,{children:e.jsx(T,{placeholder:s("form.code.placeholder"),...I,value:I.value||""})}),e.jsx(D,{})]})}),e.jsx(v,{control:N.control,name:"tags",render:({field:I})=>e.jsxs(f,{children:[e.jsx(j,{children:s("form.tags.label")}),e.jsx(b,{children:e.jsx(jn,{value:I.value,onChange:I.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(D,{})]})}),e.jsx(v,{control:N.control,name:"group_ids",render:({field:I})=>e.jsxs(f,{children:[e.jsxs(j,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(La,{dialogTrigger:e.jsx(E,{variant:"link",children:s("form.groups.add")}),refetch:p})]}),e.jsx(b,{children:e.jsx(_t,{options:d,onChange:U=>I.onChange(U.map(M=>M.value)),value:d?.filter(U=>I.value.includes(U.value)),placeholder:s("form.groups.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:s("form.groups.empty")})})}),e.jsx(D,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:N.control,name:"host",render:({field:I})=>e.jsxs(f,{children:[e.jsx(j,{children:s("form.host.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:s("form.host.placeholder"),...I})}),e.jsx(D,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(v,{control:N.control,name:"port",render:({field:I})=>e.jsxs(f,{className:"flex-1",children:[e.jsxs(j,{className:"flex items-center gap-1.5",children:[s("form.port.label"),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(Oe,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(ca,{children:e.jsx(ce,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.port.tooltip")})})})]})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(b,{children:e.jsx(T,{placeholder:s("form.port.placeholder"),...I})}),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const U=I.value;U&&N.setValue("server_port",U)},children:e.jsx(Oe,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(ce,{side:"right",children:e.jsx("p",{children:s("form.port.sync")})})]})})]}),e.jsx(D,{})]})}),e.jsx(v,{control:N.control,name:"server_port",render:({field:I})=>e.jsxs(f,{className:"flex-1",children:[e.jsxs(j,{className:"flex items-center gap-1.5",children:[s("form.server_port.label"),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(Oe,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(ca,{children:e.jsx(ce,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.server_port.tooltip")})})})]})})]}),e.jsx(b,{children:e.jsx(T,{placeholder:s("form.server_port.placeholder"),...I})}),e.jsx(D,{})]})})]})]}),r&&e.jsx(Iu,{serverType:c,value:N.watch("protocol_settings"),onChange:I=>N.setValue("protocol_settings",I,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(v,{control:N.control,name:"parent_id",render:({field:I})=>e.jsxs(f,{children:[e.jsx(j,{children:s("form.parent.label")}),e.jsxs(J,{onValueChange:I.onChange,value:I.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:s("form.parent.placeholder")})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("form.parent.none")}),S?.map(U=>e.jsx(A,{value:U.id.toString(),className:"cursor-pointer",children:U.name},U.id))]})]}),e.jsx(D,{})]})}),e.jsx(v,{control:N.control,name:"route_ids",render:({field:I})=>e.jsxs(f,{children:[e.jsx(j,{children:s("form.route.label")}),e.jsx(b,{children:e.jsx(_t,{options:w,onChange:U=>I.onChange(U.map(M=>M.value)),value:w?.filter(U=>I.value.includes(U.value)),placeholder:s("form.route.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:s("form.route.empty")})})}),e.jsx(D,{})]})})]}),e.jsxs(Pe,{className:"mt-6 flex flex-col sm:flex-row gap-2 sm:gap-0",children:[e.jsx(E,{type:"button",variant:"outline",onClick:g,className:"w-full sm:w-auto",children:s("form.cancel")}),e.jsx(E,{type:"submit",onClick:_,className:"w-full sm:w-auto",children:s("form.submit")})]})]})]})]})}function Un({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=new Set(s?.getFilterValue());return e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(ya,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(G,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:a.size>2?e.jsxs(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):t.filter(l=>a.has(l.value)).map(l=>e.jsx(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:l.label},l.value))})]})]})}),e.jsx(vs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:n}),e.jsxs(Ks,{children:[e.jsx(rt,{children:"No results found."}),e.jsx(ss,{children:t.map(l=>{const i=a.has(l.value);return e.jsxs(Me,{onSelect:()=>{i?a.delete(l.value):a.add(l.value);const c=Array.from(a);s?.setFilterValue(c.length?c: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",i?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(et,{className:y("h-4 w-4")})}),l.icon&&e.jsx(l.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${l.color}`}),e.jsx("span",{children:l.label}),r?.get(l.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(l.value)})]},l.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ct,{}),e.jsx(ss,{children:e.jsx(Me,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Vu=[{value:le.Shadowsocks,label:rs.find(s=>s.type===le.Shadowsocks)?.label,color:Ke[le.Shadowsocks]},{value:le.Vmess,label:rs.find(s=>s.type===le.Vmess)?.label,color:Ke[le.Vmess]},{value:le.Trojan,label:rs.find(s=>s.type===le.Trojan)?.label,color:Ke[le.Trojan]},{value:le.Hysteria,label:rs.find(s=>s.type===le.Hysteria)?.label,color:Ke[le.Hysteria]},{value:le.Vless,label:rs.find(s=>s.type===le.Vless)?.label,color:Ke[le.Vless]},{value:le.Tuic,label:rs.find(s=>s.type===le.Tuic)?.label,color:Ke[le.Tuic]},{value:le.Socks,label:rs.find(s=>s.type===le.Socks)?.label,color:Ke[le.Socks]},{value:le.Naive,label:rs.find(s=>s.type===le.Naive)?.label,color:Ke[le.Naive]},{value:le.Http,label:rs.find(s=>s.type===le.Http)?.label,color:Ke[le.Http]},{value:le.Mieru,label:rs.find(s=>s.type===le.Mieru)?.label,color:Ke[le.Mieru]}];function Fu({table:s,saveOrder:n,isSortMode:t,groups:r}){const a=s.getState().columnFilters.length>0,{t:l}=V("server");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:[!t&&e.jsxs(e.Fragment,{children:[e.jsx(Lu,{}),e.jsx(T,{placeholder:l("toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:i=>s.getColumn("name")?.setFilterValue(i.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(Un,{column:s.getColumn("type"),title:l("toolbar.type"),options:Vu}),s.getColumn("group_ids")&&e.jsx(Un,{column:s.getColumn("group_ids"),title:l("columns.groups.title"),options:r.map(i=>({label:i.name,value:i.id.toString()}))})]}),a&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(ls,{className:"ml-2 h-4 w-4"})]})]}),t&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("toolbar.sort.tip")})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(E,{variant:t?"default":"outline",onClick:n,size:"sm",children:l(t?"toolbar.sort.save":"toolbar.sort.edit")})})]})}const Kt=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"})}),sa={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"},Ou=s=>{const{t:n}=V("server");return[{id:"drag-handle",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.sort")}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(ba,{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(z,{column:t,title:n("columns.nodeId")}),cell:({row:t})=>{const r=t.getValue("id"),a=t.original.code;return e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(G,{variant:"outline",className:y("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:Ke[t.original.type]},children:[e.jsx(Hr,{className:"size-3"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"flex items-center gap-0.5",children:a??r}),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(E,{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(),ua(a||r.toString()).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(Fn,{className:"size-3"})})]})}),e.jsxs(ce,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[rs.find(l=>l.type===t.original.type)?.label,t.original.parent_id?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:50,enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.show")}),cell:({row:t})=>{const[r,a]=m.useState(!!t.getValue("show"));return e.jsx(Z,{checked:r,onCheckedChange:async l=>{a(l),Js.update({id:t.original.id,type:t.original.type,show:l?1:0}).catch(()=>{a(!l),s()})},style:{backgroundColor:r?Ke[t.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(z,{column:t,title:n("columns.node"),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",sa[0])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.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",sa[1])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.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",sa[2])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.2")})]})]})})}),cell:({row:t})=>e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{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",sa[t.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:t.getValue("name")})]})}),e.jsx(ce,{children:e.jsx("p",{className:"font-medium",children:n(`columns.status.${t.original.available_status}`)})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.address")}),cell:({row:t})=>{const r=`${t.original.host}:${t.original.port}`,a=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]})}),a&&e.jsxs("span",{className:"whitespace-nowrap text-[0.7rem] tracking-tight text-muted-foreground/40",children:["(",n("columns.internalPort")," ",t.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(be,{delayDuration:0,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{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(),ua(r).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(Fn,{className:"size-3"})})}),e.jsx(ce,{side:"top",sideOffset:10,children:n("columns.copyAddress")})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.onlineUsers.title"),tooltip:n("columns.onlineUsers.tooltip")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Kt,{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(z,{column:t,title:n("columns.rate.title"),tooltip:n("columns.rate.tooltip")}),cell:({row:t})=>e.jsxs(G,{variant:"secondary",className:"font-medium",children:[t.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"group_ids",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.groups.title"),tooltip:n("columns.groups.tooltip")}),cell:({row:t})=>{const r=t.original.groups||[];return e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[r.map((a,l)=>e.jsx(G,{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:a.name},l)),r.length===0&&e.jsx("span",{className:"text-sm text-muted-foreground",children:n("columns.groups.empty")})]})},enableSorting:!1,filterFn:(t,r,a)=>{const l=t.getValue(r);return l?a.some(i=>l.includes(i)):!1}},{accessorKey:"type",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.type")}),cell:({row:t})=>{const r=t.getValue("type");return e.jsx(G,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:Ke[r]},children:r})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>{const{setIsOpen:r,setEditingServer:a,setServerType:l}=kl();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(Is,{modal:!1,children:[e.jsx(Ls,{asChild:!0,children:e.jsx(E,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":n("columns.actions"),children:e.jsx(da,{className:"size-4"})})}),e.jsxs(Ss,{align:"end",className:"w-40",children:[e.jsx(Ne,{className:"cursor-pointer",onClick:()=>{l(t.original.type),a(t.original),r(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(cc,{className:"mr-2 size-4"}),n("columns.actions_dropdown.edit")]})}),e.jsxs(Ne,{className:"cursor-pointer",onClick:async()=>{Js.copy({id:t.original.id}).then(({data:i})=>{i&&($.success(n("columns.actions_dropdown.copy_success")),s())})},children:[e.jsx(dc,{className:"mr-2 size-4"}),n("columns.actions_dropdown.copy")]}),e.jsx(yt,{}),e.jsx(Ne,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:i=>i.preventDefault(),children:e.jsx(ts,{title:n("columns.actions_dropdown.delete.title"),description:n("columns.actions_dropdown.delete.description"),confirmText:n("columns.actions_dropdown.delete.confirm"),variant:"destructive",onConfirm:async()=>{Js.drop({id:t.original.id}).then(({data:i})=>{i&&($.success(n("columns.actions_dropdown.delete_success")),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(ps,{className:"mr-2 size-4"}),n("columns.actions_dropdown.delete.confirm")]})})})]})]})})},size:50}]};function Mu(){const[s,n]=m.useState({}),[t,r]=m.useState({"drag-handle":!1}),[a,l]=m.useState([]),[i,c]=m.useState({pageSize:500,pageIndex:0}),[u,o]=m.useState([]),[d,h]=m.useState(!1),[w,P]=m.useState({}),[k,C]=m.useState([]),{refetch:N}=ne({queryKey:["nodeList"],queryFn:async()=>{const{data:I}=await Js.getList();return C(I),I}}),{data:p}=ne({queryKey:["groups"],queryFn:async()=>{const{data:I}=await at.getList();return I}});m.useEffect(()=>{r({"drag-handle":d,show:!d,host:!d,online:!d,rate:!d,groups:!d,type:!1,actions:!d}),P({name:d?2e3:200}),c({pageSize:d?99999:500,pageIndex:0})},[d]);const S=(I,U)=>{d&&(I.dataTransfer.setData("text/plain",U.toString()),I.currentTarget.classList.add("opacity-50"))},R=(I,U)=>{if(!d)return;I.preventDefault(),I.currentTarget.classList.remove("bg-muted");const M=parseInt(I.dataTransfer.getData("text/plain"));if(M===U)return;const X=[...k],[ie]=X.splice(M,1);X.splice(U,0,ie),C(X)},g=async()=>{if(!d){h(!0);return}const I=k?.map((U,M)=>({id:U.id,order:M+1}));Js.sort(I).then(()=>{$.success("排序保存成功"),h(!1),N()}).finally(()=>{h(!1)})},_=is({data:k||[],columns:Ou(N),state:{sorting:u,columnVisibility:t,rowSelection:s,columnFilters:a,columnSizing:w,pagination:i},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:o,onColumnFiltersChange:l,onColumnVisibilityChange:r,onColumnSizingChange:P,onPaginationChange:c,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),getSortedRowModel:js(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Os(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(pu,{refetch:N,children:e.jsx("div",{className:"space-y-4",children:e.jsx(bs,{table:_,toolbar:I=>e.jsx(Fu,{table:I,refetch:N,saveOrder:g,isSortMode:d,groups:p||[]}),draggable:d,onDragStart:S,onDragEnd:I=>I.currentTarget.classList.remove("opacity-50"),onDragOver:I=>{I.preventDefault(),I.currentTarget.classList.add("bg-muted")},onDragLeave:I=>I.currentTarget.classList.remove("bg-muted"),onDrop:R,showPagination:!d})})})}function zu(){const{t:s}=V("server");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("manage.title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("manage.description")})]})}),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(Mu,{})})]})]})}const Au=Object.freeze(Object.defineProperty({__proto__:null,default:zu},Symbol.toStringTag,{value:"Module"}));function $u({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=V("group");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(La,{refetch:n}),e.jsx(T,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("name")?.getFilterValue()??"",onChange:a=>s.getColumn("name")?.setFilterValue(a.target.value),className:y("h-8 w-[150px] lg:w-[250px]",t&&"border-primary/50 ring-primary/20")}),t&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(ls,{className:"ml-2 h-4 w-4"})]})]})})}const qu=s=>{const{t:n}=V("group");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.id")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(G,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.name")}),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(z,{column:t,title:n("columns.usersCount")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Kt,{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(z,{column:t,title:n("columns.serverCount")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Hr,{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(z,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(La,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(ts,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{at.drop({id:t.original.id}).then(({data:r})=>{r&&($.success(n("messages.updateSuccess")),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ps,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("messages.deleteButton")})]})})]})}]};function Hu(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,l]=m.useState([]),[i,c]=m.useState([]),{data:u,refetch:o,isLoading:d}=ne({queryKey:["serverGroupList"],queryFn:async()=>{const{data:w}=await at.getList();return w}}),h=is({data:u||[],columns:qu(o),state:{sorting:i,columnVisibility:t,rowSelection:s,columnFilters:a},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:c,onColumnFiltersChange:l,onColumnVisibilityChange:r,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),getSortedRowModel:js(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Os(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(bs,{table:h,toolbar:w=>e.jsx($u,{table:w,refetch:o}),isLoading:d})}function Uu(){const{t:s}=V("group");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),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(Hu,{})})]})]})}const Ku=Object.freeze(Object.defineProperty({__proto__:null,default:Uu},Symbol.toStringTag,{value:"Module"})),Bu=s=>x.object({remarks:x.string().min(1,s("form.validation.remarks")),match:x.array(x.string()),action:x.enum(["block","dns"]),action_value:x.string().optional()});function Tl({refetch:s,dialogTrigger:n,defaultValues:t={remarks:"",match:[],action:"block",action_value:""},type:r="add"}){const{t:a}=V("route"),l=ye({resolver:_e(Bu(a)),defaultValues:t,mode:"onChange"}),[i,c]=m.useState(!1);return e.jsxs(pe,{open:i,onOpenChange:c,children:[e.jsx(as,{asChild:!0,children:n||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Oe,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:a(r==="edit"?"form.edit":"form.create")}),e.jsx(Le,{})]}),e.jsxs(we,{...l,children:[e.jsx(v,{control:l.control,name:"remarks",render:({field:u})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:a("form.remarks")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(T,{type:"text",placeholder:a("form.remarksPlaceholder"),...u})})}),e.jsx(D,{})]})}),e.jsx(v,{control:l.control,name:"match",render:({field:u})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:a("form.match")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(Ds,{className:"min-h-[120px]",placeholder:a("form.matchPlaceholder"),value:u.value.join(` -`),onChange:o=>{u.onChange(o.target.value.split(` -`))}})})}),e.jsx(D,{})]})}),e.jsx(v,{control:l.control,name:"action",render:({field:u})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsxs(J,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("form.actionPlaceholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"block",children:a("actions.block")}),e.jsx(A,{value:"dns",children:a("actions.dns")})]})]})})}),e.jsx(D,{})]})}),l.watch("action")==="dns"&&e.jsx(v,{control:l.control,name:"action_value",render:({field:u})=>e.jsxs(f,{children:[e.jsx(j,{children:a("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(T,{type:"text",placeholder:a("form.dnsPlaceholder"),...u})})})]})}),e.jsxs(Pe,{children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{variant:"outline",children:a("form.cancel")})}),e.jsx(E,{type:"submit",onClick:()=>{Ca.getList(l.getValues()).then(({data:u})=>{u&&(c(!1),s&&s(),$.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),l.reset())})},children:a("form.submit")})]})]})]})]})}function Gu({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=V("route");return e.jsx("div",{className:"flex items-center justify-between ",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[e.jsx(Tl,{refetch:n}),e.jsx(T,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:a=>s.getColumn("remarks")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(ls,{className:"ml-2 h-4 w-4"})]})]})})}function Wu({columns:s,data:n,refetch:t}){const[r,a]=m.useState({}),[l,i]=m.useState({}),[c,u]=m.useState([]),[o,d]=m.useState([]),h=is({data:n,columns:s,state:{sorting:o,columnVisibility:l,rowSelection:r,columnFilters:c},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:d,onColumnFiltersChange:u,onColumnVisibilityChange:i,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),getSortedRowModel:js(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Os(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(bs,{table:h,toolbar:w=>e.jsx(Gu,{table:w,refetch:t})})}const Yu=s=>{const{t:n}=V("route"),t={block:{icon:mc,variant:"destructive",className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800"},dns:{icon:uc,variant:"secondary",className:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800"}};return[{accessorKey:"id",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.id")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(G,{variant:"outline",children:r.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.remarks")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:r.original.remarks})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action_value",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.action_value.title")}),cell:({row:r})=>{const a=r.original.action,l=r.original.action_value,i=r.original.match?.length||0;return e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:a==="dns"&&l?n("columns.action_value.dns",{value:l}):a==="block"?e.jsx("span",{className:"text-destructive",children:n("columns.action_value.block")}):n("columns.action_value.direct")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("columns.matchRules",{count:i})})]})},enableHiding:!1,enableSorting:!1,size:300},{accessorKey:"action",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.action")}),cell:({row:r})=>{const a=r.getValue("action"),l=t[a]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(G,{variant:t[a]?.variant||"default",className:y("flex items-center gap-1.5 px-3 py-1 capitalize",t[a]?.className),children:[l&&e.jsx(l,{className:"h-3.5 w-3.5"}),n(`actions.${a}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:n("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Tl,{defaultValues:r.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(ts,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{Ca.drop({id:r.original.id}).then(({data:a})=>{a&&($.success(n("messages.deleteSuccess")),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ps,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("messages.deleteButton")})]})})]})}]};function Ju(){const{t:s}=V("route"),[n,t]=m.useState([]);function r(){Ca.getList().then(({data:a})=>{t(a)})}return m.useEffect(()=>{r()},[]),e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),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(Wu,{data:n,columns:Yu(r),refetch:r})})]})]})}const Qu=Object.freeze(Object.defineProperty({__proto__:null,default:Ju},Symbol.toStringTag,{value:"Module"})),Dl=m.createContext(void 0);function Xu({children:s,refreshData:n}){const[t,r]=m.useState(!1),[a,l]=m.useState(null);return e.jsx(Dl.Provider,{value:{isOpen:t,setIsOpen:r,editingPlan:a,setEditingPlan:l,refreshData:n},children:s})}function vn(){const s=m.useContext(Dl);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function Zu({table:s,saveOrder:n,isSortMode:t}){const{setIsOpen:r}=vn(),{t:a}=V("subscribe");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(E,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>r(!0),children:[e.jsx(Oe,{icon:"ion:add"}),e.jsx("div",{children:a("plan.add")})]}),e.jsx(T,{placeholder:a("plan.search"),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(E,{variant:t?"default":"outline",onClick:n,size:"sm",children:a(t?"plan.sort.save":"plan.sort.edit")})})]})}const Kn={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"}},ex=s=>{const{t:n}=V("subscribe");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(ba,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.id")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(G,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.show")}),cell:({row:t})=>e.jsx(Z,{defaultChecked:t.getValue("show"),onCheckedChange:r=>{Xe.update({id:t.original.id,show:r}).then(({data:a})=>{!a&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.sell")}),cell:({row:t})=>e.jsx(Z,{defaultChecked:t.getValue("sell"),onCheckedChange:r=>{Xe.update({id:t.original.id,sell:r}).then(({data:a})=>{!a&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.renew"),tooltip:n("plan.columns.renew_tooltip")}),cell:({row:t})=>e.jsx(Z,{defaultChecked:t.getValue("renew"),onCheckedChange:r=>{Xe.update({id:t.original.id,renew:r}).then(({data:a})=>{!a&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.name")}),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(z,{column:t,title:n("plan.columns.stats")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-2",children:[e.jsx(Kt,{}),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(z,{column:t,title:n("plan.columns.group")}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center gap-1.5 text-nowrap",children:e.jsx(G,{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(z,{column:t,title:n("plan.columns.price")}),cell:({row:t})=>{const r=t.getValue("prices"),a=[{period:n("plan.columns.price_period.monthly"),key:"monthly",unit:n("plan.columns.price_period.unit.month")},{period:n("plan.columns.price_period.quarterly"),key:"quarterly",unit:n("plan.columns.price_period.unit.quarter")},{period:n("plan.columns.price_period.half_yearly"),key:"half_yearly",unit:n("plan.columns.price_period.unit.half_year")},{period:n("plan.columns.price_period.yearly"),key:"yearly",unit:n("plan.columns.price_period.unit.year")},{period:n("plan.columns.price_period.two_yearly"),key:"two_yearly",unit:n("plan.columns.price_period.unit.two_year")},{period:n("plan.columns.price_period.three_yearly"),key:"three_yearly",unit:n("plan.columns.price_period.unit.three_year")},{period:n("plan.columns.price_period.onetime"),key:"onetime",unit:""},{period:n("plan.columns.price_period.reset_traffic"),key:"reset_traffic",unit:n("plan.columns.price_period.unit.times")}];return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:a.map(({period:l,key:i,unit:c})=>r[i]!=null&&e.jsxs(G,{variant:"secondary",className:y("px-2 py-0.5 font-medium transition-colors text-nowrap",Kn[i].color,Kn[i].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[l," ¥",r[i],c]},i))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:n("plan.columns.actions")}),cell:({row:t})=>{const{setIsOpen:r,setEditingPlan:a}=vn();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{a(t.original),r(!0)},children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.edit")})]}),e.jsx(ts,{title:n("plan.columns.delete_confirm.title"),description:n("plan.columns.delete_confirm.description"),confirmText:n("plan.columns.delete"),variant:"destructive",onConfirm:async()=>{Xe.drop({id:t.original.id}).then(({data:l})=>{l&&($.success(n("plan.columns.delete_confirm.success")),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ps,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.delete")})]})})]})}}]},sx=x.object({id:x.number().nullable(),group_id:x.union([x.number(),x.string()]).nullable().optional(),name:x.string().min(1).max(250),content:x.string().nullable().optional(),transfer_enable:x.union([x.number().min(0),x.string().min(1)]),prices:x.object({monthly:x.union([x.number(),x.string()]).nullable().optional(),quarterly:x.union([x.number(),x.string()]).nullable().optional(),half_yearly:x.union([x.number(),x.string()]).nullable().optional(),yearly:x.union([x.number(),x.string()]).nullable().optional(),two_yearly:x.union([x.number(),x.string()]).nullable().optional(),three_yearly:x.union([x.number(),x.string()]).nullable().optional(),onetime:x.union([x.number(),x.string()]).nullable().optional(),reset_traffic:x.union([x.number(),x.string()]).nullable().optional()}).default({}),speed_limit:x.union([x.number(),x.string()]).nullable().optional(),capacity_limit:x.union([x.number(),x.string()]).nullable().optional(),device_limit:x.union([x.number(),x.string()]).nullable().optional(),force_update:x.boolean().optional(),reset_traffic_method:x.number().nullable(),users_count:x.number().optional()}),bn=m.forwardRef(({className:s,...n},t)=>e.jsx(Ur,{ref:t,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),...n,children:e.jsx(xc,{className:y("flex items-center justify-center text-current"),children:e.jsx(et,{className:"h-4 w-4"})})}));bn.displayName=Ur.displayName;const ta={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},aa={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}},tx=[{value:null,label:"follow_system"},{value:0,label:"monthly_first"},{value:1,label:"monthly_reset"},{value:2,label:"no_reset"},{value:3,label:"yearly_first"},{value:4,label:"yearly_reset"}];function ax(){const{isOpen:s,setIsOpen:n,editingPlan:t,setEditingPlan:r,refreshData:a}=vn(),[l,i]=m.useState(!1),{t:c}=V("subscribe"),u=ye({resolver:_e(sx),defaultValues:{...ta,...t||{}},mode:"onChange"});m.useEffect(()=>{t?u.reset({...ta,...t}):u.reset(ta)},[t,u]);const o=new hn({html:!0}),[d,h]=m.useState();async function w(){at.getList().then(({data:C})=>{h(C)})}m.useEffect(()=>{s&&w()},[s]);const P=C=>{if(isNaN(C))return;const N=Object.entries(aa).reduce((p,[S,R])=>{const g=C*R.months*R.discount;return{...p,[S]:g.toFixed(2)}},{});u.setValue("prices",N,{shouldDirty:!0})},k=()=>{n(!1),r(null),u.reset(ta)};return e.jsx(pe,{open:s,onOpenChange:k,children:e.jsxs(ue,{children:[e.jsxs(ve,{children:[e.jsx(ge,{children:c(t?"plan.form.edit_title":"plan.form.add_title")}),e.jsx(Le,{})]}),e.jsxs(we,{...u,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:u.control,name:"name",render:({field:C})=>e.jsxs(f,{children:[e.jsx(j,{children:c("plan.form.name.label")}),e.jsx(b,{children:e.jsx(T,{placeholder:c("plan.form.name.placeholder"),...C})}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"group_id",render:({field:C})=>e.jsxs(f,{children:[e.jsxs(j,{className:"flex items-center justify-between",children:[c("plan.form.group.label"),e.jsx(La,{dialogTrigger:e.jsx(E,{variant:"link",children:c("plan.form.group.add")}),refetch:w})]}),e.jsxs(J,{value:C.value?.toString()??"",onValueChange:N=>C.onChange(N?Number(N):null),children:[e.jsx(b,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:c("plan.form.group.placeholder")})})}),e.jsx(Y,{children:d?.map(N=>e.jsx(A,{value:N.id.toString(),children:N.name},N.id))})]}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"transfer_enable",render:({field:C})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:c("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(T,{type:"number",min:0,placeholder:c("plan.form.transfer.placeholder"),className:"rounded-r-none",...C})}),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:c("plan.form.transfer.unit")})]}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"speed_limit",render:({field:C})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:c("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(T,{type:"number",min:0,placeholder:c("plan.form.speed.placeholder"),className:"rounded-r-none",...C,value:C.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:c("plan.form.speed.unit")})]}),e.jsx(D,{})]})}),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:c("plan.form.price.title")}),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(T,{type:"number",placeholder:c("plan.form.price.base_price"),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:C=>{const N=parseFloat(C.target.value);P(N)}})]}),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const C=Object.keys(aa).reduce((N,p)=>({...N,[p]:""}),{});u.setValue("prices",C,{shouldDirty:!0})},children:c("plan.form.price.clear.button")})}),e.jsx(ce,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:c("plan.form.price.clear.tooltip")})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(aa).filter(([C])=>!["onetime","reset_traffic"].includes(C)).map(([C,N])=>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(v,{control:u.control,name:`prices.${C}`,render:({field:p})=>e.jsxs(f,{children:[e.jsxs(j,{className:"text-xs font-medium text-muted-foreground",children:[c(`plan.columns.price_period.${C}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",N.months===1?c("plan.form.price.period.monthly"):c("plan.form.price.period.months",{count:N.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(T,{type:"number",placeholder:"0.00",min:0,...p,value:p.value??"",onChange:S=>p.onChange(S.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"})})]})]})})},C))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(aa).filter(([C])=>["onetime","reset_traffic"].includes(C)).map(([C,N])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(v,{control:u.control,name:`prices.${C}`,render:({field:p})=>e.jsx(f,{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(j,{className:"text-xs font-medium",children:c(`plan.columns.price_period.${C}`)}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:c(C==="onetime"?"plan.form.price.onetime_desc":"plan.form.price.reset_desc")})]}),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(T,{type:"number",placeholder:"0.00",min:0,...p,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"})})]})]})})})},C))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(v,{control:u.control,name:"device_limit",render:({field:C})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:c("plan.form.device.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(T,{type:"number",min:0,placeholder:c("plan.form.device.placeholder"),className:"rounded-r-none",...C,value:C.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:c("plan.form.device.unit")})]}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"capacity_limit",render:({field:C})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:c("plan.form.capacity.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(T,{type:"number",min:0,placeholder:c("plan.form.capacity.placeholder"),className:"rounded-r-none",...C,value:C.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:c("plan.form.capacity.unit")})]}),e.jsx(D,{})]})})]}),e.jsx(v,{control:u.control,name:"reset_traffic_method",render:({field:C})=>e.jsxs(f,{children:[e.jsx(j,{children:c("plan.form.reset_method.label")}),e.jsxs(J,{value:C.value?.toString()??"null",onValueChange:N=>C.onChange(N=="null"?null:Number(N)),children:[e.jsx(b,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:c("plan.form.reset_method.placeholder")})})}),e.jsx(Y,{children:tx.map(N=>e.jsx(A,{value:N.value?.toString()??"null",children:c(`plan.form.reset_method.options.${N.label}`)},N.value))})]}),e.jsx(F,{className:"text-xs",children:c("plan.form.reset_method.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:u.control,name:"content",render:({field:C})=>{const[N,p]=m.useState(!1);return e.jsxs(f,{className:"space-y-2",children:[e.jsxs(j,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c("plan.form.content.label"),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>p(!N),children:N?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(ce,{side:"top",children:e.jsx("p",{className:"text-xs",children:c(N?"plan.form.content.preview_button.hide":"plan.form.content.preview_button.show")})})]})})]}),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{variant:"outline",size:"sm",onClick:()=>{C.onChange(c("plan.form.content.template.content"))},children:c("plan.form.content.template.button")})}),e.jsx(ce,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:c("plan.form.content.template.tooltip")})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${N?"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(pn,{style:{height:"400px"},value:C.value||"",renderHTML:S=>o.render(S),onChange:({text:S})=>C.onChange(S),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:c("plan.form.content.placeholder"),className:"rounded-md border"})})}),N&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:c("plan.form.content.preview")}),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:o.render(C.value||"")}})})]})]}),e.jsx(F,{className:"text-xs",children:c("plan.form.content.description")}),e.jsx(D,{})]})}})]}),e.jsx(Pe,{className:"mt-6",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("div",{className:"flex-shrink-0",children:t&&e.jsx(v,{control:u.control,name:"force_update",render:({field:C})=>e.jsxs(f,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(b,{children:e.jsx(bn,{checked:C.value,onCheckedChange:C.onChange})}),e.jsx("div",{className:"",children:e.jsx(j,{className:"text-sm",children:c("plan.form.force_update.label")})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(E,{type:"button",variant:"outline",onClick:k,children:c("plan.form.submit.cancel")}),e.jsx(E,{type:"submit",disabled:l,onClick:()=>{u.handleSubmit(async C=>{i(!0),(await Xe.save(C)).data&&($.success(c(t?"plan.form.submit.success.update":"plan.form.submit.success.add")),k(),a()),i(!1)})()},children:c(l?"plan.form.submit.submitting":"plan.form.submit.submit")})]})]})})]})]})})}function nx(){const[s,n]=m.useState({}),[t,r]=m.useState({"drag-handle":!1}),[a,l]=m.useState([]),[i,c]=m.useState([]),[u,o]=m.useState(!1),[d,h]=m.useState({pageSize:20,pageIndex:0}),[w,P]=m.useState([]),{refetch:k}=ne({queryKey:["planList"],queryFn:async()=>{const{data:R}=await Xe.getList();return P(R),R}});m.useEffect(()=>{r({"drag-handle":u}),h({pageSize:u?99999:10,pageIndex:0})},[u]);const C=(R,g)=>{u&&(R.dataTransfer.setData("text/plain",g.toString()),R.currentTarget.classList.add("opacity-50"))},N=(R,g)=>{if(!u)return;R.preventDefault(),R.currentTarget.classList.remove("bg-muted");const _=parseInt(R.dataTransfer.getData("text/plain"));if(_===g)return;const I=[...w],[U]=I.splice(_,1);I.splice(g,0,U),P(I)},p=async()=>{if(!u){o(!0);return}const R=w?.map(g=>g.id);Xe.sort(R).then(()=>{$.success("排序保存成功"),o(!1),k()}).finally(()=>{o(!1)})},S=is({data:w||[],columns:ex(k),state:{sorting:i,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:d},enableRowSelection:!0,onPaginationChange:h,onRowSelectionChange:n,onSortingChange:c,onColumnFiltersChange:l,onColumnVisibilityChange:r,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),getSortedRowModel:js(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Os(),initialState:{columnPinning:{right:["actions"]}},pageCount:u?1:void 0});return e.jsx(Xu,{refreshData:k,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(bs,{table:S,toolbar:R=>e.jsx(Zu,{table:R,refetch:k,saveOrder:p,isSortMode:u}),draggable:u,onDragStart:C,onDragEnd:R=>R.currentTarget.classList.remove("opacity-50"),onDragOver:R=>{R.preventDefault(),R.currentTarget.classList.add("bg-muted")},onDragLeave:R=>R.currentTarget.classList.remove("bg-muted"),onDrop:N,showPagination:!u}),e.jsx(ax,{})]})})}function rx(){const{t:s}=V("subscribe");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("plan.title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("plan.page.description")})]})}),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(nx,{})})]})]})}const lx=Object.freeze(Object.defineProperty({__proto__:null,default:rx},Symbol.toStringTag,{value:"Module"})),pt=[{value:ae.PENDING,label:Et[ae.PENDING],icon:hc,color:Pt[ae.PENDING]},{value:ae.PROCESSING,label:Et[ae.PROCESSING],icon:Kr,color:Pt[ae.PROCESSING]},{value:ae.COMPLETED,label:Et[ae.COMPLETED],icon:tn,color:Pt[ae.COMPLETED]},{value:ae.CANCELLED,label:Et[ae.CANCELLED],icon:Br,color:Pt[ae.CANCELLED]},{value:ae.DISCOUNTED,label:Et[ae.DISCOUNTED],icon:tn,color:Pt[ae.DISCOUNTED]}],It=[{value:je.PENDING,label:Zt[je.PENDING],icon:pc,color:ea[je.PENDING]},{value:je.PROCESSING,label:Zt[je.PROCESSING],icon:Kr,color:ea[je.PROCESSING]},{value:je.VALID,label:Zt[je.VALID],icon:tn,color:ea[je.VALID]},{value:je.INVALID,label:Zt[je.INVALID],icon:Br,color:ea[je.INVALID]}];function na({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=s?.getFilterValue(),l=Array.isArray(a)?new Set(a):a!==void 0?new Set([a]):new Set;return e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(ya,{className:"mr-2 h-4 w-4"}),n,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(G,{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(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):t.filter(i=>l.has(i.value)).map(i=>e.jsx(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),e.jsx(vs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:n}),e.jsxs(Ks,{children:[e.jsx(rt,{children:"No results found."}),e.jsx(ss,{children:t.map(i=>{const c=l.has(i.value);return e.jsxs(Me,{onSelect:()=>{const u=new Set(l);c?u.delete(i.value):u.add(i.value);const o=Array.from(u);s?.setFilterValue(o.length?o:void 0)},children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",c?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(et,{className:y("h-4 w-4")})}),i.icon&&e.jsx(i.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${i.color}`}),e.jsx("span",{children:i.label}),r?.get(i.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(i.value)})]},i.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ct,{}),e.jsx(ss,{children:e.jsx(Me,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const ix=x.object({email:x.string().min(1),plan_id:x.number(),period:x.string(),total_amount:x.number()}),ox={email:"",plan_id:0,total_amount:0,period:""};function El({refetch:s,trigger:n,defaultValues:t}){const{t:r}=V("order"),[a,l]=m.useState(!1),i=ye({resolver:_e(ix),defaultValues:{...ox,...t},mode:"onChange"}),[c,u]=m.useState([]);return m.useEffect(()=>{a&&Xe.getList().then(({data:o})=>{u(o)})},[a]),e.jsxs(pe,{open:a,onOpenChange:l,children:[e.jsx(as,{asChild:!0,children:n||e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Oe,{icon:"ion:add"}),e.jsx("div",{children:r("dialog.addOrder")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:r("dialog.assignOrder")}),e.jsx(Le,{})]}),e.jsxs(we,{...i,children:[e.jsx(v,{control:i.control,name:"email",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dialog.fields.userEmail")}),e.jsx(b,{children:e.jsx(T,{placeholder:r("dialog.placeholders.email"),...o})})]})}),e.jsx(v,{control:i.control,name:"plan_id",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dialog.fields.subscriptionPlan")}),e.jsx(b,{children:e.jsxs(J,{value:o.value?o.value?.toString():void 0,onValueChange:d=>o.onChange(parseInt(d)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dialog.placeholders.plan")})}),e.jsx(Y,{children:c.map(d=>e.jsx(A,{value:d.id.toString(),children:d.name},d.id))})]})})]})}),e.jsx(v,{control:i.control,name:"period",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dialog.fields.orderPeriod")}),e.jsx(b,{children:e.jsxs(J,{value:o.value,onValueChange:o.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dialog.placeholders.period")})}),e.jsx(Y,{children:Object.keys(Pd).map(d=>e.jsx(A,{value:d,children:r(`period.${d}`)},d))})]})})]})}),e.jsx(v,{control:i.control,name:"total_amount",render:({field:o})=>e.jsxs(f,{children:[e.jsx(j,{children:r("dialog.fields.paymentAmount")}),e.jsx(b,{children:e.jsx(T,{type:"number",placeholder:r("dialog.placeholders.amount"),value:o.value/100,onChange:d=>o.onChange(parseFloat(d.currentTarget.value)*100)})}),e.jsx(D,{})]})}),e.jsxs(Pe,{children:[e.jsx(E,{variant:"outline",onClick:()=>l(!1),children:r("dialog.actions.cancel")}),e.jsx(E,{type:"submit",onClick:()=>{i.handleSubmit(o=>{Ys.assign(o).then(({data:d})=>{d&&(s&&s(),i.reset(),l(!1),$.success(r("dialog.messages.addSuccess")))})})()},children:r("dialog.actions.confirm")})]})]})]})]})}function cx({table:s,refetch:n}){const{t}=V("order"),r=s.getState().columnFilters.length>0,a=Object.values(xs).filter(u=>typeof u=="number").map(u=>({label:t(`type.${xs[u]}`),value:u,color:u===xs.NEW?"green-500":u===xs.RENEWAL?"blue-500":u===xs.UPGRADE?"purple-500":"orange-500"})),l=Object.values(Ie).map(u=>({label:t(`period.${u}`),value:u,color:u===Ie.MONTH_PRICE?"slate-500":u===Ie.QUARTER_PRICE?"cyan-500":u===Ie.HALF_YEAR_PRICE?"indigo-500":u===Ie.YEAR_PRICE?"violet-500":u===Ie.TWO_YEAR_PRICE?"fuchsia-500":u===Ie.THREE_YEAR_PRICE?"pink-500":u===Ie.ONETIME_PRICE?"rose-500":"orange-500"})),i=Object.values(ae).filter(u=>typeof u=="number").map(u=>({label:t(`status.${ae[u]}`),value:u,icon:u===ae.PENDING?pt[0].icon:u===ae.PROCESSING?pt[1].icon:u===ae.COMPLETED?pt[2].icon:u===ae.CANCELLED?pt[3].icon:pt[4].icon,color:u===ae.PENDING?"yellow-500":u===ae.PROCESSING?"blue-500":u===ae.COMPLETED?"green-500":u===ae.CANCELLED?"red-500":"green-500"})),c=Object.values(je).filter(u=>typeof u=="number").map(u=>({label:t(`commission.${je[u]}`),value:u,icon:u===je.PENDING?It[0].icon:u===je.PROCESSING?It[1].icon:u===je.VALID?It[2].icon:It[3].icon,color:u===je.PENDING?"yellow-500":u===je.PROCESSING?"blue-500":u===je.VALID?"green-500":"red-500"}));return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(El,{refetch:n}),e.jsx(T,{placeholder:t("search.placeholder"),value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:u=>s.getColumn("trade_no")?.setFilterValue(u.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(na,{column:s.getColumn("type"),title:t("table.columns.type"),options:a}),s.getColumn("period")&&e.jsx(na,{column:s.getColumn("period"),title:t("table.columns.period"),options:l}),s.getColumn("status")&&e.jsx(na,{column:s.getColumn("status"),title:t("table.columns.status"),options:i}),s.getColumn("commission_status")&&e.jsx(na,{column:s.getColumn("commission_status"),title:t("table.columns.commissionStatus"),options:c})]}),r&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[t("actions.reset"),e.jsx(ls,{className:"ml-2 h-4 w-4"})]})]})}function ds({label:s,value:n,className:t,valueClassName:r}){return e.jsxs("div",{className:y("flex items-center py-1.5",t),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:y("text-sm",r),children:n||"-"})]})}function dx({status:s}){const{t:n}=V("order"),t={[ae.PENDING]:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",[ae.PROCESSING]:"bg-blue-100 text-blue-800 hover:bg-blue-100",[ae.CANCELLED]:"bg-red-100 text-red-800 hover:bg-red-100",[ae.COMPLETED]:"bg-green-100 text-green-800 hover:bg-green-100",[ae.DISCOUNTED]:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(G,{variant:"secondary",className:y("font-medium",t[s]),children:n(`status.${ae[s]}`)})}function mx({id:s,trigger:n}){const[t,r]=m.useState(!1),[a,l]=m.useState(),{t:i}=V("order");return m.useEffect(()=>{(async()=>{if(t){const{data:u}=await Ys.getInfo({id:s});l(u)}})()},[t,s]),e.jsxs(pe,{onOpenChange:r,open:t,children:[e.jsx(as,{asChild:!0,children:n}),e.jsxs(ue,{className:"max-w-xl",children:[e.jsxs(ve,{className:"space-y-2",children:[e.jsx(ge,{className:"text-lg font-medium",children:i("dialog.title")}),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:[i("table.columns.tradeNo"),":",a?.trade_no]}),a?.status&&e.jsx(dx,{status:a.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:i("dialog.basicInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ds,{label:i("dialog.fields.userEmail"),value:a?.user?.email?e.jsxs(st,{to:`/user/manage?email=${a.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[a.user.email,e.jsx(Gr,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(ds,{label:i("dialog.fields.orderPeriod"),value:a&&i(`period.${a.period}`)}),e.jsx(ds,{label:i("dialog.fields.subscriptionPlan"),value:a?.plan?.name,valueClassName:"font-medium"}),e.jsx(ds,{label:i("dialog.fields.callbackNo"),value:a?.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:i("dialog.amountInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ds,{label:i("dialog.fields.paymentAmount"),value:Ws(a?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(ke,{className:"my-2"}),e.jsx(ds,{label:i("dialog.fields.balancePayment"),value:Ws(a?.balance_amount||0)}),e.jsx(ds,{label:i("dialog.fields.discountAmount"),value:Ws(a?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(ds,{label:i("dialog.fields.refundAmount"),value:Ws(a?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(ds,{label:i("dialog.fields.deductionAmount"),value:Ws(a?.surplus_amount||0)})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:i("dialog.timeInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ds,{label:i("dialog.fields.createdAt"),value:Ce(a?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(ds,{label:i("dialog.fields.updatedAt"),value:Ce(a?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const ux={[xs.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[xs.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[xs.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[xs.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},xx={[Ie.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},hx=s=>ae[s],px=s=>je[s],gx=s=>xs[s],fx=s=>{const{t:n}=V("order");return[{accessorKey:"trade_no",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.tradeNo")}),cell:({row:t})=>{const r=t.original.trade_no,a=r.length>6?`${r.slice(0,3)}...${r.slice(-3)}`:r;return e.jsx("div",{className:"flex items-center",children:e.jsx(mx,{trigger:e.jsxs(B,{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:a}),e.jsx(Gr,{className:"h-3.5 w-3.5 opacity-70"})]}),id:t.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.type")}),cell:({row:t})=>{const r=t.getValue("type"),a=ux[r];return e.jsx(G,{variant:"secondary",className:y("font-medium transition-colors text-nowrap",a.color,a.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:n(`type.${gx(r)}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.plan")}),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(z,{column:t,title:n("table.columns.period")}),cell:({row:t})=>{const r=t.getValue("period"),a=xx[r];return e.jsx(G,{variant:"secondary",className:y("font-medium transition-colors text-nowrap",a?.color,a?.bgColor,"hover:bg-opacity-80"),children:n(`period.${r}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.amount")}),cell:({row:t})=>{const r=t.getValue("total_amount"),a=typeof r=="number"?(r/100).toFixed(2):"N/A";return e.jsxs("div",{className:"flex items-center font-mono text-foreground/90",children:["¥",a]})},enableSorting:!0,enableHiding:!1},{accessorKey:"status",header:({column:t})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(z,{column:t,title:n("table.columns.status")}),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx(Nl,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(ce,{side:"top",className:"max-w-[200px] text-sm",children:n("status.tooltip")})]})})]}),cell:({row:t})=>{const r=pt.find(a=>a.value===t.getValue("status"));return r?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r.icon&&e.jsx(r.icon,{className:`h-4 w-4 text-${r.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n(`status.${hx(r.value)}`)})]}),r.value===ae.PENDING&&e.jsxs(Is,{modal:!0,children:[e.jsx(Ls,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(da,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(Ss,{align:"end",className:"w-[140px]",children:[e.jsx(Ne,{className:"cursor-pointer",onClick:async()=>{await Ys.markPaid({trade_no:t.original.trade_no}),s()},children:n("actions.markAsPaid")}),e.jsx(Ne,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ys.makeCancel({trade_no:t.original.trade_no}),s()},children:n("actions.cancel")})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.commission")}),cell:({row:t})=>{const r=t.getValue("commission_balance"),a=r?(r/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:r?`¥${a}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.commissionStatus")}),cell:({row:t})=>{const r=t.original.status,a=t.original.commission_balance,l=It.find(i=>i.value===t.getValue("commission_status"));return a==0||!l?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:[l.icon&&e.jsx(l.icon,{className:`h-4 w-4 text-${l.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n(`commission.${px(l.value)}`)})]}),l.value===je.PENDING&&r===ae.COMPLETED&&e.jsxs(Is,{modal:!0,children:[e.jsx(Ls,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(da,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(Ss,{align:"end",className:"w-[120px]",children:[e.jsx(Ne,{className:"cursor-pointer",onClick:async()=>{await Ys.update({trade_no:t.original.trade_no,commission_status:je.PROCESSING}),s()},children:n("commission.PROCESSING")}),e.jsx(Ne,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ys.update({trade_no:t.original.trade_no,commission_status:je.INVALID}),s()},children:n("commission.INVALID")})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.createdAt")}),cell:({row:t})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:Ce(t.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}]};function jx(){const[s]=Wr(),[n,t]=m.useState({}),[r,a]=m.useState({}),[l,i]=m.useState([]),[c,u]=m.useState([]),[o,d]=m.useState({pageIndex:0,pageSize:20});m.useEffect(()=>{const N=Object.entries({user_id:"string",order_id:"string",commission_status:"number",status:"number",commission_balance:"string"}).map(([p,S])=>{const R=s.get(p);return R?{id:p,value:S==="number"?parseInt(R):R}:null}).filter(Boolean);N.length>0&&i(N)},[s]);const{refetch:h,data:w,isLoading:P}=ne({queryKey:["orderList",o,l,c],queryFn:()=>Ys.getList({pageSize:o.pageSize,current:o.pageIndex+1,filter:l,sort:c})}),k=is({data:w?.data??[],columns:fx(h),state:{sorting:c,columnVisibility:r,rowSelection:n,columnFilters:l,pagination:o},rowCount:w?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:u,onColumnFiltersChange:i,onColumnVisibilityChange:a,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),onPaginationChange:d,getSortedRowModel:js(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Os(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(bs,{table:k,toolbar:e.jsx(cx,{table:k,refetch:h}),showPagination:!0})}function vx(){const{t:s}=V("order");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),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(jx,{})})]})]})}const bx=Object.freeze(Object.defineProperty({__proto__:null,default:vx},Symbol.toStringTag,{value:"Module"}));function yx({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=new Set(s?.getFilterValue());return e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(ya,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(G,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:a.size>2?e.jsxs(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):t.filter(l=>a.has(l.value)).map(l=>e.jsx(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:l.label},l.value))})]})]})}),e.jsx(vs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:n}),e.jsxs(Ks,{children:[e.jsx(rt,{children:"No results found."}),e.jsx(ss,{children:t.map(l=>{const i=a.has(l.value);return e.jsxs(Me,{onSelect:()=>{i?a.delete(l.value):a.add(l.value);const c=Array.from(a);s?.setFilterValue(c.length?c:void 0)},children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",i?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(et,{className:y("h-4 w-4")})}),l.icon&&e.jsx(l.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${l.color}`}),e.jsx("span",{children:l.label}),r?.get(l.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(l.value)})]},l.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ct,{}),e.jsx(ss,{children:e.jsx(Me,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Nx=x.object({id:x.coerce.number().nullable().optional(),name:x.string().min(1,"请输入优惠券名称"),code:x.string().nullable(),type:x.coerce.number(),value:x.coerce.number(),started_at:x.coerce.number(),ended_at:x.coerce.number(),limit_use:x.union([x.string(),x.number()]).nullable(),limit_use_with_user:x.union([x.string(),x.number()]).nullable(),generate_count:x.coerce.number().nullable().optional(),limit_plan_ids:x.array(x.coerce.number()).default([]).nullable(),limit_period:x.array(x.nativeEnum(Ot)).default([]).nullable()}).refine(s=>s.ended_at>s.started_at,{message:"结束时间必须晚于开始时间",path:["ended_at"]}),Bn={name:"",code:null,type:Qe.AMOUNT,value:0,started_at:Math.floor(Date.now()/1e3),ended_at:Math.floor(Date.now()/1e3)+7*24*60*60,limit_use:null,limit_use_with_user:null,limit_plan_ids:[],limit_period:[],generate_count:null};function Pl({defaultValues:s,refetch:n,type:t="create",dialogTrigger:r=null,open:a,onOpenChange:l}){const{t:i}=V("coupon"),[c,u]=m.useState(!1),o=a??c,d=l??u,[h,w]=m.useState([]),P=ye({resolver:_e(Nx),defaultValues:s||Bn});m.useEffect(()=>{s&&P.reset(s)},[s,P]),m.useEffect(()=>{Xe.getList().then(({data:p})=>w(p))},[]);const k=p=>{if(!p)return;const S=(R,g)=>{const _=new Date(g*1e3);return R.setHours(_.getHours(),_.getMinutes(),_.getSeconds()),Math.floor(R.getTime()/1e3)};p.from&&P.setValue("started_at",S(p.from,P.watch("started_at"))),p.to&&P.setValue("ended_at",S(p.to,P.watch("ended_at")))},C=async p=>{const S=await ha.save(p);if(p.generate_count&&S){const R=new Blob([S],{type:"text/csv;charset=utf-8;"}),g=document.createElement("a");g.href=window.URL.createObjectURL(R),g.download=`coupons_${new Date().getTime()}.csv`,g.click(),window.URL.revokeObjectURL(g.href)}d(!1),t==="create"&&P.reset(Bn),n()},N=(p,S)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:S}),e.jsx(T,{type:"datetime-local",step:"1",value:Ce(P.watch(p),"YYYY-MM-DDTHH:mm:ss"),onChange:R=>{const g=new Date(R.target.value);P.setValue(p,Math.floor(g.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(pe,{open:o,onOpenChange:d,children:[r&&e.jsx(as,{asChild:!0,children:r}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsx(ve,{children:e.jsx(ge,{children:i(t==="create"?"form.add":"form.edit")})}),e.jsx(we,{...P,children:e.jsxs("form",{onSubmit:P.handleSubmit(C),className:"space-y-4",children:[e.jsx(v,{control:P.control,name:"name",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:i("form.name.label")}),e.jsx(T,{placeholder:i("form.name.placeholder"),...p}),e.jsx(D,{})]})}),t==="create"&&e.jsx(v,{control:P.control,name:"generate_count",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:i("form.generateCount.label")}),e.jsx(T,{type:"number",min:0,placeholder:i("form.generateCount.placeholder"),...p,value:p.value===void 0?"":p.value,onChange:S=>p.onChange(S.target.value===""?"":parseInt(S.target.value)),className:"h-9"}),e.jsx(F,{className:"text-xs",children:i("form.generateCount.description")}),e.jsx(D,{})]})}),(!P.watch("generate_count")||P.watch("generate_count")==null)&&e.jsx(v,{control:P.control,name:"code",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:i("form.code.label")}),e.jsx(T,{placeholder:i("form.code.placeholder"),...p,className:"h-9"}),e.jsx(F,{className:"text-xs",children:i("form.code.description")}),e.jsx(D,{})]})}),e.jsxs(f,{children:[e.jsx(j,{children:i("form.type.label")}),e.jsxs("div",{className:"flex",children:[e.jsx(v,{control:P.control,name:"type",render:({field:p})=>e.jsxs(J,{value:p.value.toString(),onValueChange:S=>{const R=p.value,g=parseInt(S);p.onChange(g);const _=P.getValues("value");_&&(R===Qe.AMOUNT&&g===Qe.PERCENTAGE?P.setValue("value",_/100):R===Qe.PERCENTAGE&&g===Qe.AMOUNT&&P.setValue("value",_*100))},children:[e.jsx(W,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(Q,{placeholder:i("form.type.placeholder")})}),e.jsx(Y,{children:Object.entries(Rd).map(([S,R])=>e.jsx(A,{value:S,children:i(`table.toolbar.types.${S}`)},S))})]})}),e.jsx(v,{control:P.control,name:"value",render:({field:p})=>{const S=p.value==null?"":P.watch("type")===Qe.AMOUNT&&typeof p.value=="number"?(p.value/100).toString():p.value.toString();return e.jsx(T,{type:"number",placeholder:i("form.value.placeholder"),...p,value:S,onChange:R=>{const g=R.target.value;if(g===""){p.onChange("");return}const _=parseFloat(g);isNaN(_)||p.onChange(P.watch("type")===Qe.AMOUNT?Math.round(_*100):_)},step:"any",min:0,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:P.watch("type")==Qe.AMOUNT?"¥":"%"})})]})]}),e.jsxs(f,{children:[e.jsx(j,{children:i("form.validity.label")}),e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(E,{variant:"outline",className:y("w-full justify-start text-left font-normal",!P.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(Bt,{className:"mr-2 h-4 w-4"}),Ce(P.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ",i("form.validity.to")," ",Ce(P.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(vs,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(lt,{mode:"range",selected:{from:new Date(P.watch("started_at")*1e3),to:new Date(P.watch("ended_at")*1e3)},onSelect:k,numberOfMonths:2})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[N("started_at",i("table.validity.startTime")),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:i("form.validity.to")}),N("ended_at",i("table.validity.endTime"))]})})]})]}),e.jsx(D,{})]}),e.jsx(v,{control:P.control,name:"limit_use",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:i("form.limitUse.label")}),e.jsx(T,{type:"number",min:0,placeholder:i("form.limitUse.placeholder"),...p,value:p.value===null?"":p.value,onChange:S=>p.onChange(S.target.value===""?null:parseInt(S.target.value)),className:"h-9"}),e.jsx(F,{className:"text-xs",children:i("form.limitUse.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:P.control,name:"limit_use_with_user",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:i("form.limitUseWithUser.label")}),e.jsx(T,{type:"number",min:0,placeholder:i("form.limitUseWithUser.placeholder"),...p,value:p.value===null?"":p.value,onChange:S=>p.onChange(S.target.value===""?null:parseInt(S.target.value)),className:"h-9"}),e.jsx(F,{className:"text-xs",children:i("form.limitUseWithUser.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:P.control,name:"limit_period",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:i("form.limitPeriod.label")}),e.jsx(_t,{options:Object.entries(Ot).filter(([S])=>isNaN(Number(S))).map(([S,R])=>({label:i(`coupon:period.${R}`),value:S})),onChange:S=>{if(S.length===0){p.onChange([]);return}const R=S.map(g=>Ot[g.value]);p.onChange(R)},value:(p.value||[]).map(S=>({label:i(`coupon:period.${S}`),value:Object.entries(Ot).find(([R,g])=>g===S)?.[0]||""})),placeholder:i("form.limitPeriod.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:i("form.limitPeriod.empty")})}),e.jsx(F,{className:"text-xs",children:i("form.limitPeriod.description")}),e.jsx(D,{})]})}),e.jsx(v,{control:P.control,name:"limit_plan_ids",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:i("form.limitPlan.label")}),e.jsx(_t,{options:h?.map(S=>({label:S.name,value:S.id.toString()}))||[],onChange:S=>p.onChange(S.map(R=>Number(R.value))),value:(h||[]).filter(S=>(p.value||[]).includes(S.id)).map(S=>({label:S.name,value:S.id.toString()})),placeholder:i("form.limitPlan.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:i("form.limitPlan.empty")})}),e.jsx(D,{})]})}),e.jsx(Pe,{children:e.jsx(E,{type:"submit",disabled:P.formState.isSubmitting,children:P.formState.isSubmitting?i("form.submit.saving"):i("form.submit.save")})})]})})]})]})}function _x({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=V("coupon");return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pl,{refetch:n,dialogTrigger:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Oe,{icon:"ion:add"}),e.jsx("div",{children:r("form.add")})]})}),e.jsx(T,{placeholder:r("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:a=>s.getColumn("name")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(yx,{column:s.getColumn("type"),title:r("table.toolbar.type"),options:[{value:Qe.AMOUNT,label:r(`table.toolbar.types.${Qe.AMOUNT}`)},{value:Qe.PERCENTAGE,label:r(`table.toolbar.types.${Qe.PERCENTAGE}`)}]}),t&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("table.toolbar.reset"),e.jsx(ls,{className:"ml-2 h-4 w-4"})]})]})}const Rl=m.createContext(void 0);function wx({children:s,refetch:n}){const[t,r]=m.useState(!1),[a,l]=m.useState(null),i=u=>{l(u),r(!0)},c=()=>{r(!1),l(null)};return e.jsxs(Rl.Provider,{value:{isOpen:t,currentCoupon:a,openEdit:i,closeEdit:c},children:[s,a&&e.jsx(Pl,{defaultValues:a,refetch:n,type:"edit",open:t,onOpenChange:r})]})}function Cx(){const s=m.useContext(Rl);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const Sx=s=>{const{t:n}=V("coupon");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.id")}),cell:({row:t})=>e.jsx(G,{children:t.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.show")}),cell:({row:t})=>e.jsx(Z,{defaultChecked:t.original.show,onCheckedChange:r=>{ha.update({id:t.original.id,show:r}).then(({data:a})=>!a&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.name")}),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(z,{column:t,title:n("table.columns.type")}),cell:({row:t})=>e.jsx(G,{variant:"outline",children:n(`table.toolbar.types.${t.original.type}`)}),enableSorting:!0},{accessorKey:"code",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.code")}),cell:({row:t})=>e.jsx(G,{variant:"secondary",children:t.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.limitUse")}),cell:({row:t})=>e.jsx(G,{variant:"outline",children:t.original.limit_use===null?n("table.validity.unlimited"):t.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.limitUseWithUser")}),cell:({row:t})=>e.jsx(G,{variant:"outline",children:t.original.limit_use_with_user===null?n("table.validity.noLimit"):t.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.validity")}),cell:({row:t})=>{const[r,a]=m.useState(!1),l=Date.now(),i=t.original.started_at*1e3,c=t.original.ended_at*1e3,u=l>c,o=le.jsx(z,{className:"justify-end",column:t,title:n("table.columns.actions")}),cell:({row:t})=>{const{openEdit:r}=Cx();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>r(t.original),children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),e.jsx(ts,{title:n("table.actions.deleteConfirm.title"),description:n("table.actions.deleteConfirm.description"),confirmText:n("table.actions.deleteConfirm.confirmText"),variant:"destructive",onConfirm:async()=>{ha.drop({id:t.original.id}).then(({data:a})=>{a&&($.success("删除成功"),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ps,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("table.actions.delete")})]})})]})}}]};function kx(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,l]=m.useState([]),[i,c]=m.useState([]),[u,o]=m.useState({pageIndex:0,pageSize:20}),{refetch:d,data:h}=ne({queryKey:["couponList",u,a,i],queryFn:()=>ha.getList({pageSize:u.pageSize,current:u.pageIndex+1,filter:a,sort:i})}),w=is({data:h?.data??[],columns:Sx(d),state:{sorting:i,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:u},pageCount:Math.ceil((h?.total??0)/u.pageSize),rowCount:h?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:c,onColumnFiltersChange:l,onColumnVisibilityChange:r,onPaginationChange:o,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),getSortedRowModel:js(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Os(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(wx,{refetch:d,children:e.jsx("div",{className:"space-y-4",children:e.jsx(bs,{table:w,toolbar:e.jsx(_x,{table:w,refetch:d})})})})}function Tx(){const{t:s}=V("coupon");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),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 Dx=Object.freeze(Object.defineProperty({__proto__:null,default:Tx},Symbol.toStringTag,{value:"Module"})),Ex=1,Px=1e6;let Ga=0;function Rx(){return Ga=(Ga+1)%Number.MAX_SAFE_INTEGER,Ga.toString()}const Wa=new Map,Gn=s=>{if(Wa.has(s))return;const n=setTimeout(()=>{Wa.delete(s),Mt({type:"REMOVE_TOAST",toastId:s})},Px);Wa.set(s,n)},Ix=(s,n)=>{switch(n.type){case"ADD_TOAST":return{...s,toasts:[n.toast,...s.toasts].slice(0,Ex)};case"UPDATE_TOAST":return{...s,toasts:s.toasts.map(t=>t.id===n.toast.id?{...t,...n.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=n;return t?Gn(t):s.toasts.forEach(r=>{Gn(r.id)}),{...s,toasts:s.toasts.map(r=>r.id===t||t===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return n.toastId===void 0?{...s,toasts:[]}:{...s,toasts:s.toasts.filter(t=>t.id!==n.toastId)}}},la=[];let ia={toasts:[]};function Mt(s){ia=Ix(ia,s),la.forEach(n=>{n(ia)})}function Lx({...s}){const n=Rx(),t=a=>Mt({type:"UPDATE_TOAST",toast:{...a,id:n}}),r=()=>Mt({type:"DISMISS_TOAST",toastId:n});return Mt({type:"ADD_TOAST",toast:{...s,id:n,open:!0,onOpenChange:a=>{a||r()}}}),{id:n,dismiss:r,update:t}}function Il(){const[s,n]=m.useState(ia);return m.useEffect(()=>(la.push(n),()=>{const t=la.indexOf(n);t>-1&&la.splice(t,1)}),[s]),{...s,toast:Lx,dismiss:t=>Mt({type:"DISMISS_TOAST",toastId:t})}}function Vx({open:s,onOpenChange:n,table:t}){const{t:r}=V("user"),{toast:a}=Il(),[l,i]=m.useState(!1),[c,u]=m.useState(""),[o,d]=m.useState(""),h=async()=>{if(!c||!o){a({title:r("messages.error"),description:r("messages.send_mail.required_fields"),variant:"destructive"});return}try{i(!0),await Cs.sendMail({subject:c,content:o,filter:t.getState().columnFilters,sort:t.getState().sorting[0]?.id,sort_type:t.getState().sorting[0]?.desc?"DESC":"ASC"}),a({title:r("messages.success"),description:r("messages.send_mail.success")}),n(!1),u(""),d("")}catch{a({title:r("messages.error"),description:r("messages.send_mail.failed"),variant:"destructive"})}finally{i(!1)}};return e.jsx(pe,{open:s,onOpenChange:n,children:e.jsxs(ue,{className:"sm:max-w-[500px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:r("send_mail.title")}),e.jsx(Le,{children:r("send_mail.description")})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"subject",className:"text-right",children:r("send_mail.subject")}),e.jsx(T,{id:"subject",value:c,onChange:w=>u(w.target.value),className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"content",className:"text-right",children:r("send_mail.content")}),e.jsx(Ds,{id:"content",value:o,onChange:w=>d(w.target.value),className:"col-span-3",rows:6})]})]}),e.jsx(Pe,{children:e.jsx(B,{type:"submit",onClick:h,disabled:l,children:r(l?"send_mail.sending":"send_mail.send")})})]})})}const Fx=x.object({email_prefix:x.string().optional(),email_suffix:x.string().min(1),password:x.string().optional(),expired_at:x.number().optional().nullable(),plan_id:x.number().nullable(),generate_count:x.number().optional().nullable(),download_csv:x.boolean().optional()}).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"]}),Ox={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0,download_csv:!1};function Mx({refetch:s}){const{t:n}=V("user"),[t,r]=m.useState(!1),a=ye({resolver:_e(Fx),defaultValues:Ox,mode:"onChange"}),[l,i]=m.useState([]);return m.useEffect(()=>{t&&Xe.getList().then(({data:c})=>{c&&i(c)})},[t]),e.jsxs(pe,{open:t,onOpenChange:r,children:[e.jsx(as,{asChild:!0,children:e.jsxs(B,{size:"sm",variant:"outline",className:"gap-0 space-x-2",children:[e.jsx(Oe,{icon:"ion:add"}),e.jsx("div",{children:n("generate.button")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:n("generate.title")}),e.jsx(Le,{})]}),e.jsxs(we,{...a,children:[e.jsxs(f,{children:[e.jsx(j,{children:n("generate.form.email")}),e.jsxs("div",{className:"flex",children:[!a.watch("generate_count")&&e.jsx(v,{control:a.control,name:"email_prefix",render:({field:c})=>e.jsx(T,{className:"flex-[5] rounded-r-none",placeholder:n("generate.form.email_prefix"),...c})}),e.jsx("div",{className:`z-[-1] border border-r-0 border-input px-3 py-1 shadow-sm ${a.watch("generate_count")?"rounded-l-md":"border-l-0"}`,children:"@"}),e.jsx(v,{control:a.control,name:"email_suffix",render:({field:c})=>e.jsx(T,{className:"flex-[4] rounded-l-none",placeholder:n("generate.form.email_domain"),...c})})]})]}),e.jsx(v,{control:a.control,name:"password",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:n("generate.form.password")}),e.jsx(T,{placeholder:n("generate.form.password_placeholder"),...c}),e.jsx(D,{})]})}),e.jsx(v,{control:a.control,name:"expired_at",render:({field:c})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(j,{children:n("generate.form.expire_time")}),e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsx(b,{children:e.jsxs(B,{variant:"outline",className:y("w-full pl-3 text-left font-normal",!c.value&&"text-muted-foreground"),children:[c.value?Ce(c.value):e.jsx("span",{children:n("generate.form.expire_time_placeholder")}),e.jsx(Bt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(vs,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(fc,{asChild:!0,children:e.jsx(B,{variant:"outline",className:"w-full",onClick:()=>{c.onChange(null)},children:n("generate.form.permanent")})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(lt,{mode:"single",selected:c.value?new Date(c.value*1e3):void 0,onSelect:u=>{u&&c.onChange(u?.getTime()/1e3)}})})]})]})]})}),e.jsx(v,{control:a.control,name:"plan_id",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:n("generate.form.subscription")}),e.jsx(b,{children:e.jsxs(J,{value:c.value?c.value.toString():"null",onValueChange:u=>c.onChange(u==="null"?null:parseInt(u)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:n("generate.form.subscription_none")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"null",children:n("generate.form.subscription_none")}),l.map(u=>e.jsx(A,{value:u.id.toString(),children:u.name},u.id))]})]})})]})}),!a.watch("email_prefix")&&e.jsx(v,{control:a.control,name:"generate_count",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:n("generate.form.generate_count")}),e.jsx(T,{type:"number",placeholder:n("generate.form.generate_count_placeholder"),value:c.value||"",onChange:u=>c.onChange(u.target.value?parseInt(u.target.value):null)})]})}),a.watch("generate_count")&&e.jsx(v,{control:a.control,name:"download_csv",render:({field:c})=>e.jsxs(f,{className:"flex cursor-pointer flex-row items-center space-x-2 space-y-0",children:[e.jsx(b,{children:e.jsx(bn,{checked:c.value,onCheckedChange:c.onChange})}),e.jsx(j,{children:n("generate.form.download_csv")})]})})]}),e.jsxs(Pe,{children:[e.jsx(B,{variant:"outline",onClick:()=>r(!1),children:n("generate.form.cancel")}),e.jsx(B,{onClick:()=>a.handleSubmit(async c=>{if(c.download_csv){const u=await Cs.generate(c);if(u&&u instanceof Blob){const o=window.URL.createObjectURL(u),d=document.createElement("a");d.href=o,d.download=`users_${new Date().getTime()}.csv`,document.body.appendChild(d),d.click(),d.remove(),window.URL.revokeObjectURL(o),$.success(n("generate.form.success")),a.reset(),s(),r(!1)}}else{const{data:u}=await Cs.generate(c);u&&($.success(n("generate.form.success")),a.reset(),s(),r(!1))}})(),children:n("generate.form.submit")})]})]})]})}const Ll=sr,zx=tr,Ax=ar,Vl=m.forwardRef(({className:s,...n},t)=>e.jsx(ga,{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),...n,ref:t}));Vl.displayName=ga.displayName;const $x=Zs("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"}}),yn=m.forwardRef(({side:s="right",className:n,children:t,...r},a)=>e.jsxs(Ax,{children:[e.jsx(Vl,{}),e.jsxs(fa,{ref:a,className:y($x({side:s}),n),...r,children:[e.jsxs(cn,{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(ls,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),t]})]}));yn.displayName=fa.displayName;const Nn=({className:s,...n})=>e.jsx("div",{className:y("flex flex-col space-y-2 text-center sm:text-left",s),...n});Nn.displayName="SheetHeader";const Fl=({className:s,...n})=>e.jsx("div",{className:y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Fl.displayName="SheetFooter";const _n=m.forwardRef(({className:s,...n},t)=>e.jsx(ja,{ref:t,className:y("text-lg font-semibold text-foreground",s),...n}));_n.displayName=ja.displayName;const wn=m.forwardRef(({className:s,...n},t)=>e.jsx(va,{ref:t,className:y("text-sm text-muted-foreground",s),...n}));wn.displayName=va.displayName;function qx({table:s,refetch:n,permissionGroups:t=[],subscriptionPlans:r=[]}){const{t:a}=V("user"),{toast:l}=Il(),i=s.getState().columnFilters.length>0,[c,u]=m.useState([]),[o,d]=m.useState(!1),[h,w]=m.useState(!1),[P,k]=m.useState(!1),[C,N]=m.useState(!1),p=async()=>{try{const H=await Cs.dumpCSV({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),te=H;console.log(H);const q=new Blob([te],{type:"text/csv;charset=utf-8;"}),L=window.URL.createObjectURL(q),ee=document.createElement("a");ee.href=L,ee.setAttribute("download",`users_${new Date().toISOString()}.csv`),document.body.appendChild(ee),ee.click(),ee.remove(),window.URL.revokeObjectURL(L),l({title:a("messages.success"),description:a("messages.export.success")})}catch{l({title:a("messages.error"),description:a("messages.export.failed"),variant:"destructive"})}},S=async()=>{try{N(!0),await Cs.batchBan({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),l({title:a("messages.success"),description:a("messages.batch_ban.success")}),n()}catch{l({title:a("messages.error"),description:a("messages.batch_ban.failed"),variant:"destructive"})}finally{N(!1),k(!1)}},R=[{label:a("filter.fields.email"),value:"email",type:"text",operators:[{label:a("filter.operators.contains"),value:"contains"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.id"),value:"id",type:"number",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.plan_id"),value:"plan_id",type:"select",operators:[{label:a("filter.operators.eq"),value:"eq"}],useOptions:!0},{label:a("filter.fields.transfer_enable"),value:"transfer_enable",type:"number",unit:"GB",operators:[{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.lt"),value:"lt"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.total_used"),value:"total_used",type:"number",unit:"GB",operators:[{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.lt"),value:"lt"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.online_count"),value:"online_count",type:"number",operators:[{label:a("filter.operators.eq"),value:"eq"},{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.lt"),value:"lt"}]},{label:a("filter.fields.expired_at"),value:"expired_at",type:"date",operators:[{label:a("filter.operators.lt"),value:"lt"},{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.uuid"),value:"uuid",type:"text",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.token"),value:"token",type:"text",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.banned"),value:"banned",type:"select",operators:[{label:a("filter.operators.eq"),value:"eq"}],options:[{label:a("filter.status.normal"),value:"0"},{label:a("filter.status.banned"),value:"1"}]},{label:a("filter.fields.remark"),value:"remarks",type:"text",operators:[{label:a("filter.operators.contains"),value:"contains"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.inviter_email"),value:"invite_user.email",type:"text",operators:[{label:a("filter.operators.contains"),value:"contains"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.invite_user_id"),value:"invite_user_id",type:"number",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.is_admin"),value:"is_admin",type:"boolean",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.is_staff"),value:"is_staff",type:"boolean",operators:[{label:a("filter.operators.eq"),value:"eq"}]}],g=H=>H*1024*1024*1024,_=H=>H/(1024*1024*1024),I=()=>{u([...c,{field:"",operator:"",value:""}])},U=H=>{u(c.filter((te,q)=>q!==H))},M=(H,te,q)=>{const L=[...c];if(L[H]={...L[H],[te]:q},te==="field"){const ee=R.find(cs=>cs.value===q);ee&&(L[H].operator=ee.operators[0].value,L[H].value=ee.type==="boolean"?!1:"")}u(L)},X=(H,te)=>{const q=R.find(L=>L.value===H.field);if(!q)return null;switch(q.type){case"text":return e.jsx(T,{placeholder:a("filter.sheet.value"),value:H.value,onChange:L=>M(te,"value",L.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(T,{type:"number",placeholder:a("filter.sheet.value_number",{unit:q.unit}),value:q.unit==="GB"?_(H.value||0):H.value,onChange:L=>{const ee=Number(L.target.value);M(te,"value",q.unit==="GB"?g(ee):ee)}}),q.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:q.unit})]});case"date":return e.jsx(lt,{mode:"single",selected:H.value,onSelect:L=>M(te,"value",L),className:"flex flex-1 justify-center rounded-md border"});case"select":return e.jsxs(J,{value:H.value,onValueChange:L=>M(te,"value",L),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("filter.sheet.value")})}),e.jsx(Y,{children:q.useOptions?r.map(L=>e.jsx(A,{value:L.value.toString(),children:L.label},L.value)):q.options?.map(L=>e.jsx(A,{value:L.value.toString(),children:L.label},L.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Z,{checked:H.value,onCheckedChange:L=>M(te,"value",L)}),e.jsx(ma,{children:H.value?a("filter.boolean.true"):a("filter.boolean.false")})]});default:return null}},ie=()=>{const H=c.filter(te=>te.field&&te.operator&&te.value!=="").map(te=>{const q=R.find(ee=>ee.value===te.field);let L=te.value;return te.operator==="contains"?{id:te.field,value:L}:(q?.type==="date"&&L instanceof Date&&(L=Math.floor(L.getTime()/1e3)),q?.type==="boolean"&&(L=L?1:0),{id:te.field,value:`${te.operator}:${L}`})});s.setColumnFilters(H),d(!1)};return e.jsxs("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(Mx,{refetch:n}),e.jsx(T,{placeholder:a("filter.email_search"),value:s.getColumn("email")?.getFilterValue()??"",onChange:H=>s.getColumn("email")?.setFilterValue(H.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(Ll,{open:o,onOpenChange:d,children:[e.jsx(zx,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(jc,{className:"mr-2 h-4 w-4"}),a("filter.advanced"),c.length>0&&e.jsx(G,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:c.length})]})}),e.jsxs(yn,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(Nn,{children:[e.jsx(_n,{children:a("filter.sheet.title")}),e.jsx(wn,{children:a("filter.sheet.description")})]}),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:a("filter.sheet.conditions")}),e.jsx(E,{variant:"outline",size:"sm",onClick:I,children:a("filter.sheet.add")})]}),e.jsx(Nt,{className:"h-[calc(100vh-280px)] ",children:e.jsx("div",{className:"space-y-4",children:c.map((H,te)=>e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(ma,{children:a("filter.sheet.condition",{number:te+1})}),e.jsx(E,{variant:"ghost",size:"sm",onClick:()=>U(te),children:e.jsx(ls,{className:"h-4 w-4"})})]}),e.jsxs(J,{value:H.field,onValueChange:q=>M(te,"field",q),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("filter.sheet.field")})}),e.jsx(Y,{children:e.jsx(Ue,{children:R.map(q=>e.jsx(A,{value:q.value,className:"cursor-pointer",children:q.label},q.value))})})]}),H.field&&e.jsxs(J,{value:H.operator,onValueChange:q=>M(te,"operator",q),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("filter.sheet.operator")})}),e.jsx(Y,{children:R.find(q=>q.value===H.field)?.operators.map(q=>e.jsx(A,{value:q.value,children:q.label},q.value))})]}),H.field&&H.operator&&X(H,te)]},te))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(E,{variant:"outline",onClick:()=>{u([]),d(!1)},children:a("filter.sheet.reset")}),e.jsx(E,{onClick:ie,children:a("filter.sheet.apply")})]})]})]})]}),i&&e.jsxs(E,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),u([])},className:"h-8 px-2 lg:px-3",children:[a("filter.sheet.reset"),e.jsx(ls,{className:"ml-2 h-4 w-4"})]}),e.jsxs(Is,{modal:!1,children:[e.jsx(Ls,{asChild:!0,children:e.jsx(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:a("actions.title")})}),e.jsxs(Ss,{children:[e.jsx(Ne,{onClick:()=>w(!0),children:a("actions.send_email")}),e.jsx(Ne,{onClick:p,children:a("actions.export_csv")}),e.jsx(yt,{}),e.jsx(Ne,{onClick:()=>k(!0),className:"text-red-600 focus:text-red-600",children:a("actions.batch_ban")})]})]})]}),e.jsx(Vx,{open:h,onOpenChange:w,table:s}),e.jsx(fn,{open:P,onOpenChange:k,children:e.jsxs(ka,{children:[e.jsxs(Ta,{children:[e.jsx(Ea,{children:a("actions.confirm_ban.title")}),e.jsx(Pa,{children:a(i?"actions.confirm_ban.filtered_description":"actions.confirm_ban.all_description")})]}),e.jsxs(Da,{children:[e.jsx(Ia,{disabled:C,children:a("actions.confirm_ban.cancel")}),e.jsx(Ra,{onClick:S,disabled:C,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:a(C?"actions.confirm_ban.banning":"actions.confirm_ban.confirm")})]})]})})]})}const Ol=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"})}),Ml=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"})}),Hx=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"})}),Ux=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"})}),Ya=[{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:Fc(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ol,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:_s(s.original.u)})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ml,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:_s(s.original.d)})]})},{accessorKey:"server_rate",header:"倍率",cell:({row:s})=>{const n=s.original.server_rate;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(G,{variant:"outline",className:"font-mono",children:[n,"x"]})})}},{id:"total",header:"总计",cell:({row:s})=>{const n=s.original.u+s.original.d;return e.jsx("div",{className:"flex items-center justify-end font-mono text-sm",children:_s(n)})}}];function zl({user_id:s,dialogTrigger:n}){const{t}=V(["traffic"]),[r,a]=m.useState(!1),[l,i]=m.useState({pageIndex:0,pageSize:20}),{data:c,isLoading:u}=ne({queryKey:["userStats",s,l,r],queryFn:()=>r?Cs.getStats({user_id:s,pageSize:l.pageSize,page:l.pageIndex+1}):null}),o=is({data:c?.data??[],columns:Ya,pageCount:Math.ceil((c?.total??0)/l.pageSize),state:{pagination:l},manualPagination:!0,getCoreRowModel:os(),onPaginationChange:i});return e.jsxs(pe,{open:r,onOpenChange:a,children:[e.jsx(as,{asChild:!0,children:n}),e.jsxs(ue,{className:"sm:max-w-[700px]",children:[e.jsx(ve,{children:e.jsx(ge,{children:t("trafficRecord.title")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(qt,{children:[e.jsx(Ht,{children:o.getHeaderGroups().map(d=>e.jsx(Ge,{children:d.headers.map(h=>e.jsx(Je,{className:y("h-10 px-2 text-xs",h.id==="total"&&"text-right"),children:h.isPlaceholder?null:oa(h.column.columnDef.header,h.getContext())},h.id))},d.id))}),e.jsx(Ut,{children:u?Array.from({length:l.pageSize}).map((d,h)=>e.jsx(Ge,{children:Array.from({length:Ya.length}).map((w,P)=>e.jsx(Ee,{className:"p-2",children:e.jsx(oe,{className:"h-6 w-full"})},P))},h)):o.getRowModel().rows?.length?o.getRowModel().rows.map(d=>e.jsx(Ge,{"data-state":d.getIsSelected()&&"selected",className:"h-10",children:d.getVisibleCells().map(h=>e.jsx(Ee,{className:"px-2",children:oa(h.column.columnDef.cell,h.getContext())},h.id))},d.id)):e.jsx(Ge,{children:e.jsx(Ee,{colSpan:Ya.length,className:"h-24 text-center",children:t("trafficRecord.noRecords")})})})]})}),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:t("trafficRecord.perPage")}),e.jsxs(J,{value:`${o.getState().pagination.pageSize}`,onValueChange:d=>{o.setPageSize(Number(d))},children:[e.jsx(W,{className:"h-8 w-[70px]",children:e.jsx(Q,{placeholder:o.getState().pagination.pageSize})}),e.jsx(Y,{side:"top",children:[10,20,30,40,50].map(d=>e.jsx(A,{value:`${d}`,children:d},d))})]}),e.jsx("p",{className:"text-sm font-medium",children:t("trafficRecord.records")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"flex w-[100px] items-center justify-center text-sm",children:t("trafficRecord.page",{current:o.getState().pagination.pageIndex+1,total:o.getPageCount()})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(B,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>o.previousPage(),disabled:!o.getCanPreviousPage()||u,children:e.jsx(Hx,{className:"h-4 w-4"})}),e.jsx(B,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>o.nextPage(),disabled:!o.getCanNextPage()||u,children:e.jsx(Ux,{className:"h-4 w-4"})})]})]})]})]})]})]})}function Kx({onConfirm:s,children:n,title:t="确认操作",description:r="确定要执行此操作吗?",cancelText:a="取消",confirmText:l="确认",variant:i="default",className:c}){return e.jsxs(fn,{children:[e.jsx(bl,{asChild:!0,children:n}),e.jsxs(ka,{className:y("sm:max-w-[425px]",c),children:[e.jsxs(Ta,{children:[e.jsx(Ea,{children:t}),e.jsx(Pa,{children:r})]}),e.jsxs(Da,{children:[e.jsx(Ia,{asChild:!0,children:e.jsx(E,{variant:"outline",children:a})}),e.jsx(Ra,{asChild:!0,children:e.jsx(E,{variant:i,onClick:s,children:l})})]})]})]})}const Bx=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"})}),Gx=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"})}),Wx=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"})}),Yx=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"})}),Jx=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"})}),Qx=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"})}),Xx=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"})}),Zx=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:"M20 6h-4V5a3 3 0 0 0-3-3h-2a3 3 0 0 0-3 3v1H4a1 1 0 0 0 0 2h1v11a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V8h1a1 1 0 0 0 0-2M10 5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1h-4Zm7 14a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V8h10Z"})}),eh=(s,n,t,r)=>{const{t:a}=V("user");return[{accessorKey:"is_admin",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.is_admin")}),enableSorting:!1,enableHiding:!0,filterFn:(l,i,c)=>c.includes(l.getValue(i)),size:0},{accessorKey:"is_staff",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.is_staff")}),enableSorting:!1,enableHiding:!0,filterFn:(l,i,c)=>c.includes(l.getValue(i)),size:0},{accessorKey:"id",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx(G,{variant:"outline",children:l.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.email")}),cell:({row:l})=>{const i=l.original.t||0,c=Date.now()/1e3-i<120,u=Math.floor(Date.now()/1e3-i);let o=c?a("columns.online_status.online"):i===0?a("columns.online_status.never"):a("columns.online_status.last_online",{time:Ce(i)});if(!c&&i!==0){const d=Math.floor(u/60),h=Math.floor(d/60),w=Math.floor(h/24);w>0?o+=` -`+a("columns.online_status.offline_duration.days",{count:w}):h>0?o+=` -`+a("columns.online_status.offline_duration.hours",{count:h}):d>0?o+=` -`+a("columns.online_status.offline_duration.minutes",{count:d}):o+=` -`+a("columns.online_status.offline_duration.seconds",{count:u})}return e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{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",c?"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:l.original.email})]})}),e.jsx(ce,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:o})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.online_count")}),cell:({row:l})=>{const i=l.original.device_limit,c=l.original.online_count||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(G,{variant:"outline",className:y("min-w-[4rem] justify-center",i!==null&&c>=i?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[c," / ",i===null?"∞":i]})})}),e.jsx(ce,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:i===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:i})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.status")}),cell:({row:l})=>{const i=l.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(G,{className:y("min-w-20 justify-center transition-colors",i?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(i?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(l,i,c)=>c.includes(l.getValue(i))},{accessorKey:"plan_id",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.subscription")}),cell:({row:l})=>e.jsx("div",{className:"min-w-[10em] break-all",children:l.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.group")}),cell:({row:l})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(G,{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:l.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.used_traffic")}),cell:({row:l})=>{const i=_s(l.original?.total_used),c=_s(l.original?.transfer_enable),u=l.original?.total_used/l.original?.transfer_enable*100||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{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:i}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:y("h-full rounded-full transition-all",u>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(u,100)}%`}})})]})}),e.jsx(ce,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",c]})})]})})}},{accessorKey:"transfer_enable",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.total_traffic")}),cell:({row:l})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:_s(l.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.expire_time")}),cell:({row:l})=>{const i=l.original.expired_at,c=Date.now()/1e3,u=i!=null&&ie.jsx(z,{column:l,title:a("columns.balance")}),cell:({row:l})=>{const i=gt(l.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:i})]})}},{accessorKey:"commission_balance",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.commission")}),cell:({row:l})=>{const i=gt(l.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:i})]})}},{accessorKey:"created_at",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.register_time")}),cell:({row:l})=>e.jsx("div",{className:"truncate",children:Ce(l.original?.created_at)}),size:1e3},{id:"actions",header:({column:l})=>e.jsx(z,{column:l,className:"justify-end",title:a("columns.actions")}),cell:({row:l,table:i})=>e.jsxs(Is,{modal:!0,children:[e.jsx(Ls,{asChild:!0,children:e.jsx("div",{className:"text-center",children:e.jsx(B,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":a("columns.actions"),children:e.jsx(da,{className:"size-4"})})})}),e.jsxs(Ss,{align:"end",className:"min-w-[40px]",children:[e.jsx(Ne,{onSelect:c=>{c.preventDefault(),t(l.original),r(!0)},className:"p-0",children:e.jsxs(B,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Bx,{className:"mr-2"}),a("columns.actions_menu.edit")]})}),e.jsx(Ne,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(El,{defaultValues:{email:l.original.email},trigger:e.jsxs(B,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Gx,{className:"mr-2 "}),a("columns.actions_menu.assign_order")]})})}),e.jsx(Ne,{onSelect:()=>{ua(l.original.subscribe_url).then(()=>{$.success(a("common:copy.success"))})},className:"p-0",children:e.jsxs(B,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Wx,{className:"mr-2"}),a("columns.actions_menu.copy_url")]})}),e.jsx(Ne,{onSelect:()=>{Cs.resetSecret(l.original.id).then(({data:c})=>{c&&$.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Yx,{className:"mr-2 "}),a("columns.actions_menu.reset_secret")]})}),e.jsx(Ne,{onSelect:()=>{},className:"p-0",children:e.jsxs(st,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=eq:${l.original?.id}`,children:[e.jsx(Jx,{className:"mr-2"}),a("columns.actions_menu.orders")]})}),e.jsx(Ne,{onSelect:()=>{i.setColumnFilters([{id:"invite_user_id",value:"eq:"+l.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Qx,{className:"mr-2 "}),a("columns.actions_menu.invites")]})}),e.jsx(Ne,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(zl,{user_id:l.original?.id,dialogTrigger:e.jsxs(B,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Xx,{className:"mr-2 "}),a("columns.actions_menu.traffic_records")]})})}),e.jsx(Ne,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(Kx,{title:a("columns.actions_menu.delete_confirm_title"),description:a("columns.actions_menu.delete_confirm_description",{email:l.original.email}),cancelText:a("common:cancel"),confirmText:a("common:confirm"),variant:"destructive",onConfirm:async()=>{try{const{data:c}=await Cs.destroy(l.original.id);c&&($.success(a("common:delete.success")),s())}catch{$.error(a("common:delete.failed"))}},children:e.jsxs(B,{variant:"ghost",className:"w-full justify-start px-2 py-1.5 text-destructive hover:text-destructive",children:[e.jsx(Zx,{className:"mr-2"}),a("columns.actions_menu.delete")]})})})]})]})}]},Al=m.createContext(void 0),Cn=()=>{const s=m.useContext(Al);if(!s)throw new Error("useUserEdit must be used within an UserEditProvider");return s},$l=({children:s,refreshData:n})=>{const[t,r]=m.useState(!1),[a,l]=m.useState(null),i={isOpen:t,setIsOpen:r,editingUser:a,setEditingUser:l,refreshData:n};return e.jsx(Al.Provider,{value:i,children:s})},sh=x.object({id:x.number(),email:x.string().email(),invite_user_email:x.string().email().nullable().optional(),password:x.string().optional().nullable(),balance:x.coerce.number(),commission_balance:x.coerce.number(),u:x.number(),d:x.number(),transfer_enable:x.number(),expired_at:x.number().nullable(),plan_id:x.number().nullable(),banned:x.number(),commission_type:x.number(),commission_rate:x.number().nullable(),discount:x.number().nullable(),speed_limit:x.number().nullable(),device_limit:x.number().nullable(),is_admin:x.number(),is_staff:x.number(),remarks:x.string().nullable()});function ql(){const{t:s}=V("user"),{isOpen:n,setIsOpen:t,editingUser:r,refreshData:a}=Cn(),[l,i]=m.useState(!1),[c,u]=m.useState([]),o=ye({resolver:_e(sh),defaultValues:{id:0,email:"",invite_user_email:null,password:null,balance:0,commission_balance:0,u:0,d:0,transfer_enable:0,expired_at:null,plan_id:null,banned:0,commission_type:0,commission_rate:null,discount:null,speed_limit:null,device_limit:null,is_admin:0,is_staff:0,remarks:null}});return m.useEffect(()=>{n&&Xe.getList().then(({data:d})=>{u(d)})},[n]),m.useEffect(()=>{if(r){const d=r.invite_user?.email,{invite_user:h,...w}=r;o.reset({...w,invite_user_email:d||null,password:null})}},[r,o]),e.jsx(Ll,{open:n,onOpenChange:t,children:e.jsxs(yn,{className:"max-w-[90%] space-y-4",children:[e.jsxs(Nn,{children:[e.jsx(_n,{children:s("edit.title")}),e.jsx(wn,{})]}),e.jsxs(we,{...o,children:[e.jsx(v,{control:o.control,name:"email",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.email")}),e.jsx(b,{children:e.jsx(T,{...d,placeholder:s("edit.form.email_placeholder")})}),e.jsx(D,{...d})]})}),e.jsx(v,{control:o.control,name:"invite_user_email",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.inviter_email")}),e.jsx(b,{children:e.jsx(T,{value:d.value||"",onChange:h=>d.onChange(h.target.value?h.target.value:null),placeholder:s("edit.form.inviter_email_placeholder")})}),e.jsx(D,{...d})]})}),e.jsx(v,{control:o.control,name:"password",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.password")}),e.jsx(b,{children:e.jsx(T,{type:"password",value:d.value||"",onChange:d.onChange,placeholder:s("edit.form.password_placeholder")})}),e.jsx(D,{...d})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(v,{control:o.control,name:"balance",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.balance")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:d.value||"",onChange:d.onChange,placeholder:s("edit.form.balance_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(D,{...d})]})}),e.jsx(v,{control:o.control,name:"commission_balance",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_balance")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:d.value||"",onChange:d.onChange,placeholder:s("edit.form.commission_balance_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(D,{...d})]})}),e.jsx(v,{control:o.control,name:"u",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.upload")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{value:d.value/1024/1024/1024||"",onChange:h=>d.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.upload_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(D,{...d})]})}),e.jsx(v,{control:o.control,name:"d",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.download")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:d.value/1024/1024/1024||"",onChange:h=>d.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.download_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(D,{...d})]})})]}),e.jsx(v,{control:o.control,name:"transfer_enable",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.total_traffic")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:d.value/1024/1024/1024||"",onChange:h=>d.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.total_traffic_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(D,{})]})}),e.jsx(v,{control:o.control,name:"expired_at",render:({field:d})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(j,{children:s("edit.form.expire_time")}),e.jsxs(ks,{open:l,onOpenChange:i,children:[e.jsx(Ts,{asChild:!0,children:e.jsx(b,{children:e.jsxs(E,{type:"button",variant:"outline",className:y("w-full pl-3 text-left font-normal",!d.value&&"text-muted-foreground"),onClick:()=>i(!0),children:[d.value?Ce(d.value):e.jsx("span",{children:s("edit.form.expire_time_placeholder")}),e.jsx(Bt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(vs,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:h=>{h.preventDefault()},onEscapeKeyDown:h=>{h.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(E,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{d.onChange(null),i(!1)},children:s("edit.form.expire_time_permanent")}),e.jsx(E,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const h=new Date;h.setMonth(h.getMonth()+1),h.setHours(23,59,59,999),d.onChange(Math.floor(h.getTime()/1e3)),i(!1)},children:s("edit.form.expire_time_1month")}),e.jsx(E,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const h=new Date;h.setMonth(h.getMonth()+3),h.setHours(23,59,59,999),d.onChange(Math.floor(h.getTime()/1e3)),i(!1)},children:s("edit.form.expire_time_3months")})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(lt,{mode:"single",selected:d.value?new Date(d.value*1e3):void 0,onSelect:h=>{if(h){const w=new Date(d.value?d.value*1e3:Date.now());h.setHours(w.getHours(),w.getMinutes(),w.getSeconds()),d.onChange(Math.floor(h.getTime()/1e3))}},disabled:h=>h{const h=new Date;h.setHours(23,59,59,999),d.onChange(Math.floor(h.getTime()/1e3))},className:"h-6 px-2 text-xs",children:s("edit.form.expire_time_today")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"datetime-local",step:"1",value:Ce(d.value,"YYYY-MM-DDTHH:mm:ss"),onChange:h=>{const w=new Date(h.target.value);isNaN(w.getTime())||d.onChange(Math.floor(w.getTime()/1e3))},className:"flex-1"}),e.jsx(E,{type:"button",variant:"outline",onClick:()=>i(!1),children:s("edit.form.expire_time_confirm")})]})]})]})})]}),e.jsx(D,{})]})}),e.jsx(v,{control:o.control,name:"plan_id",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.subscription")}),e.jsx(b,{children:e.jsxs(J,{value:d.value!==null?String(d.value):"null",onValueChange:h=>d.onChange(h==="null"?null:parseInt(h)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"null",children:s("edit.form.subscription_none")}),c.map(h=>e.jsx(A,{value:String(h.id),children:h.name},h.id))]})]})})]})}),e.jsx(v,{control:o.control,name:"banned",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.account_status")}),e.jsx(b,{children:e.jsxs(J,{value:d.value.toString(),onValueChange:h=>d.onChange(parseInt(h)),children:[e.jsx(W,{children:e.jsx(Q,{})}),e.jsxs(Y,{children:[e.jsx(A,{value:"1",children:s("columns.status_text.banned")}),e.jsx(A,{value:"0",children:s("columns.status_text.normal")})]})]})})]})}),e.jsx(v,{control:o.control,name:"commission_type",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_type")}),e.jsx(b,{children:e.jsxs(J,{value:d.value.toString(),onValueChange:h=>d.onChange(parseInt(h)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("edit.form.commission_type_system")}),e.jsx(A,{value:"1",children:s("edit.form.commission_type_cycle")}),e.jsx(A,{value:"2",children:s("edit.form.commission_type_onetime")})]})]})})]})}),e.jsx(v,{control:o.control,name:"commission_rate",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_rate")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:d.value||"",onChange:h=>d.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.commission_rate_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(v,{control:o.control,name:"discount",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.discount")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:d.value||"",onChange:h=>d.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.discount_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(D,{})]})}),e.jsx(v,{control:o.control,name:"speed_limit",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.speed_limit")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:d.value||"",onChange:h=>d.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.speed_limit_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(D,{})]})}),e.jsx(v,{control:o.control,name:"device_limit",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.device_limit")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:d.value||"",onChange:h=>d.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.device_limit_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(D,{})]})}),e.jsx(v,{control:o.control,name:"is_admin",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.is_admin")}),e.jsx("div",{className:"py-2",children:e.jsx(b,{children:e.jsx(Z,{checked:d.value===1,onCheckedChange:h=>d.onChange(h?1:0)})})})]})}),e.jsx(v,{control:o.control,name:"is_staff",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.is_staff")}),e.jsx("div",{className:"py-2",children:e.jsx(b,{children:e.jsx(Z,{checked:d.value===1,onCheckedChange:h=>d.onChange(h?1:0)})})})]})}),e.jsx(v,{control:o.control,name:"remarks",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.remarks")}),e.jsx(b,{children:e.jsx(Ds,{className:"h-24",value:d.value||"",onChange:h=>d.onChange(h.currentTarget.value??null),placeholder:s("edit.form.remarks_placeholder")})}),e.jsx(D,{})]})}),e.jsxs(Fl,{children:[e.jsx(E,{variant:"outline",onClick:()=>t(!1),children:s("edit.form.cancel")}),e.jsx(E,{type:"submit",onClick:()=>{o.handleSubmit(d=>{Cs.update(d).then(({data:h})=>{h&&($.success(s("edit.form.success")),t(!1),a())})})()},children:s("edit.form.submit")})]})]})]})})}function th(){const[s]=Wr(),[n,t]=m.useState({}),[r,a]=m.useState({is_admin:!1,is_staff:!1}),[l,i]=m.useState([]),[c,u]=m.useState([]),[o,d]=m.useState({pageIndex:0,pageSize:20});m.useEffect(()=>{const g=s.get("email");g&&i(_=>_.some(U=>U.id==="email")?_:[..._,{id:"email",value:g}])},[s]);const{refetch:h,data:w,isLoading:P}=ne({queryKey:["userList",o,l,c],queryFn:()=>Cs.getList({pageSize:o.pageSize,current:o.pageIndex+1,filter:l,sort:c})}),[k,C]=m.useState([]),[N,p]=m.useState([]);m.useEffect(()=>{at.getList().then(({data:g})=>{C(g)}),Xe.getList().then(({data:g})=>{p(g)})},[]);const S=k.map(g=>({label:g.name,value:g.id})),R=N.map(g=>({label:g.name,value:g.id}));return e.jsxs($l,{refreshData:h,children:[e.jsx(ah,{data:w?.data??[],rowCount:w?.total??0,sorting:c,setSorting:u,columnVisibility:r,setColumnVisibility:a,rowSelection:n,setRowSelection:t,columnFilters:l,setColumnFilters:i,pagination:o,setPagination:d,refetch:h,serverGroupList:k,permissionGroups:S,subscriptionPlans:R}),e.jsx(ql,{})]})}function ah({data:s,rowCount:n,sorting:t,setSorting:r,columnVisibility:a,setColumnVisibility:l,rowSelection:i,setRowSelection:c,columnFilters:u,setColumnFilters:o,pagination:d,setPagination:h,refetch:w,serverGroupList:P,permissionGroups:k,subscriptionPlans:C}){const{setIsOpen:N,setEditingUser:p}=Cn(),S=is({data:s,columns:eh(w,P,p,N),state:{sorting:t,columnVisibility:a,rowSelection:i,columnFilters:u,pagination:d},rowCount:n,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:c,onSortingChange:r,onColumnFiltersChange:o,onColumnVisibilityChange:l,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),onPaginationChange:h,getSortedRowModel:js(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Os(),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.jsxs("div",{className:"space-y-4",children:[e.jsx(qx,{table:S,refetch:w,serverGroupList:P,permissionGroups:k,subscriptionPlans:C}),e.jsx(bs,{table:S})]})}function nh(){const{t:s}=V("user");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("manage.title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("manage.description")})]})}),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(th,{})})})]})]})}const rh=Object.freeze(Object.defineProperty({__proto__:null,default:nh},Symbol.toStringTag,{value:"Module"}));function lh({column:s,title:n,options:t}){const r=new Set(s?.getFilterValue());return e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(B,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(vc,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(G,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:r.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:r.size>2?e.jsxs(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):t.filter(a=>r.has(a.value)).map(a=>e.jsx(G,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:a.label},`selected-${a.value}`))})]})]})}),e.jsx(vs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:n}),e.jsxs(Ks,{children:[e.jsx(rt,{children:"No results found."}),e.jsx(ss,{children:t.map(a=>{const l=r.has(a.value);return e.jsxs(Me,{onSelect:()=>{l?r.delete(a.value):r.add(a.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",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(bc,{className:y("h-4 w-4")})}),a.icon&&e.jsx(a.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:a.label})]},`option-${a.value}`)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ct,{}),e.jsx(ss,{children:e.jsx(Me,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const 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:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function oh({table:s}){const{t:n}=V("ticket");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(wa,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Be,{value:"0",children:n("status.pending")}),e.jsx(Be,{value:"1",children:n("status.closed")})]})}),s.getColumn("level")&&e.jsx(lh,{column:s.getColumn("level"),title:n("columns.level"),options:[{label:n("level.low"),value:Ae.LOW,icon:ih,color:"gray"},{label:n("level.medium"),value:Ae.MIDDLE,icon:Ol,color:"yellow"},{label:n("level.high"),value:Ae.HIGH,icon:Ml,color:"red"}]})]})})}function ch(){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 dh=Zs("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"}}),Hl=m.forwardRef(({className:s,variant:n,layout:t,children:r,...a},l)=>e.jsx("div",{className:y(dh({variant:n,layout:t,className:s}),"relative group"),ref:l,...a,children:m.Children.map(r,i=>m.isValidElement(i)&&typeof i.type!="string"?m.cloneElement(i,{variant:n,layout:t}):i)}));Hl.displayName="ChatBubble";const mh=Zs("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"}}),Ul=m.forwardRef(({className:s,variant:n,layout:t,isLoading:r=!1,children:a,...l},i)=>e.jsx("div",{className:y(mh({variant:n,layout:t,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:i,...l,children:r?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(ch,{})}):a}));Ul.displayName="ChatBubbleMessage";const uh=m.forwardRef(({variant:s,className:n,children:t,...r},a)=>e.jsx("div",{ref:a,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",n),...r,children:t}));uh.displayName="ChatBubbleActionWrapper";const Kl=m.forwardRef(({className:s,...n},t)=>e.jsx(Ds,{autoComplete:"off",ref:t,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),...n}));Kl.displayName="ChatInput";const Bl=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"})}),Gl=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"})}),Wn=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 12l3.54-3.54a1 1 0 0 0 0-1.41a1 1 0 0 0-1.42 0l-4.24 4.24a1 1 0 0 0 0 1.42L13.41 17a1 1 0 0 0 .71.29a1 1 0 0 0 .71-.29a1 1 0 0 0 0-1.41Z"})}),xh=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.71 20.29L18 16.61A9 9 0 1 0 16.61 18l3.68 3.68a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.39M11 18a7 7 0 1 1 7-7a7 7 0 0 1-7 7"})}),hh=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"})}),ph=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 gh(){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(oe,{className:"h-8 w-3/4"}),e.jsx(oe,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(oe,{className:"h-20 w-2/3"},s))})]})}function fh(){return e.jsx("div",{className:"space-y-4 p-4",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{className:"h-5 w-4/5"}),e.jsx(oe,{className:"h-4 w-2/3"}),e.jsx(oe,{className:"h-3 w-1/2"})]},s))})}function jh({ticket:s,isActive:n,onClick:t}){const{t:r}=V("ticket"),a=l=>{switch(l){case Ae.HIGH:return"bg-red-50 text-red-600 border-red-200";case Ae.MIDDLE:return"bg-yellow-50 text-yellow-600 border-yellow-200";case Ae.LOW:return"bg-green-50 text-green-600 border-green-200";default:return"bg-gray-50 text-gray-600 border-gray-200"}};return e.jsxs("div",{className:y("flex cursor-pointer flex-col border-b p-4 hover:bg-accent/50",n&&"bg-accent"),onClick:t,children:[e.jsxs("div",{className:"flex max-w-[280px] items-center justify-between gap-2",children:[e.jsx("h4",{className:"flex-1 truncate font-medium",children:s.subject}),e.jsx(G,{variant:s.status===Hs.CLOSED?"secondary":"default",className:"shrink-0",children:s.status===Hs.CLOSED?r("status.closed"):r("status.processing")})]}),e.jsx("div",{className:"mt-1 max-w-[280px] truncate text-sm text-muted-foreground",children:s.user?.email}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[e.jsx("time",{className:"text-muted-foreground",children:Ce(s.updated_at)}),e.jsx("div",{className:y("rounded-full border px-2 py-0.5 text-xs font-medium",a(s.level)),children:r(`level.${s.level===Ae.LOW?"low":s.level===Ae.MIDDLE?"medium":"high"}`)})]})]})}function vh({ticketId:s,dialogTrigger:n}){const{t}=V("ticket"),r=Vs(),a=m.useRef(null),l=m.useRef(null),[i,c]=m.useState(!1),[u,o]=m.useState(""),[d,h]=m.useState(!1),[w,P]=m.useState(s),[k,C]=m.useState(""),[N,p]=m.useState(!1),{setIsOpen:S,setEditingUser:R}=Cn(),{data:g,isLoading:_,refetch:I}=ne({queryKey:["tickets",i],queryFn:()=>i?jt.getList({filter:[{id:"status",value:[Hs.OPENING]}]}):Promise.resolve(null),enabled:i}),{data:U,refetch:M,isLoading:X}=ne({queryKey:["ticket",w,i],queryFn:()=>i?jt.getInfo(w):Promise.resolve(null),refetchInterval:i?5e3:!1,retry:3}),ie=U?.data,te=(g?.data||[]).filter(re=>re.subject.toLowerCase().includes(k.toLowerCase())||re.user?.email.toLowerCase().includes(k.toLowerCase())),q=(re="smooth")=>{if(a.current){const{scrollHeight:Es,clientHeight:Ms}=a.current;a.current.scrollTo({top:Es-Ms,behavior:re})}};m.useEffect(()=>{if(!i)return;const re=requestAnimationFrame(()=>{q("instant"),setTimeout(()=>q(),1e3)});return()=>{cancelAnimationFrame(re)}},[i,ie?.messages]);const L=async()=>{const re=u.trim();!re||d||(h(!0),jt.reply({id:w,message:re}).then(()=>{o(""),M(),q(),setTimeout(()=>{l.current?.focus()},0)}).finally(()=>{h(!1)}))},ee=async()=>{jt.close(w).then(()=>{$.success(t("actions.close_success")),M(),I()})},cs=()=>{ie?.user&&r("/finance/order?user_id="+ie.user.id)},Te=ie?.status===Hs.CLOSED;return e.jsxs(pe,{open:i,onOpenChange:c,children:[e.jsx(as,{asChild:!0,children:n??e.jsx(B,{variant:"outline",children:t("actions.view_ticket")})}),e.jsxs(ue,{className:"flex h-[90vh] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(ge,{}),e.jsxs("div",{className:"flex h-full",children:[e.jsx(B,{variant:"ghost",size:"icon",className:"absolute left-2 top-2 z-50 md:hidden",onClick:()=>p(!N),children:e.jsx(Wn,{className:y("h-4 w-4 transition-transform",!N&&"rotate-180")})}),e.jsxs("div",{className:y("absolute inset-y-0 left-0 z-40 flex flex-col border-r bg-background transition-transform duration-200 ease-in-out md:relative",N?"-translate-x-full":"translate-x-0","w-80 md:w-80 md:translate-x-0"),children:[e.jsxs("div",{className:"space-y-4 border-b p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold",children:t("list.title")}),e.jsx(B,{variant:"ghost",size:"icon",className:"hidden h-8 w-8 md:flex",onClick:()=>p(!N),children:e.jsx(Wn,{className:y("h-4 w-4 transition-transform",!N&&"rotate-180")})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(xh,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"}),e.jsx(T,{placeholder:t("list.search_placeholder"),value:k,onChange:re=>C(re.target.value),className:"pl-8"})]})]}),e.jsx(Nt,{className:"flex-1",children:e.jsx("div",{className:"w-full",children:_?e.jsx(fh,{}):te.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-4 text-muted-foreground",children:t(k?"list.no_search_results":"list.no_tickets")}):te.map(re=>e.jsx(jh,{ticket:re,isActive:re.id===w,onClick:()=>{P(re.id),window.innerWidth<768&&p(!0)}},re.id))})})]}),e.jsxs("div",{className:"relative flex flex-1 flex-col",children:[!N&&e.jsx("div",{className:"absolute inset-0 z-30 bg-black/20 md:hidden",onClick:()=>p(!0)}),X?e.jsx(gh,{}):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:ie?.subject}),e.jsx(G,{variant:Te?"secondary":"default",children:t(Te?"status.closed":"status.processing")}),!Te&&e.jsx(ts,{title:t("actions.close_confirm_title"),description:t("actions.close_confirm_description"),confirmText:t("actions.close_confirm_button"),variant:"destructive",onConfirm:ee,children:e.jsxs(B,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(Bl,{className:"h-4 w-4"}),t("actions.close_ticket")]})})]}),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(Kt,{className:"h-4 w-4"}),e.jsx("span",{children:ie?.user?.email})]}),e.jsx(ke,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(Gl,{className:"h-4 w-4"}),e.jsxs("span",{children:[t("detail.created_at")," ",Ce(ie?.created_at)]})]}),e.jsx(ke,{orientation:"vertical",className:"h-4"}),e.jsx(G,{variant:"outline",children:ie?.level!=null&&t(`level.${ie.level===Ae.LOW?"low":ie.level===Ae.MIDDLE?"medium":"high"}`)})]})]}),ie?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(B,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.user_info"),onClick:()=>{R(ie.user),S(!0)},children:e.jsx(Kt,{className:"h-4 w-4"})}),e.jsx(zl,{user_id:ie.user.id,dialogTrigger:e.jsx(B,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.traffic_records"),children:e.jsx(hh,{className:"h-4 w-4"})})}),e.jsx(B,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.order_records"),onClick:cs,children:e.jsx(ph,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:a,className:"h-full space-y-4 overflow-y-auto p-6",children:ie?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t("detail.no_messages")}):ie?.messages?.map(re=>e.jsx(Hl,{variant:re.is_from_admin?"sent":"received",className:re.is_from_admin?"ml-auto":"mr-auto",children:e.jsx(Ul,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:re.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:Ce(re.created_at)})})]})})},re.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(Kl,{ref:l,disabled:Te||d,placeholder:t(Te?"detail.input.closed_placeholder":"detail.input.reply_placeholder"),className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:u,onChange:re=>o(re.target.value),onKeyDown:re=>{re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),L())}}),e.jsx(B,{disabled:Te||d||!u.trim(),onClick:L,children:t(d?"detail.input.sending":"detail.input.send")})]})})]})]})]})]})]})}const bh=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"})}),yh=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"})}),Nh=s=>{const{t:n}=V("ticket");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.id")}),cell:({row:t})=>e.jsx(G,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.subject")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(bh,{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(z,{column:t,title:n("columns.level")}),cell:({row:t})=>{const r=t.getValue("level"),a=r===Ae.LOW?"default":r===Ae.MIDDLE?"secondary":"destructive";return e.jsx(G,{variant:a,className:"whitespace-nowrap",children:n(`level.${r===Ae.LOW?"low":r===Ae.MIDDLE?"medium":"high"}`)})},filterFn:(t,r,a)=>a.includes(t.getValue(r))},{accessorKey:"status",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.status")}),cell:({row:t})=>{const r=t.getValue("status"),a=t.original.reply_status,l=r===Hs.CLOSED?n("status.closed"):n(a===0?"status.replied":"status.pending"),i=r===Hs.CLOSED?"default":a===0?"secondary":"destructive";return e.jsx(G,{variant:i,className:"whitespace-nowrap",children:l})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.updated_at")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(Gl,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:Ce(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:Ce(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>{const r=t.original.status!==Hs.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(vh,{ticketId:t.original.id,dialogTrigger:e.jsx(B,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.view_details"),children:e.jsx(yh,{className:"h-4 w-4"})})}),r&&e.jsx(ts,{title:n("actions.close_confirm_title"),description:n("actions.close_confirm_description"),confirmText:n("actions.close_confirm_button"),variant:"destructive",onConfirm:async()=>{jt.close(t.original.id).then(()=>{$.success(n("actions.close_success")),s()})},children:e.jsx(B,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.close_ticket"),children:e.jsx(Bl,{className:"h-4 w-4"})})})]})}}]};function _h(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,l]=m.useState([{id:"status",value:"0"}]),[i,c]=m.useState([]),[u,o]=m.useState({pageIndex:0,pageSize:20}),{refetch:d,data:h}=ne({queryKey:["orderList",u,a,i],queryFn:()=>jt.getList({pageSize:u.pageSize,current:u.pageIndex+1,filter:a,sort:i})}),w=is({data:h?.data??[],columns:Nh(d),state:{sorting:i,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:u},rowCount:h?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:c,onColumnFiltersChange:l,onColumnVisibilityChange:r,getCoreRowModel:os(),getFilteredRowModel:gs(),getPaginationRowModel:fs(),onPaginationChange:o,getSortedRowModel:js(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Os(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(oh,{table:w,refetch:d}),e.jsx(bs,{table:w,showPagination:!0})]})}function wh(){const{t:s}=V("ticket");return e.jsxs($l,{refreshData:()=>{},children:[e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Ye,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(qe,{}),e.jsx(He,{})]})]}),e.jsxs(ze,{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:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),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(_h,{})})]})]}),e.jsx(ql,{})]})}const Ch=Object.freeze(Object.defineProperty({__proto__:null,default:wh},Symbol.toStringTag,{value:"Module"}));export{Eh as a,Th as c,Dh as g,Ph as r}; +2=400-500,c,500-1000`),...p,value:Array.isArray(p.value)?p.value.join(` +`):"",onChange:w=>{const H=w.target.value.split(` +`).filter(O=>O.trim()!=="");p.onChange(H)}})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:c.control,name:"tls.server_name",render:({field:p})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:l("dynamic_form.anytls.tls.server_name.label","SNI")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dynamic_form.anytls.tls.server_name.placeholder","服务器名称"),...p})})]})}),e.jsx(v,{control:c.control,name:"tls.allow_insecure",render:({field:p})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dynamic_form.anytls.tls.allow_insecure","允许不安全连接")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:p.value,onCheckedChange:p.onChange})})})]})})]})]})})};return e.jsx(be,{children:R[s]?.()})};function Bu(){const{t:s}=V("server"),a=x.object({id:x.number().optional().nullable(),specific_key:x.string().optional().nullable(),code:x.string().optional(),show:x.boolean().optional().nullable(),name:x.string().min(1,s("form.name.error")),rate:x.string().min(1,s("form.rate.error")).refine(I=>!isNaN(parseFloat(I))&&isFinite(Number(I)),{message:s("form.rate.error_numeric")}).refine(I=>parseFloat(I)>=0,{message:s("form.rate.error_gte_zero")}),tags:x.array(x.string()).default([]),excludes:x.array(x.string()).default([]),ips:x.array(x.string()).default([]),group_ids:x.array(x.string()).default([]),host:x.string().min(1,s("form.host.error")),port:x.string().min(1,s("form.port.error")),server_port:x.string().min(1,s("form.server_port.error")),parent_id:x.string().default("0").nullable(),route_ids:x.array(x.string()).default([]),protocol_settings:x.record(x.any()).default({}).nullable()}),t={id:null,specific_key:null,code:"",show:!1,name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null},{isOpen:l,setIsOpen:n,editingServer:o,setEditingServer:r,serverType:c,setServerType:u,refetch:i}=Vr(),[d,h]=m.useState([]),[_,k]=m.useState([]),[S,C]=m.useState([]),N=ye({resolver:_e(a),defaultValues:t,mode:"onChange"});m.useEffect(()=>{g()},[l]),m.useEffect(()=>{o?.type&&o.type!==c&&u(o.type)},[o,c,u]),m.useEffect(()=>{o?o.type===c&&N.reset({...t,...o}):N.reset({...t,protocol_settings:Te[c].schema.parse({})})},[o,N,c]);const g=async()=>{if(!l)return;const[I,H,O]=await Promise.all([at.getList(),Sa.getList(),Js.getList()]);h(I.data?.map(K=>({label:K.name,value:K.id.toString()}))||[]),k(H.data?.map(K=>({label:K.remarks,value:K.id.toString()}))||[]),C(O.data||[])},T=m.useMemo(()=>S?.filter(I=>(I.parent_id===0||I.parent_id===null)&&I.type===c&&I.id!==N.watch("id")),[c,S,N]),R=()=>e.jsxs(Es,{children:[e.jsx(Rs,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ze,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(Cs,{align:"start",children:e.jsx(jd,{children:cs.map(({type:I,label:H})=>e.jsx(Ne,{onClick:()=>{u(I),n(!0)},className:"cursor-pointer",children:e.jsx(B,{variant:"outline",className:"text-white",style:{background:Ge[I]},children:H})},I))})})]}),p=()=>{n(!1),r(null),N.reset(t)},w=async()=>{const I=N.getValues();(await Js.save({...I,type:c})).data&&(p(),A.success(s("form.success")),i())};return e.jsxs(pe,{open:l,onOpenChange:p,children:[R(),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:s(o?"form.edit_node":"form.new_node")}),e.jsx(Le,{})]}),e.jsxs(we,{...N,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:N.control,name:"name",render:({field:I})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:s("form.name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("form.name.placeholder"),...I})}),e.jsx(P,{})]})}),e.jsx(v,{control:N.control,name:"rate",render:({field:I})=>e.jsxs(f,{className:"flex-[1]",children:[e.jsx(j,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(b,{children:e.jsx(D,{type:"number",min:"0",step:"0.1",...I})})}),e.jsx(P,{})]})})]}),e.jsx(v,{control:N.control,name:"code",render:({field:I})=>e.jsxs(f,{children:[e.jsxs(j,{children:[s("form.code.label"),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:s("form.code.optional")})]}),e.jsx(b,{children:e.jsx(D,{placeholder:s("form.code.placeholder"),...I,value:I.value||""})}),e.jsx(P,{})]})}),e.jsx(v,{control:N.control,name:"tags",render:({field:I})=>e.jsxs(f,{children:[e.jsx(j,{children:s("form.tags.label")}),e.jsx(b,{children:e.jsx(Sn,{value:I.value,onChange:I.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(P,{})]})}),e.jsx(v,{control:N.control,name:"group_ids",render:({field:I})=>e.jsxs(f,{children:[e.jsxs(j,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(Va,{dialogTrigger:e.jsx(E,{variant:"link",children:s("form.groups.add")}),refetch:g})]}),e.jsx(b,{children:e.jsx(_t,{options:d,onChange:H=>I.onChange(H.map(O=>O.value)),value:d?.filter(H=>I.value.includes(H.value)),placeholder:s("form.groups.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:s("form.groups.empty")})})}),e.jsx(P,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:N.control,name:"host",render:({field:I})=>e.jsxs(f,{children:[e.jsx(j,{children:s("form.host.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("form.host.placeholder"),...I})}),e.jsx(P,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(v,{control:N.control,name:"port",render:({field:I})=>e.jsxs(f,{className:"flex-1",children:[e.jsxs(j,{className:"flex items-center gap-1.5",children:[s("form.port.label"),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(ze,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(ma,{children:e.jsx(de,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.port.tooltip")})})})]})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(b,{children:e.jsx(D,{placeholder:s("form.port.placeholder"),...I})}),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const H=I.value;H&&N.setValue("server_port",H)},children:e.jsx(ze,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(de,{side:"right",children:e.jsx("p",{children:s("form.port.sync")})})]})})]}),e.jsx(P,{})]})}),e.jsx(v,{control:N.control,name:"server_port",render:({field:I})=>e.jsxs(f,{className:"flex-1",children:[e.jsxs(j,{className:"flex items-center gap-1.5",children:[s("form.server_port.label"),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(ze,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(ma,{children:e.jsx(de,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.server_port.tooltip")})})})]})})]}),e.jsx(b,{children:e.jsx(D,{placeholder:s("form.server_port.placeholder"),...I})}),e.jsx(P,{})]})})]})]}),l&&e.jsx(Ku,{serverType:c,value:N.watch("protocol_settings"),onChange:I=>N.setValue("protocol_settings",I,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(v,{control:N.control,name:"parent_id",render:({field:I})=>e.jsxs(f,{children:[e.jsx(j,{children:s("form.parent.label")}),e.jsxs(X,{onValueChange:I.onChange,value:I.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(Y,{children:e.jsx(Z,{placeholder:s("form.parent.placeholder")})})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:s("form.parent.none")}),T?.map(H=>e.jsx($,{value:H.id.toString(),className:"cursor-pointer",children:H.name},H.id))]})]}),e.jsx(P,{})]})}),e.jsx(v,{control:N.control,name:"route_ids",render:({field:I})=>e.jsxs(f,{children:[e.jsx(j,{children:s("form.route.label")}),e.jsx(b,{children:e.jsx(_t,{options:_,onChange:H=>I.onChange(H.map(O=>O.value)),value:_?.filter(H=>I.value.includes(H.value)),placeholder:s("form.route.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:s("form.route.empty")})})}),e.jsx(P,{})]})})]}),e.jsxs(Re,{className:"mt-6 flex flex-col sm:flex-row gap-2 sm:gap-0",children:[e.jsx(E,{type:"button",variant:"outline",onClick:p,className:"w-full sm:w-auto",children:s("form.cancel")}),e.jsx(E,{type:"submit",onClick:w,className:"w-full sm:w-auto",children:s("form.submit")})]})]})]})]})}function Qn({column:s,title:a,options:t}){const l=s?.getFacetedUniqueValues(),n=new Set(s?.getFilterValue());return e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(_a,{className:"mr-2 h-4 w-4"}),a,n?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(B,{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(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[n.size," selected"]}):t.filter(o=>n.has(o.value)).map(o=>e.jsx(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(bs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:a}),e.jsxs(Ks,{children:[e.jsx(lt,{children:"No results found."}),e.jsx(as,{children:t.map(o=>{const r=n.has(o.value);return e.jsxs($e,{onSelect:()=>{r?n.delete(o.value):n.add(o.value);const c=Array.from(n);s?.setFilterValue(c.length?c: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",r?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(et,{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}),l?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(o.value)})]},o.value)})}),n.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(St,{}),e.jsx(as,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Gu=[{value:re.Shadowsocks,label:cs.find(s=>s.type===re.Shadowsocks)?.label,color:Ge[re.Shadowsocks]},{value:re.Vmess,label:cs.find(s=>s.type===re.Vmess)?.label,color:Ge[re.Vmess]},{value:re.Trojan,label:cs.find(s=>s.type===re.Trojan)?.label,color:Ge[re.Trojan]},{value:re.Hysteria,label:cs.find(s=>s.type===re.Hysteria)?.label,color:Ge[re.Hysteria]},{value:re.Vless,label:cs.find(s=>s.type===re.Vless)?.label,color:Ge[re.Vless]},{value:re.Tuic,label:cs.find(s=>s.type===re.Tuic)?.label,color:Ge[re.Tuic]},{value:re.Socks,label:cs.find(s=>s.type===re.Socks)?.label,color:Ge[re.Socks]},{value:re.Naive,label:cs.find(s=>s.type===re.Naive)?.label,color:Ge[re.Naive]},{value:re.Http,label:cs.find(s=>s.type===re.Http)?.label,color:Ge[re.Http]},{value:re.Mieru,label:cs.find(s=>s.type===re.Mieru)?.label,color:Ge[re.Mieru]}];function Wu({table:s,saveOrder:a,isSortMode:t,groups:l}){const n=s.getState().columnFilters.length>0,{t:o}=V("server");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:[!t&&e.jsxs(e.Fragment,{children:[e.jsx(Bu,{}),e.jsx(D,{placeholder:o("toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:r=>s.getColumn("name")?.setFilterValue(r.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(Qn,{column:s.getColumn("type"),title:o("toolbar.type"),options:Gu}),s.getColumn("group_ids")&&e.jsx(Qn,{column:s.getColumn("group_ids"),title:o("columns.groups.title"),options:l.map(r=>({label:r.name,value:r.id.toString()}))})]}),n&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[o("toolbar.reset"),e.jsx(ds,{className:"ml-2 h-4 w-4"})]})]}),t&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:o("toolbar.sort.tip")})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(E,{variant:t?"default":"outline",onClick:a,size:"sm",children:o(t?"toolbar.sort.save":"toolbar.sort.edit")})})]})}const Ut=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"})}),ta={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"},Pe=(s,a)=>a>0?Math.round(s/a*100):0,Yu=s=>{const{t:a}=V("server");return[{id:"drag-handle",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.sort")}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Na,{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(z,{column:t,title:a("columns.nodeId")}),cell:({row:t})=>{const l=t.getValue("id"),n=t.original.code;return e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(B,{variant:"outline",className:y("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:Ge[t.original.type]},children:[e.jsx(Ql,{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??l}),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(E,{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:o=>{o.stopPropagation(),ha(n||l.toString()).then(()=>{A.success(a("common:copy.success"))})},children:e.jsx(Hn,{className:"size-3"})})]})}),e.jsxs(de,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[cs.find(o=>o.type===t.original.type)?.label,t.original.parent?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:50,enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.show")}),cell:({row:t})=>{const[l,n]=m.useState(!!t.getValue("show"));return e.jsx(ee,{checked:l,onCheckedChange:async o=>{n(o),Js.update({id:t.original.id,type:t.original.type,show:o?1:0}).catch(()=>{n(!o),s()})},style:{backgroundColor:l?Ge[t.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(z,{column:t,title:a("columns.node"),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",ta[0])}),e.jsx("span",{className:"text-sm font-medium",children:a("columns.status.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",ta[1])}),e.jsx("span",{className:"text-sm font-medium",children:a("columns.status.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",ta[2])}),e.jsx("span",{className:"text-sm font-medium",children:a("columns.status.2")})]})]})})}),cell:({row:t})=>e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{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",ta[t.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:t.getValue("name")})]})}),e.jsx(de,{children:e.jsxs("div",{className:" space-y-3",children:[e.jsx("p",{className:"font-medium",children:a(`columns.status.${t.original.available_status}`)}),t.original.load_status&&e.jsxs("div",{className:"border-t border-border/50 pt-3",children:[e.jsx("p",{className:"mb-3 text-sm font-medium",children:a("columns.loadStatus.details")}),e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsx("div",{children:e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[a("columns.loadStatus.cpu"),":"]}),e.jsxs("div",{className:"ml-2 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:y("h-full transition-all duration-300",t.original.load_status.cpu>=90?"bg-destructive":t.original.load_status.cpu>=70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${Math.min(100,t.original.load_status.cpu)}%`}})}),e.jsxs("span",{className:y("min-w-[3rem] text-right font-semibold",t.original.load_status.cpu>=90?"text-destructive":t.original.load_status.cpu>=70?"text-yellow-600":"text-emerald-600"),children:[Math.round(t.original.load_status.cpu),"%"]})]})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[a("columns.loadStatus.memory"),":"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:y("h-full transition-all duration-300",Pe(t.original.load_status.mem.used,t.original.load_status.mem.total)>=90?"bg-destructive":Pe(t.original.load_status.mem.used,t.original.load_status.mem.total)>=70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${Pe(t.original.load_status.mem.used,t.original.load_status.mem.total)}%`}})}),e.jsxs("span",{className:y("min-w-[3rem] text-right font-semibold",Pe(t.original.load_status.mem.used,t.original.load_status.mem.total)>=90?"text-destructive":Pe(t.original.load_status.mem.used,t.original.load_status.mem.total)>=70?"text-yellow-600":"text-emerald-600"),children:[Pe(t.original.load_status.mem.used,t.original.load_status.mem.total),"%"]})]})]}),e.jsxs("div",{className:"ml-auto w-[9.5rem] text-right text-xs text-muted-foreground",children:[Oe(t.original.load_status.mem.used)," ","/"," ",Oe(t.original.load_status.mem.total)]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[a("columns.loadStatus.swap"),":"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:y("h-full transition-all duration-300",Pe(t.original.load_status.swap.used,t.original.load_status.swap.total)>=80?"bg-destructive":Pe(t.original.load_status.swap.used,t.original.load_status.swap.total)>=50?"bg-yellow-500":"bg-emerald-500"),style:{width:`${Pe(t.original.load_status.swap.used,t.original.load_status.swap.total)}%`}})}),e.jsxs("span",{className:y("min-w-[3rem] text-right font-semibold",Pe(t.original.load_status.swap.used,t.original.load_status.swap.total)>=80?"text-destructive":Pe(t.original.load_status.swap.used,t.original.load_status.swap.total)>=50?"text-yellow-600":"text-emerald-600"),children:[Pe(t.original.load_status.swap.used,t.original.load_status.swap.total),"%"]})]})]}),e.jsxs("div",{className:"ml-auto w-[9.5rem] text-right text-xs text-muted-foreground",children:[Oe(t.original.load_status.swap.used)," ","/"," ",Oe(t.original.load_status.swap.total)]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[a("columns.loadStatus.disk"),":"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:y("h-full transition-all duration-300",Pe(t.original.load_status.disk.used,t.original.load_status.disk.total)>=90?"bg-destructive":Pe(t.original.load_status.disk.used,t.original.load_status.disk.total)>=70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${Pe(t.original.load_status.disk.used,t.original.load_status.disk.total)}%`}})}),e.jsxs("span",{className:y("min-w-[3rem] text-right font-semibold",Pe(t.original.load_status.disk.used,t.original.load_status.disk.total)>=90?"text-destructive":Pe(t.original.load_status.disk.used,t.original.load_status.disk.total)>=70?"text-yellow-600":"text-emerald-600"),children:[Pe(t.original.load_status.disk.used,t.original.load_status.disk.total),"%"]})]})]}),e.jsxs("div",{className:"ml-auto w-[9.5rem] text-right text-xs text-muted-foreground",children:[Oe(t.original.load_status.disk.used)," ","/"," ",Oe(t.original.load_status.disk.total)]})]})]})]})]})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.address")}),cell:({row:t})=>{const l=`${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:["(",a("columns.internalPort")," ",t.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(be,{delayDuration:0,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{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:o=>{o.stopPropagation(),ha(l).then(()=>{A.success(a("common:copy.success"))})},children:e.jsx(Hn,{className:"size-3"})})}),e.jsx(de,{side:"top",sideOffset:10,children:a("columns.copyAddress")})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.onlineUsers.title"),tooltip:a("columns.onlineUsers.tooltip")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Ut,{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(z,{column:t,title:a("columns.rate.title"),tooltip:a("columns.rate.tooltip")}),cell:({row:t})=>e.jsxs(B,{variant:"secondary",className:"font-medium",children:[t.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"group_ids",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.groups.title"),tooltip:a("columns.groups.tooltip")}),cell:({row:t})=>{const l=t.original.groups||[];return e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map((n,o)=>e.jsx(B,{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},o)),l.length===0&&e.jsx("span",{className:"text-sm text-muted-foreground",children:a("columns.groups.empty")})]})},enableSorting:!1,filterFn:(t,l,n)=>{const o=t.getValue(l);return o?n.some(r=>o.includes(r)):!1}},{accessorKey:"type",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.type")}),cell:({row:t})=>{const l=t.getValue("type");return e.jsx(B,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:Ge[l]},children:l})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:a("columns.actions")}),cell:({row:t})=>{const{setIsOpen:l,setEditingServer:n,setServerType:o}=Vr();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(Es,{modal:!1,children:[e.jsx(Rs,{asChild:!0,children:e.jsx(E,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":a("columns.actions"),children:e.jsx(ua,{className:"size-4"})})}),e.jsxs(Cs,{align:"end",className:"w-40",children:[e.jsx(Ne,{className:"cursor-pointer",onClick:()=>{o(t.original.type),n(t.original),l(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(Nc,{className:"mr-2 size-4"}),a("columns.actions_dropdown.edit")]})}),e.jsxs(Ne,{className:"cursor-pointer",onClick:async()=>{Js.copy({id:t.original.id}).then(({data:r})=>{r&&(A.success(a("columns.actions_dropdown.copy_success")),s())})},children:[e.jsx(_c,{className:"mr-2 size-4"}),a("columns.actions_dropdown.copy")]}),e.jsx(yt,{}),e.jsx(Ne,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:r=>r.preventDefault(),children:e.jsx(ns,{title:a("columns.actions_dropdown.delete.title"),description:a("columns.actions_dropdown.delete.description"),confirmText:a("columns.actions_dropdown.delete.confirm"),variant:"destructive",onConfirm:async()=>{Js.drop({id:t.original.id}).then(({data:r})=>{r&&(A.success(a("columns.actions_dropdown.delete_success")),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(fs,{className:"mr-2 size-4"}),a("columns.actions_dropdown.delete.confirm")]})})})]})]})})},size:50}]};function Ju(){const[s,a]=m.useState({}),[t,l]=m.useState({"drag-handle":!1}),[n,o]=m.useState([]),[r,c]=m.useState({pageSize:500,pageIndex:0}),[u,i]=m.useState([]),[d,h]=m.useState(!1),[_,k]=m.useState({}),[S,C]=m.useState([]),{refetch:N}=ne({queryKey:["nodeList"],queryFn:async()=>{const{data:I}=await Js.getList();return C(I),I}}),{data:g}=ne({queryKey:["groups"],queryFn:async()=>{const{data:I}=await at.getList();return I}});m.useEffect(()=>{l({"drag-handle":d,show:!d,host:!d,online:!d,rate:!d,groups:!d,type:!1,actions:!d}),k({name:d?2e3:200}),c({pageSize:d?99999:500,pageIndex:0})},[d]);const T=(I,H)=>{d&&(I.dataTransfer.setData("text/plain",H.toString()),I.currentTarget.classList.add("opacity-50"))},R=(I,H)=>{if(!d)return;I.preventDefault(),I.currentTarget.classList.remove("bg-muted");const O=parseInt(I.dataTransfer.getData("text/plain"));if(O===H)return;const K=[...S],[oe]=K.splice(O,1);K.splice(H,0,oe),C(K)},p=async()=>{if(!d){h(!0);return}const I=S?.map((H,O)=>({id:H.id,order:O+1}));Js.sort(I).then(()=>{A.success("排序保存成功"),h(!1),N()}).finally(()=>{h(!1)})},w=Je({data:S||[],columns:Yu(N),state:{sorting:u,columnVisibility:t,rowSelection:s,columnFilters:n,columnSizing:_,pagination:r},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:i,onColumnFiltersChange:o,onColumnVisibilityChange:l,onColumnSizingChange:k,onPaginationChange:c,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),getSortedRowModel:vs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Vs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ku,{refetch:N,children:e.jsx("div",{className:"space-y-4",children:e.jsx(is,{table:w,toolbar:I=>e.jsx(Wu,{table:I,refetch:N,saveOrder:p,isSortMode:d,groups:g||[]}),draggable:d,onDragStart:T,onDragEnd:I=>I.currentTarget.classList.remove("opacity-50"),onDragOver:I=>{I.preventDefault(),I.currentTarget.classList.add("bg-muted")},onDragLeave:I=>I.currentTarget.classList.remove("bg-muted"),onDrop:R,showPagination:!d})})})}function Qu(){const{t:s}=V("server");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("manage.title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("manage.description")})]})}),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(Ju,{})})]})]})}const Xu=Object.freeze(Object.defineProperty({__proto__:null,default:Qu},Symbol.toStringTag,{value:"Module"}));function Zu({table:s,refetch:a}){const t=s.getState().columnFilters.length>0,{t:l}=V("group");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(Va,{refetch:a}),e.jsx(D,{placeholder:l("toolbar.searchPlaceholder"),value:s.getColumn("name")?.getFilterValue()??"",onChange:n=>s.getColumn("name")?.setFilterValue(n.target.value),className:y("h-8 w-[150px] lg:w-[250px]",t&&"border-primary/50 ring-primary/20")}),t&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(ds,{className:"ml-2 h-4 w-4"})]})]})})}const ex=s=>{const{t:a}=V("group");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.id")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(B,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.name")}),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(z,{column:t,title:a("columns.usersCount")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Ut,{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(z,{column:t,title:a("columns.serverCount")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Ql,{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(z,{className:"justify-end",column:t,title:a("columns.actions")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Va,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:a("form.edit")})]})}),e.jsx(ns,{title:a("messages.deleteConfirm"),description:a("messages.deleteDescription"),confirmText:a("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{at.drop({id:t.original.id}).then(({data:l})=>{l&&(A.success(a("messages.updateSuccess")),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(fs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:a("messages.deleteButton")})]})})]})}]};function sx(){const[s,a]=m.useState({}),[t,l]=m.useState({}),[n,o]=m.useState([]),[r,c]=m.useState([]),{data:u,refetch:i,isLoading:d}=ne({queryKey:["serverGroupList"],queryFn:async()=>{const{data:_}=await at.getList();return _}}),h=Je({data:u||[],columns:ex(i),state:{sorting:r,columnVisibility:t,rowSelection:s,columnFilters:n},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:c,onColumnFiltersChange:o,onColumnVisibilityChange:l,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),getSortedRowModel:vs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Vs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(is,{table:h,toolbar:_=>e.jsx(Zu,{table:_,refetch:i}),isLoading:d})}function tx(){const{t:s}=V("group");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),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(sx,{})})]})]})}const ax=Object.freeze(Object.defineProperty({__proto__:null,default:tx},Symbol.toStringTag,{value:"Module"})),nx=s=>x.object({remarks:x.string().min(1,s("form.validation.remarks")),match:x.array(x.string()),action:x.enum(["block","dns"]),action_value:x.string().optional()});function Fr({refetch:s,dialogTrigger:a,defaultValues:t={remarks:"",match:[],action:"block",action_value:""},type:l="add"}){const{t:n}=V("route"),o=ye({resolver:_e(nx(n)),defaultValues:t,mode:"onChange"}),[r,c]=m.useState(!1);return e.jsxs(pe,{open:r,onOpenChange:c,children:[e.jsx(rs,{asChild:!0,children:a||e.jsxs(E,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ze,{icon:"ion:add"})," ",e.jsx("div",{children:n("form.add")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:n(l==="edit"?"form.edit":"form.create")}),e.jsx(Le,{})]}),e.jsxs(we,{...o,children:[e.jsx(v,{control:o.control,name:"remarks",render:({field:u})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:n("form.remarks")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(D,{type:"text",placeholder:n("form.remarksPlaceholder"),...u})})}),e.jsx(P,{})]})}),e.jsx(v,{control:o.control,name:"match",render:({field:u})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(j,{children:n("form.match")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(Ts,{className:"min-h-[120px]",placeholder:n("form.matchPlaceholder"),value:u.value.join(` +`),onChange:i=>{u.onChange(i.target.value.split(` +`))}})})}),e.jsx(P,{})]})}),e.jsx(v,{control:o.control,name:"action",render:({field:u})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsxs(X,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:n("form.actionPlaceholder")})}),e.jsxs(J,{children:[e.jsx($,{value:"block",children:n("actions.block")}),e.jsx($,{value:"dns",children:n("actions.dns")})]})]})})}),e.jsx(P,{})]})}),o.watch("action")==="dns"&&e.jsx(v,{control:o.control,name:"action_value",render:({field:u})=>e.jsxs(f,{children:[e.jsx(j,{children:n("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(D,{type:"text",placeholder:n("form.dnsPlaceholder"),...u})})})]})}),e.jsxs(Re,{children:[e.jsx(qs,{asChild:!0,children:e.jsx(E,{variant:"outline",children:n("form.cancel")})}),e.jsx(E,{type:"submit",onClick:()=>{Sa.getList(o.getValues()).then(({data:u})=>{u&&(c(!1),s&&s(),A.success(n(l==="edit"?"messages.updateSuccess":"messages.createSuccess")),o.reset())})},children:n("form.submit")})]})]})]})]})}function lx({table:s,refetch:a}){const t=s.getState().columnFilters.length>0,{t:l}=V("route");return e.jsx("div",{className:"flex items-center justify-between ",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[e.jsx(Fr,{refetch:a}),e.jsx(D,{placeholder:l("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:n=>s.getColumn("remarks")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(ds,{className:"ml-2 h-4 w-4"})]})]})})}function rx({columns:s,data:a,refetch:t}){const[l,n]=m.useState({}),[o,r]=m.useState({}),[c,u]=m.useState([]),[i,d]=m.useState([]),h=Je({data:a,columns:s,state:{sorting:i,columnVisibility:o,rowSelection:l,columnFilters:c},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:u,onColumnVisibilityChange:r,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),getSortedRowModel:vs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Vs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(is,{table:h,toolbar:_=>e.jsx(lx,{table:_,refetch:t})})}const ix=s=>{const{t:a}=V("route"),t={block:{icon:wc,variant:"destructive",className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800"},dns:{icon:Cc,variant:"secondary",className:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800"}};return[{accessorKey:"id",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(B,{variant:"outline",children:l.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.remarks")}),cell:({row:l})=>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:l.original.remarks})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action_value",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.action_value.title")}),cell:({row:l})=>{const n=l.original.action,o=l.original.action_value,r=l.original.match?.length||0;return e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:n==="dns"&&o?a("columns.action_value.dns",{value:o}):n==="block"?e.jsx("span",{className:"text-destructive",children:a("columns.action_value.block")}):a("columns.action_value.direct")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:a("columns.matchRules",{count:r})})]})},enableHiding:!1,enableSorting:!1,size:300},{accessorKey:"action",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.action")}),cell:({row:l})=>{const n=l.getValue("action"),o=t[n]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(B,{variant:t[n]?.variant||"default",className:y("flex items-center gap-1.5 px-3 py-1 capitalize",t[n]?.className),children:[o&&e.jsx(o,{className:"h-3.5 w-3.5"}),a(`actions.${n}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:a("columns.actions")}),cell:({row:l})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Fr,{defaultValues:l.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:a("form.edit")})]})}),e.jsx(ns,{title:a("messages.deleteConfirm"),description:a("messages.deleteDescription"),confirmText:a("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{Sa.drop({id:l.original.id}).then(({data:n})=>{n&&(A.success(a("messages.deleteSuccess")),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(fs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:a("messages.deleteButton")})]})})]})}]};function ox(){const{t:s}=V("route"),[a,t]=m.useState([]);function l(){Sa.getList().then(({data:n})=>{t(n)})}return m.useEffect(()=>{l()},[]),e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),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,{data:a,columns:ix(l),refetch:l})})]})]})}const cx=Object.freeze(Object.defineProperty({__proto__:null,default:ox},Symbol.toStringTag,{value:"Module"})),Mr=m.createContext(void 0);function dx({children:s,refreshData:a}){const[t,l]=m.useState(!1),[n,o]=m.useState(null);return e.jsx(Mr.Provider,{value:{isOpen:t,setIsOpen:l,editingPlan:n,setEditingPlan:o,refreshData:a},children:s})}function kn(){const s=m.useContext(Mr);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function mx({table:s,saveOrder:a,isSortMode:t}){const{setIsOpen:l}=kn(),{t:n}=V("subscribe");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(E,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>l(!0),children:[e.jsx(ze,{icon:"ion:add"}),e.jsx("div",{children:n("plan.add")})]}),e.jsx(D,{placeholder:n("plan.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:o=>s.getColumn("name")?.setFilterValue(o.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(E,{variant:t?"default":"outline",onClick:a,size:"sm",children:n(t?"plan.sort.save":"plan.sort.edit")})})]})}const Xn={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"}},ux=s=>{const{t:a}=V("subscribe");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(Na,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:a("plan.columns.id")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(B,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:a("plan.columns.show")}),cell:({row:t})=>e.jsx(ee,{defaultChecked:t.getValue("show"),onCheckedChange:l=>{es.update({id:t.original.id,show:l}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:t})=>e.jsx(z,{column:t,title:a("plan.columns.sell")}),cell:({row:t})=>e.jsx(ee,{defaultChecked:t.getValue("sell"),onCheckedChange:l=>{es.update({id:t.original.id,sell:l}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:t})=>e.jsx(z,{column:t,title:a("plan.columns.renew"),tooltip:a("plan.columns.renew_tooltip")}),cell:({row:t})=>e.jsx(ee,{defaultChecked:t.getValue("renew"),onCheckedChange:l=>{es.update({id:t.original.id,renew:l}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:a("plan.columns.name")}),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(z,{column:t,title:a("plan.columns.stats")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-2",children:[e.jsx(Ut,{}),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(z,{column:t,title:a("plan.columns.group")}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center gap-1.5 text-nowrap",children:e.jsx(B,{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(z,{column:t,title:a("plan.columns.price")}),cell:({row:t})=>{const l=t.getValue("prices"),n=[{period:a("plan.columns.price_period.monthly"),key:"monthly",unit:a("plan.columns.price_period.unit.month")},{period:a("plan.columns.price_period.quarterly"),key:"quarterly",unit:a("plan.columns.price_period.unit.quarter")},{period:a("plan.columns.price_period.half_yearly"),key:"half_yearly",unit:a("plan.columns.price_period.unit.half_year")},{period:a("plan.columns.price_period.yearly"),key:"yearly",unit:a("plan.columns.price_period.unit.year")},{period:a("plan.columns.price_period.two_yearly"),key:"two_yearly",unit:a("plan.columns.price_period.unit.two_year")},{period:a("plan.columns.price_period.three_yearly"),key:"three_yearly",unit:a("plan.columns.price_period.unit.three_year")},{period:a("plan.columns.price_period.onetime"),key:"onetime",unit:""},{period:a("plan.columns.price_period.reset_traffic"),key:"reset_traffic",unit:a("plan.columns.price_period.unit.times")}];return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n.map(({period:o,key:r,unit:c})=>l[r]!=null&&e.jsxs(B,{variant:"secondary",className:y("px-2 py-0.5 font-medium transition-colors text-nowrap",Xn[r].color,Xn[r].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[o," ¥",l[r],c]},r))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:a("plan.columns.actions")}),cell:({row:t})=>{const{setIsOpen:l,setEditingPlan:n}=kn();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{n(t.original),l(!0)},children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:a("plan.columns.edit")})]}),e.jsx(ns,{title:a("plan.columns.delete_confirm.title"),description:a("plan.columns.delete_confirm.description"),confirmText:a("plan.columns.delete"),variant:"destructive",onConfirm:async()=>{es.drop({id:t.original.id}).then(({data:o})=>{o&&(A.success(a("plan.columns.delete_confirm.success")),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(fs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:a("plan.columns.delete")})]})})]})}}]},xx=x.object({id:x.number().nullable(),group_id:x.union([x.number(),x.string()]).nullable().optional(),name:x.string().min(1).max(250),content:x.string().nullable().optional(),transfer_enable:x.union([x.number().min(0),x.string().min(1)]),prices:x.object({monthly:x.union([x.number(),x.string()]).nullable().optional(),quarterly:x.union([x.number(),x.string()]).nullable().optional(),half_yearly:x.union([x.number(),x.string()]).nullable().optional(),yearly:x.union([x.number(),x.string()]).nullable().optional(),two_yearly:x.union([x.number(),x.string()]).nullable().optional(),three_yearly:x.union([x.number(),x.string()]).nullable().optional(),onetime:x.union([x.number(),x.string()]).nullable().optional(),reset_traffic:x.union([x.number(),x.string()]).nullable().optional()}).default({}),speed_limit:x.union([x.number(),x.string()]).nullable().optional(),capacity_limit:x.union([x.number(),x.string()]).nullable().optional(),device_limit:x.union([x.number(),x.string()]).nullable().optional(),force_update:x.boolean().optional(),reset_traffic_method:x.number().nullable(),users_count:x.number().optional()}),Tn=m.forwardRef(({className:s,...a},t)=>e.jsx(Xl,{ref:t,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),...a,children:e.jsx(Sc,{className:y("flex items-center justify-center text-current"),children:e.jsx(et,{className:"h-4 w-4"})})}));Tn.displayName=Xl.displayName;const aa={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},na={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}},hx=[{value:null,label:"follow_system"},{value:0,label:"monthly_first"},{value:1,label:"monthly_reset"},{value:2,label:"no_reset"},{value:3,label:"yearly_first"},{value:4,label:"yearly_reset"}];function px(){const{isOpen:s,setIsOpen:a,editingPlan:t,setEditingPlan:l,refreshData:n}=kn(),[o,r]=m.useState(!1),{t:c}=V("subscribe"),u=ye({resolver:_e(xx),defaultValues:{...aa,...t||{}},mode:"onChange"});m.useEffect(()=>{t?u.reset({...aa,...t}):u.reset(aa)},[t,u]);const i=new fn({html:!0}),[d,h]=m.useState();async function _(){at.getList().then(({data:C})=>{h(C)})}m.useEffect(()=>{s&&_()},[s]);const k=C=>{if(isNaN(C))return;const N=Object.entries(na).reduce((g,[T,R])=>{const p=C*R.months*R.discount;return{...g,[T]:p.toFixed(2)}},{});u.setValue("prices",N,{shouldDirty:!0})},S=()=>{a(!1),l(null),u.reset(aa)};return e.jsx(pe,{open:s,onOpenChange:S,children:e.jsxs(ue,{children:[e.jsxs(ve,{children:[e.jsx(ge,{children:c(t?"plan.form.edit_title":"plan.form.add_title")}),e.jsx(Le,{})]}),e.jsxs(we,{...u,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:u.control,name:"name",render:({field:C})=>e.jsxs(f,{children:[e.jsx(j,{children:c("plan.form.name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:c("plan.form.name.placeholder"),...C})}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"group_id",render:({field:C})=>e.jsxs(f,{children:[e.jsxs(j,{className:"flex items-center justify-between",children:[c("plan.form.group.label"),e.jsx(Va,{dialogTrigger:e.jsx(E,{variant:"link",children:c("plan.form.group.add")}),refetch:_})]}),e.jsxs(X,{value:C.value?.toString()??"",onValueChange:N=>C.onChange(N?Number(N):null),children:[e.jsx(b,{children:e.jsx(Y,{children:e.jsx(Z,{placeholder:c("plan.form.group.placeholder")})})}),e.jsx(J,{children:d?.map(N=>e.jsx($,{value:N.id.toString(),children:N.name},N.id))})]}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"transfer_enable",render:({field:C})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:c("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",min:0,placeholder:c("plan.form.transfer.placeholder"),className:"rounded-r-none",...C})}),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:c("plan.form.transfer.unit")})]}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"speed_limit",render:({field:C})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:c("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",min:0,placeholder:c("plan.form.speed.placeholder"),className:"rounded-r-none",...C,value:C.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:c("plan.form.speed.unit")})]}),e.jsx(P,{})]})}),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:c("plan.form.price.title")}),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(D,{type:"number",placeholder:c("plan.form.price.base_price"),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:C=>{const N=parseFloat(C.target.value);k(N)}})]}),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const C=Object.keys(na).reduce((N,g)=>({...N,[g]:""}),{});u.setValue("prices",C,{shouldDirty:!0})},children:c("plan.form.price.clear.button")})}),e.jsx(de,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:c("plan.form.price.clear.tooltip")})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(na).filter(([C])=>!["onetime","reset_traffic"].includes(C)).map(([C,N])=>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(v,{control:u.control,name:`prices.${C}`,render:({field:g})=>e.jsxs(f,{children:[e.jsxs(j,{className:"text-xs font-medium text-muted-foreground",children:[c(`plan.columns.price_period.${C}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",N.months===1?c("plan.form.price.period.monthly"):c("plan.form.price.period.months",{count:N.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(D,{type:"number",placeholder:"0.00",min:0,...g,value:g.value??"",onChange:T=>g.onChange(T.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"})})]})]})})},C))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(na).filter(([C])=>["onetime","reset_traffic"].includes(C)).map(([C,N])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(v,{control:u.control,name:`prices.${C}`,render:({field:g})=>e.jsx(f,{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(j,{className:"text-xs font-medium",children:c(`plan.columns.price_period.${C}`)}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:c(C==="onetime"?"plan.form.price.onetime_desc":"plan.form.price.reset_desc")})]}),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(D,{type:"number",placeholder:"0.00",min:0,...g,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"})})]})]})})})},C))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(v,{control:u.control,name:"device_limit",render:({field:C})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:c("plan.form.device.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",min:0,placeholder:c("plan.form.device.placeholder"),className:"rounded-r-none",...C,value:C.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:c("plan.form.device.unit")})]}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"capacity_limit",render:({field:C})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(j,{children:c("plan.form.capacity.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",min:0,placeholder:c("plan.form.capacity.placeholder"),className:"rounded-r-none",...C,value:C.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:c("plan.form.capacity.unit")})]}),e.jsx(P,{})]})})]}),e.jsx(v,{control:u.control,name:"reset_traffic_method",render:({field:C})=>e.jsxs(f,{children:[e.jsx(j,{children:c("plan.form.reset_method.label")}),e.jsxs(X,{value:C.value?.toString()??"null",onValueChange:N=>C.onChange(N=="null"?null:Number(N)),children:[e.jsx(b,{children:e.jsx(Y,{children:e.jsx(Z,{placeholder:c("plan.form.reset_method.placeholder")})})}),e.jsx(J,{children:hx.map(N=>e.jsx($,{value:N.value?.toString()??"null",children:c(`plan.form.reset_method.options.${N.label}`)},N.value))})]}),e.jsx(F,{className:"text-xs",children:c("plan.form.reset_method.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:u.control,name:"content",render:({field:C})=>{const[N,g]=m.useState(!1);return e.jsxs(f,{className:"space-y-2",children:[e.jsxs(j,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c("plan.form.content.label"),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>g(!N),children:N?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(de,{side:"top",children:e.jsx("p",{className:"text-xs",children:c(N?"plan.form.content.preview_button.hide":"plan.form.content.preview_button.show")})})]})})]}),e.jsx(be,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(E,{variant:"outline",size:"sm",onClick:()=>{C.onChange(c("plan.form.content.template.content"))},children:c("plan.form.content.template.button")})}),e.jsx(de,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:c("plan.form.content.template.tooltip")})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${N?"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(jn,{style:{height:"400px"},value:C.value||"",renderHTML:T=>i.render(T),onChange:({text:T})=>C.onChange(T),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:c("plan.form.content.placeholder"),className:"rounded-md border"})})}),N&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:c("plan.form.content.preview")}),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:i.render(C.value||"")}})})]})]}),e.jsx(F,{className:"text-xs",children:c("plan.form.content.description")}),e.jsx(P,{})]})}})]}),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:t&&e.jsx(v,{control:u.control,name:"force_update",render:({field:C})=>e.jsxs(f,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(b,{children:e.jsx(Tn,{checked:C.value,onCheckedChange:C.onChange})}),e.jsx("div",{className:"",children:e.jsx(j,{className:"text-sm",children:c("plan.form.force_update.label")})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(E,{type:"button",variant:"outline",onClick:S,children:c("plan.form.submit.cancel")}),e.jsx(E,{type:"submit",disabled:o,onClick:()=>{u.handleSubmit(async C=>{r(!0),(await es.save(C)).data&&(A.success(c(t?"plan.form.submit.success.update":"plan.form.submit.success.add")),S(),n()),r(!1)})()},children:c(o?"plan.form.submit.submitting":"plan.form.submit.submit")})]})]})})]})]})})}function gx(){const[s,a]=m.useState({}),[t,l]=m.useState({"drag-handle":!1}),[n,o]=m.useState([]),[r,c]=m.useState([]),[u,i]=m.useState(!1),[d,h]=m.useState({pageSize:20,pageIndex:0}),[_,k]=m.useState([]),{refetch:S}=ne({queryKey:["planList"],queryFn:async()=>{const{data:R}=await es.getList();return k(R),R}});m.useEffect(()=>{l({"drag-handle":u}),h({pageSize:u?99999:10,pageIndex:0})},[u]);const C=(R,p)=>{u&&(R.dataTransfer.setData("text/plain",p.toString()),R.currentTarget.classList.add("opacity-50"))},N=(R,p)=>{if(!u)return;R.preventDefault(),R.currentTarget.classList.remove("bg-muted");const w=parseInt(R.dataTransfer.getData("text/plain"));if(w===p)return;const I=[..._],[H]=I.splice(w,1);I.splice(p,0,H),k(I)},g=async()=>{if(!u){i(!0);return}const R=_?.map(p=>p.id);es.sort(R).then(()=>{A.success("排序保存成功"),i(!1),S()}).finally(()=>{i(!1)})},T=Je({data:_||[],columns:ux(S),state:{sorting:r,columnVisibility:t,rowSelection:s,columnFilters:n,pagination:d},enableRowSelection:!0,onPaginationChange:h,onRowSelectionChange:a,onSortingChange:c,onColumnFiltersChange:o,onColumnVisibilityChange:l,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),getSortedRowModel:vs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Vs(),initialState:{columnPinning:{right:["actions"]}},pageCount:u?1:void 0});return e.jsx(dx,{refreshData:S,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(is,{table:T,toolbar:R=>e.jsx(mx,{table:R,refetch:S,saveOrder:g,isSortMode:u}),draggable:u,onDragStart:C,onDragEnd:R=>R.currentTarget.classList.remove("opacity-50"),onDragOver:R=>{R.preventDefault(),R.currentTarget.classList.add("bg-muted")},onDragLeave:R=>R.currentTarget.classList.remove("bg-muted"),onDrop:N,showPagination:!u}),e.jsx(px,{})]})})}function fx(){const{t:s}=V("subscribe");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("plan.title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("plan.page.description")})]})}),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(gx,{})})]})]})}const jx=Object.freeze(Object.defineProperty({__proto__:null,default:fx},Symbol.toStringTag,{value:"Module"})),ht=[{value:ae.PENDING,label:Pt[ae.PENDING],icon:kc,color:Et[ae.PENDING]},{value:ae.PROCESSING,label:Pt[ae.PROCESSING],icon:Zl,color:Et[ae.PROCESSING]},{value:ae.COMPLETED,label:Pt[ae.COMPLETED],icon:nn,color:Et[ae.COMPLETED]},{value:ae.CANCELLED,label:Pt[ae.CANCELLED],icon:er,color:Et[ae.CANCELLED]},{value:ae.DISCOUNTED,label:Pt[ae.DISCOUNTED],icon:nn,color:Et[ae.DISCOUNTED]}],Vt=[{value:je.PENDING,label:Zt[je.PENDING],icon:Tc,color:ea[je.PENDING]},{value:je.PROCESSING,label:Zt[je.PROCESSING],icon:Zl,color:ea[je.PROCESSING]},{value:je.VALID,label:Zt[je.VALID],icon:nn,color:ea[je.VALID]},{value:je.INVALID,label:Zt[je.INVALID],icon:er,color:ea[je.INVALID]}];function la({column:s,title:a,options:t}){const l=s?.getFacetedUniqueValues(),n=s?.getFilterValue(),o=Array.isArray(n)?new Set(n):n!==void 0?new Set([n]):new Set;return e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(_a,{className:"mr-2 h-4 w-4"}),a,o?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(B,{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(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[o.size," selected"]}):t.filter(r=>o.has(r.value)).map(r=>e.jsx(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:r.label},r.value))})]})]})}),e.jsx(bs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:a}),e.jsxs(Ks,{children:[e.jsx(lt,{children:"No results found."}),e.jsx(as,{children:t.map(r=>{const c=o.has(r.value);return e.jsxs($e,{onSelect:()=>{const u=new Set(o);c?u.delete(r.value):u.add(r.value);const i=Array.from(u);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",c?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(et,{className:y("h-4 w-4")})}),r.icon&&e.jsx(r.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${r.color}`}),e.jsx("span",{children:r.label}),l?.get(r.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(r.value)})]},r.value)})}),o.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(St,{}),e.jsx(as,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const vx=x.object({email:x.string().min(1),plan_id:x.number(),period:x.string(),total_amount:x.number()}),bx={email:"",plan_id:0,total_amount:0,period:""};function Or({refetch:s,trigger:a,defaultValues:t}){const{t:l}=V("order"),[n,o]=m.useState(!1),r=ye({resolver:_e(vx),defaultValues:{...bx,...t},mode:"onChange"}),[c,u]=m.useState([]);return m.useEffect(()=>{n&&es.getList().then(({data:i})=>{u(i)})},[n]),e.jsxs(pe,{open:n,onOpenChange:o,children:[e.jsx(rs,{asChild:!0,children:a||e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(ze,{icon:"ion:add"}),e.jsx("div",{children:l("dialog.addOrder")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:l("dialog.assignOrder")}),e.jsx(Le,{})]}),e.jsxs(we,{...r,children:[e.jsx(v,{control:r.control,name:"email",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dialog.fields.userEmail")}),e.jsx(b,{children:e.jsx(D,{placeholder:l("dialog.placeholders.email"),...i})})]})}),e.jsx(v,{control:r.control,name:"plan_id",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dialog.fields.subscriptionPlan")}),e.jsx(b,{children:e.jsxs(X,{value:i.value?i.value?.toString():void 0,onValueChange:d=>i.onChange(parseInt(d)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dialog.placeholders.plan")})}),e.jsx(J,{children:c.map(d=>e.jsx($,{value:d.id.toString(),children:d.name},d.id))})]})})]})}),e.jsx(v,{control:r.control,name:"period",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dialog.fields.orderPeriod")}),e.jsx(b,{children:e.jsxs(X,{value:i.value,onValueChange:i.onChange,children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:l("dialog.placeholders.period")})}),e.jsx(J,{children:Object.keys(Ud).map(d=>e.jsx($,{value:d,children:l(`period.${d}`)},d))})]})})]})}),e.jsx(v,{control:r.control,name:"total_amount",render:({field:i})=>e.jsxs(f,{children:[e.jsx(j,{children:l("dialog.fields.paymentAmount")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:l("dialog.placeholders.amount"),value:i.value/100,onChange:d=>i.onChange(parseFloat(d.currentTarget.value)*100)})}),e.jsx(P,{})]})}),e.jsxs(Re,{children:[e.jsx(E,{variant:"outline",onClick:()=>o(!1),children:l("dialog.actions.cancel")}),e.jsx(E,{type:"submit",onClick:()=>{r.handleSubmit(i=>{Ys.assign(i).then(({data:d})=>{d&&(s&&s(),r.reset(),o(!1),A.success(l("dialog.messages.addSuccess")))})})()},children:l("dialog.actions.confirm")})]})]})]})]})}function yx({table:s,refetch:a}){const{t}=V("order"),l=s.getState().columnFilters.length>0,n=Object.values(ps).filter(u=>typeof u=="number").map(u=>({label:t(`type.${ps[u]}`),value:u,color:u===ps.NEW?"green-500":u===ps.RENEWAL?"blue-500":u===ps.UPGRADE?"purple-500":"orange-500"})),o=Object.values(Ie).map(u=>({label:t(`period.${u}`),value:u,color:u===Ie.MONTH_PRICE?"slate-500":u===Ie.QUARTER_PRICE?"cyan-500":u===Ie.HALF_YEAR_PRICE?"indigo-500":u===Ie.YEAR_PRICE?"violet-500":u===Ie.TWO_YEAR_PRICE?"fuchsia-500":u===Ie.THREE_YEAR_PRICE?"pink-500":u===Ie.ONETIME_PRICE?"rose-500":"orange-500"})),r=Object.values(ae).filter(u=>typeof u=="number").map(u=>({label:t(`status.${ae[u]}`),value:u,icon:u===ae.PENDING?ht[0].icon:u===ae.PROCESSING?ht[1].icon:u===ae.COMPLETED?ht[2].icon:u===ae.CANCELLED?ht[3].icon:ht[4].icon,color:u===ae.PENDING?"yellow-500":u===ae.PROCESSING?"blue-500":u===ae.COMPLETED?"green-500":u===ae.CANCELLED?"red-500":"green-500"})),c=Object.values(je).filter(u=>typeof u=="number").map(u=>({label:t(`commission.${je[u]}`),value:u,icon:u===je.PENDING?Vt[0].icon:u===je.PROCESSING?Vt[1].icon:u===je.VALID?Vt[2].icon:Vt[3].icon,color:u===je.PENDING?"yellow-500":u===je.PROCESSING?"blue-500":u===je.VALID?"green-500":"red-500"}));return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Or,{refetch:a}),e.jsx(D,{placeholder:t("search.placeholder"),value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:u=>s.getColumn("trade_no")?.setFilterValue(u.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(la,{column:s.getColumn("type"),title:t("table.columns.type"),options:n}),s.getColumn("period")&&e.jsx(la,{column:s.getColumn("period"),title:t("table.columns.period"),options:o}),s.getColumn("status")&&e.jsx(la,{column:s.getColumn("status"),title:t("table.columns.status"),options:r}),s.getColumn("commission_status")&&e.jsx(la,{column:s.getColumn("commission_status"),title:t("table.columns.commissionStatus"),options:c})]}),l&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[t("actions.reset"),e.jsx(ds,{className:"ml-2 h-4 w-4"})]})]})}function us({label:s,value:a,className:t,valueClassName:l}){return e.jsxs("div",{className:y("flex items-center py-1.5",t),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:y("text-sm",l),children:a||"-"})]})}function Nx({status:s}){const{t:a}=V("order"),t={[ae.PENDING]:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",[ae.PROCESSING]:"bg-blue-100 text-blue-800 hover:bg-blue-100",[ae.CANCELLED]:"bg-red-100 text-red-800 hover:bg-red-100",[ae.COMPLETED]:"bg-green-100 text-green-800 hover:bg-green-100",[ae.DISCOUNTED]:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(B,{variant:"secondary",className:y("font-medium",t[s]),children:a(`status.${ae[s]}`)})}function _x({id:s,trigger:a}){const[t,l]=m.useState(!1),[n,o]=m.useState(),{t:r}=V("order");return m.useEffect(()=>{(async()=>{if(t){const{data:u}=await Ys.getInfo({id:s});o(u)}})()},[t,s]),e.jsxs(pe,{onOpenChange:l,open:t,children:[e.jsx(rs,{asChild:!0,children:a}),e.jsxs(ue,{className:"max-w-xl",children:[e.jsxs(ve,{className:"space-y-2",children:[e.jsx(ge,{className:"text-lg font-medium",children:r("dialog.title")}),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:[r("table.columns.tradeNo"),":",n?.trade_no]}),n?.status&&e.jsx(Nx,{status:n.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:r("dialog.basicInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(us,{label:r("dialog.fields.userEmail"),value:n?.user?.email?e.jsxs(st,{to:`/user/manage?email=${n.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[n.user.email,e.jsx(sr,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(us,{label:r("dialog.fields.orderPeriod"),value:n&&r(`period.${n.period}`)}),e.jsx(us,{label:r("dialog.fields.subscriptionPlan"),value:n?.plan?.name,valueClassName:"font-medium"}),e.jsx(us,{label:r("dialog.fields.callbackNo"),value:n?.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:r("dialog.amountInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(us,{label:r("dialog.fields.paymentAmount"),value:Ws(n?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(ke,{className:"my-2"}),e.jsx(us,{label:r("dialog.fields.balancePayment"),value:Ws(n?.balance_amount||0)}),e.jsx(us,{label:r("dialog.fields.discountAmount"),value:Ws(n?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(us,{label:r("dialog.fields.refundAmount"),value:Ws(n?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(us,{label:r("dialog.fields.deductionAmount"),value:Ws(n?.surplus_amount||0)})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:r("dialog.timeInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(us,{label:r("dialog.fields.createdAt"),value:Ce(n?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(us,{label:r("dialog.fields.updatedAt"),value:Ce(n?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const wx={[ps.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ps.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ps.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ps.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Cx={[Ie.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ie.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Sx=s=>ae[s],kx=s=>je[s],Tx=s=>ps[s],Dx=s=>{const{t:a}=V("order");return[{accessorKey:"trade_no",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.tradeNo")}),cell:({row:t})=>{const l=t.original.trade_no,n=l.length>6?`${l.slice(0,3)}...${l.slice(-3)}`:l;return e.jsx("div",{className:"flex items-center",children:e.jsx(_x,{trigger:e.jsxs(G,{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(sr,{className:"h-3.5 w-3.5 opacity-70"})]}),id:t.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.type")}),cell:({row:t})=>{const l=t.getValue("type"),n=wx[l];return e.jsx(B,{variant:"secondary",className:y("font-medium transition-colors text-nowrap",n.color,n.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:a(`type.${Tx(l)}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.plan")}),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(z,{column:t,title:a("table.columns.period")}),cell:({row:t})=>{const l=t.getValue("period"),n=Cx[l];return e.jsx(B,{variant:"secondary",className:y("font-medium transition-colors text-nowrap",n?.color,n?.bgColor,"hover:bg-opacity-80"),children:a(`period.${l}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.amount")}),cell:({row:t})=>{const l=t.getValue("total_amount"),n=typeof l=="number"?(l/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(z,{column:t,title:a("table.columns.status")}),e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx(Pr,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(de,{side:"top",className:"max-w-[200px] text-sm",children:a("status.tooltip")})]})})]}),cell:({row:t})=>{const l=ht.find(n=>n.value===t.getValue("status"));return l?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l.icon&&e.jsx(l.icon,{className:`h-4 w-4 text-${l.color}`}),e.jsx("span",{className:"text-sm font-medium",children:a(`status.${Sx(l.value)}`)})]}),l.value===ae.PENDING&&e.jsxs(Es,{modal:!0,children:[e.jsx(Rs,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(ua,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:a("actions.openMenu")})]})}),e.jsxs(Cs,{align:"end",className:"w-[140px]",children:[e.jsx(Ne,{className:"cursor-pointer",onClick:async()=>{await Ys.markPaid({trade_no:t.original.trade_no}),s()},children:a("actions.markAsPaid")}),e.jsx(Ne,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ys.makeCancel({trade_no:t.original.trade_no}),s()},children:a("actions.cancel")})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.commission")}),cell:({row:t})=>{const l=t.getValue("commission_balance"),n=l?(l/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:l?`¥${n}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.commissionStatus")}),cell:({row:t})=>{const l=t.original.status,n=t.original.commission_balance,o=Vt.find(r=>r.value===t.getValue("commission_status"));return n==0||!o?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:[o.icon&&e.jsx(o.icon,{className:`h-4 w-4 text-${o.color}`}),e.jsx("span",{className:"text-sm font-medium",children:a(`commission.${kx(o.value)}`)})]}),o.value===je.PENDING&&l===ae.COMPLETED&&e.jsxs(Es,{modal:!0,children:[e.jsx(Rs,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(ua,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:a("actions.openMenu")})]})}),e.jsxs(Cs,{align:"end",className:"w-[120px]",children:[e.jsx(Ne,{className:"cursor-pointer",onClick:async()=>{await Ys.update({trade_no:t.original.trade_no,commission_status:je.PROCESSING}),s()},children:a("commission.PROCESSING")}),e.jsx(Ne,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ys.update({trade_no:t.original.trade_no,commission_status:je.INVALID}),s()},children:a("commission.INVALID")})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.createdAt")}),cell:({row:t})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:Ce(t.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}]};function Px(){const[s]=tr(),[a,t]=m.useState({}),[l,n]=m.useState({}),[o,r]=m.useState([]),[c,u]=m.useState([]),[i,d]=m.useState({pageIndex:0,pageSize:20});m.useEffect(()=>{const N=Object.entries({user_id:"string",order_id:"string",commission_status:"number",status:"number",commission_balance:"string"}).map(([g,T])=>{const R=s.get(g);return R?{id:g,value:T==="number"?parseInt(R):R}:null}).filter(Boolean);N.length>0&&r(N)},[s]);const{refetch:h,data:_,isLoading:k}=ne({queryKey:["orderList",i,o,c],queryFn:()=>Ys.getList({pageSize:i.pageSize,current:i.pageIndex+1,filter:o,sort:c})}),S=Je({data:_?.data??[],columns:Dx(h),state:{sorting:c,columnVisibility:l,rowSelection:a,columnFilters:o,pagination:i},rowCount:_?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:u,onColumnFiltersChange:r,onColumnVisibilityChange:n,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),onPaginationChange:d,getSortedRowModel:vs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Vs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(is,{table:S,toolbar:e.jsx(yx,{table:S,refetch:h}),showPagination:!0})}function Ex(){const{t:s}=V("order");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),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(Px,{})})]})]})}const Rx=Object.freeze(Object.defineProperty({__proto__:null,default:Ex},Symbol.toStringTag,{value:"Module"}));function Ix({column:s,title:a,options:t}){const l=s?.getFacetedUniqueValues(),n=new Set(s?.getFilterValue());return e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(_a,{className:"mr-2 h-4 w-4"}),a,n?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(B,{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(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[n.size," selected"]}):t.filter(o=>n.has(o.value)).map(o=>e.jsx(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(bs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:a}),e.jsxs(Ks,{children:[e.jsx(lt,{children:"No results found."}),e.jsx(as,{children:t.map(o=>{const r=n.has(o.value);return e.jsxs($e,{onSelect:()=>{r?n.delete(o.value):n.add(o.value);const c=Array.from(n);s?.setFilterValue(c.length?c:void 0)},children:[e.jsx("div",{className:y("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",r?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(et,{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}),l?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(o.value)})]},o.value)})}),n.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(St,{}),e.jsx(as,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Lx=x.object({id:x.coerce.number().nullable().optional(),name:x.string().min(1,"请输入优惠券名称"),code:x.string().nullable(),type:x.coerce.number(),value:x.coerce.number(),started_at:x.coerce.number(),ended_at:x.coerce.number(),limit_use:x.union([x.string(),x.number()]).nullable(),limit_use_with_user:x.union([x.string(),x.number()]).nullable(),generate_count:x.coerce.number().nullable().optional(),limit_plan_ids:x.array(x.coerce.number()).default([]).nullable(),limit_period:x.array(x.nativeEnum(zt)).default([]).nullable()}).refine(s=>s.ended_at>s.started_at,{message:"结束时间必须晚于开始时间",path:["ended_at"]}),Zn={name:"",code:null,type:Ze.AMOUNT,value:0,started_at:Math.floor(Date.now()/1e3),ended_at:Math.floor(Date.now()/1e3)+7*24*60*60,limit_use:null,limit_use_with_user:null,limit_plan_ids:[],limit_period:[],generate_count:null};function zr({defaultValues:s,refetch:a,type:t="create",dialogTrigger:l=null,open:n,onOpenChange:o}){const{t:r}=V("coupon"),[c,u]=m.useState(!1),i=n??c,d=o??u,[h,_]=m.useState([]),k=ye({resolver:_e(Lx),defaultValues:s||Zn});m.useEffect(()=>{s&&k.reset(s)},[s,k]),m.useEffect(()=>{es.getList().then(({data:g})=>_(g))},[]);const S=g=>{if(!g)return;const T=(R,p)=>{const w=new Date(p*1e3);return R.setHours(w.getHours(),w.getMinutes(),w.getSeconds()),Math.floor(R.getTime()/1e3)};g.from&&k.setValue("started_at",T(g.from,k.watch("started_at"))),g.to&&k.setValue("ended_at",T(g.to,k.watch("ended_at")))},C=async g=>{const T=await ga.save(g);if(g.generate_count&&T){const R=new Blob([T],{type:"text/csv;charset=utf-8;"}),p=document.createElement("a");p.href=window.URL.createObjectURL(R),p.download=`coupons_${new Date().getTime()}.csv`,p.click(),window.URL.revokeObjectURL(p.href)}d(!1),t==="create"&&k.reset(Zn),a()},N=(g,T)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:T}),e.jsx(D,{type:"datetime-local",step:"1",value:Ce(k.watch(g),"YYYY-MM-DDTHH:mm:ss"),onChange:R=>{const p=new Date(R.target.value);k.setValue(g,Math.floor(p.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(pe,{open:i,onOpenChange:d,children:[l&&e.jsx(rs,{asChild:!0,children:l}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsx(ve,{children:e.jsx(ge,{children:r(t==="create"?"form.add":"form.edit")})}),e.jsx(we,{...k,children:e.jsxs("form",{onSubmit:k.handleSubmit(C),className:"space-y-4",children:[e.jsx(v,{control:k.control,name:"name",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("form.name.label")}),e.jsx(D,{placeholder:r("form.name.placeholder"),...g}),e.jsx(P,{})]})}),t==="create"&&e.jsx(v,{control:k.control,name:"generate_count",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("form.generateCount.label")}),e.jsx(D,{type:"number",min:0,placeholder:r("form.generateCount.placeholder"),...g,value:g.value===void 0?"":g.value,onChange:T=>g.onChange(T.target.value===""?"":parseInt(T.target.value)),className:"h-9"}),e.jsx(F,{className:"text-xs",children:r("form.generateCount.description")}),e.jsx(P,{})]})}),(!k.watch("generate_count")||k.watch("generate_count")==null)&&e.jsx(v,{control:k.control,name:"code",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("form.code.label")}),e.jsx(D,{placeholder:r("form.code.placeholder"),...g,className:"h-9"}),e.jsx(F,{className:"text-xs",children:r("form.code.description")}),e.jsx(P,{})]})}),e.jsxs(f,{children:[e.jsx(j,{children:r("form.type.label")}),e.jsxs("div",{className:"flex",children:[e.jsx(v,{control:k.control,name:"type",render:({field:g})=>e.jsxs(X,{value:g.value.toString(),onValueChange:T=>{const R=g.value,p=parseInt(T);g.onChange(p);const w=k.getValues("value");w&&(R===Ze.AMOUNT&&p===Ze.PERCENTAGE?k.setValue("value",w/100):R===Ze.PERCENTAGE&&p===Ze.AMOUNT&&k.setValue("value",w*100))},children:[e.jsx(Y,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(Z,{placeholder:r("form.type.placeholder")})}),e.jsx(J,{children:Object.entries(Kd).map(([T,R])=>e.jsx($,{value:T,children:r(`table.toolbar.types.${T}`)},T))})]})}),e.jsx(v,{control:k.control,name:"value",render:({field:g})=>{const T=g.value==null?"":k.watch("type")===Ze.AMOUNT&&typeof g.value=="number"?(g.value/100).toString():g.value.toString();return e.jsx(D,{type:"number",placeholder:r("form.value.placeholder"),...g,value:T,onChange:R=>{const p=R.target.value;if(p===""){g.onChange("");return}const w=parseFloat(p);isNaN(w)||g.onChange(k.watch("type")===Ze.AMOUNT?Math.round(w*100):w)},step:"any",min:0,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:k.watch("type")==Ze.AMOUNT?"¥":"%"})})]})]}),e.jsxs(f,{children:[e.jsx(j,{children:r("form.validity.label")}),e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsxs(E,{variant:"outline",className:y("w-full justify-start text-left font-normal",!k.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(Kt,{className:"mr-2 h-4 w-4"}),Ce(k.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ",r("form.validity.to")," ",Ce(k.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(bs,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(rt,{mode:"range",selected:{from:new Date(k.watch("started_at")*1e3),to:new Date(k.watch("ended_at")*1e3)},onSelect:S,numberOfMonths:2})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[N("started_at",r("table.validity.startTime")),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:r("form.validity.to")}),N("ended_at",r("table.validity.endTime"))]})})]})]}),e.jsx(P,{})]}),e.jsx(v,{control:k.control,name:"limit_use",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("form.limitUse.label")}),e.jsx(D,{type:"number",min:0,placeholder:r("form.limitUse.placeholder"),...g,value:g.value===null?"":g.value,onChange:T=>g.onChange(T.target.value===""?null:parseInt(T.target.value)),className:"h-9"}),e.jsx(F,{className:"text-xs",children:r("form.limitUse.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:k.control,name:"limit_use_with_user",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("form.limitUseWithUser.label")}),e.jsx(D,{type:"number",min:0,placeholder:r("form.limitUseWithUser.placeholder"),...g,value:g.value===null?"":g.value,onChange:T=>g.onChange(T.target.value===""?null:parseInt(T.target.value)),className:"h-9"}),e.jsx(F,{className:"text-xs",children:r("form.limitUseWithUser.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:k.control,name:"limit_period",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("form.limitPeriod.label")}),e.jsx(_t,{options:Object.entries(zt).filter(([T])=>isNaN(Number(T))).map(([T,R])=>({label:r(`coupon:period.${R}`),value:T})),onChange:T=>{if(T.length===0){g.onChange([]);return}const R=T.map(p=>zt[p.value]);g.onChange(R)},value:(g.value||[]).map(T=>({label:r(`coupon:period.${T}`),value:Object.entries(zt).find(([R,p])=>p===T)?.[0]||""})),placeholder:r("form.limitPeriod.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:r("form.limitPeriod.empty")})}),e.jsx(F,{className:"text-xs",children:r("form.limitPeriod.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:k.control,name:"limit_plan_ids",render:({field:g})=>e.jsxs(f,{children:[e.jsx(j,{children:r("form.limitPlan.label")}),e.jsx(_t,{options:h?.map(T=>({label:T.name,value:T.id.toString()}))||[],onChange:T=>g.onChange(T.map(R=>Number(R.value))),value:(h||[]).filter(T=>(g.value||[]).includes(T.id)).map(T=>({label:T.name,value:T.id.toString()})),placeholder:r("form.limitPlan.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:r("form.limitPlan.empty")})}),e.jsx(P,{})]})}),e.jsx(Re,{children:e.jsx(E,{type:"submit",disabled:k.formState.isSubmitting,children:k.formState.isSubmitting?r("form.submit.saving"):r("form.submit.save")})})]})})]})]})}function Vx({table:s,refetch:a}){const t=s.getState().columnFilters.length>0,{t:l}=V("coupon");return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(zr,{refetch:a,dialogTrigger:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(ze,{icon:"ion:add"}),e.jsx("div",{children:l("form.add")})]})}),e.jsx(D,{placeholder:l("table.toolbar.search"),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(Ix,{column:s.getColumn("type"),title:l("table.toolbar.type"),options:[{value:Ze.AMOUNT,label:l(`table.toolbar.types.${Ze.AMOUNT}`)},{value:Ze.PERCENTAGE,label:l(`table.toolbar.types.${Ze.PERCENTAGE}`)}]}),t&&e.jsxs(E,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("table.toolbar.reset"),e.jsx(ds,{className:"ml-2 h-4 w-4"})]})]})}const $r=m.createContext(void 0);function Fx({children:s,refetch:a}){const[t,l]=m.useState(!1),[n,o]=m.useState(null),r=u=>{o(u),l(!0)},c=()=>{l(!1),o(null)};return e.jsxs($r.Provider,{value:{isOpen:t,currentCoupon:n,openEdit:r,closeEdit:c},children:[s,n&&e.jsx(zr,{defaultValues:n,refetch:a,type:"edit",open:t,onOpenChange:l})]})}function Mx(){const s=m.useContext($r);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const Ox=s=>{const{t:a}=V("coupon");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.id")}),cell:({row:t})=>e.jsx(B,{children:t.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.show")}),cell:({row:t})=>e.jsx(ee,{defaultChecked:t.original.show,onCheckedChange:l=>{ga.update({id:t.original.id,show:l}).then(({data:n})=>!n&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.name")}),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(z,{column:t,title:a("table.columns.type")}),cell:({row:t})=>e.jsx(B,{variant:"outline",children:a(`table.toolbar.types.${t.original.type}`)}),enableSorting:!0},{accessorKey:"code",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.code")}),cell:({row:t})=>e.jsx(B,{variant:"secondary",children:t.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.limitUse")}),cell:({row:t})=>e.jsx(B,{variant:"outline",children:t.original.limit_use===null?a("table.validity.unlimited"):t.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.limitUseWithUser")}),cell:({row:t})=>e.jsx(B,{variant:"outline",children:t.original.limit_use_with_user===null?a("table.validity.noLimit"):t.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:t})=>e.jsx(z,{column:t,title:a("table.columns.validity")}),cell:({row:t})=>{const[l,n]=m.useState(!1),o=Date.now(),r=t.original.started_at*1e3,c=t.original.ended_at*1e3,u=o>c,i=oe.jsx(z,{className:"justify-end",column:t,title:a("table.columns.actions")}),cell:({row:t})=>{const{openEdit:l}=Mx();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>l(t.original),children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:a("table.actions.edit")})]}),e.jsx(ns,{title:a("table.actions.deleteConfirm.title"),description:a("table.actions.deleteConfirm.description"),confirmText:a("table.actions.deleteConfirm.confirmText"),variant:"destructive",onConfirm:async()=>{ga.drop({id:t.original.id}).then(({data:n})=>{n&&(A.success("删除成功"),s())})},children:e.jsxs(E,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(fs,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:a("table.actions.delete")})]})})]})}}]};function zx(){const[s,a]=m.useState({}),[t,l]=m.useState({}),[n,o]=m.useState([]),[r,c]=m.useState([]),[u,i]=m.useState({pageIndex:0,pageSize:20}),{refetch:d,data:h}=ne({queryKey:["couponList",u,n,r],queryFn:()=>ga.getList({pageSize:u.pageSize,current:u.pageIndex+1,filter:n,sort:r})}),_=Je({data:h?.data??[],columns:Ox(d),state:{sorting:r,columnVisibility:t,rowSelection:s,columnFilters:n,pagination:u},pageCount:Math.ceil((h?.total??0)/u.pageSize),rowCount:h?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:c,onColumnFiltersChange:o,onColumnVisibilityChange:l,onPaginationChange:i,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),getSortedRowModel:vs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Vs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Fx,{refetch:d,children:e.jsx("div",{className:"space-y-4",children:e.jsx(is,{table:_,toolbar:e.jsx(Vx,{table:_,refetch:d})})})})}function $x(){const{t:s}=V("coupon");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),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(zx,{})})]})]})}const Ax=Object.freeze(Object.defineProperty({__proto__:null,default:$x},Symbol.toStringTag,{value:"Module"})),qx=1,Hx=1e6;let Wa=0;function Ux(){return Wa=(Wa+1)%Number.MAX_SAFE_INTEGER,Wa.toString()}const Ya=new Map,el=s=>{if(Ya.has(s))return;const a=setTimeout(()=>{Ya.delete(s),$t({type:"REMOVE_TOAST",toastId:s})},Hx);Ya.set(s,a)},Kx=(s,a)=>{switch(a.type){case"ADD_TOAST":return{...s,toasts:[a.toast,...s.toasts].slice(0,qx)};case"UPDATE_TOAST":return{...s,toasts:s.toasts.map(t=>t.id===a.toast.id?{...t,...a.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=a;return t?el(t):s.toasts.forEach(l=>{el(l.id)}),{...s,toasts:s.toasts.map(l=>l.id===t||t===void 0?{...l,open:!1}:l)}}case"REMOVE_TOAST":return a.toastId===void 0?{...s,toasts:[]}:{...s,toasts:s.toasts.filter(t=>t.id!==a.toastId)}}},oa=[];let ca={toasts:[]};function $t(s){ca=Kx(ca,s),oa.forEach(a=>{a(ca)})}function Bx({...s}){const a=Ux(),t=n=>$t({type:"UPDATE_TOAST",toast:{...n,id:a}}),l=()=>$t({type:"DISMISS_TOAST",toastId:a});return $t({type:"ADD_TOAST",toast:{...s,id:a,open:!0,onOpenChange:n=>{n||l()}}}),{id:a,dismiss:l,update:t}}function Ar(){const[s,a]=m.useState(ca);return m.useEffect(()=>(oa.push(a),()=>{const t=oa.indexOf(a);t>-1&&oa.splice(t,1)}),[s]),{...s,toast:Bx,dismiss:t=>$t({type:"DISMISS_TOAST",toastId:t})}}function Gx({open:s,onOpenChange:a,table:t}){const{t:l}=V("user"),{toast:n}=Ar(),[o,r]=m.useState(!1),[c,u]=m.useState(""),[i,d]=m.useState(""),h=async()=>{if(!c||!i){n({title:l("messages.error"),description:l("messages.send_mail.required_fields"),variant:"destructive"});return}try{r(!0),await ws.sendMail({subject:c,content:i,filter:t.getState().columnFilters,sort:t.getState().sorting[0]?.id,sort_type:t.getState().sorting[0]?.desc?"DESC":"ASC"}),n({title:l("messages.success"),description:l("messages.send_mail.success")}),a(!1),u(""),d("")}catch{n({title:l("messages.error"),description:l("messages.send_mail.failed"),variant:"destructive"})}finally{r(!1)}};return e.jsx(pe,{open:s,onOpenChange:a,children:e.jsxs(ue,{className:"sm:max-w-[500px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:l("send_mail.title")}),e.jsx(Le,{children:l("send_mail.description")})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"subject",className:"text-right",children:l("send_mail.subject")}),e.jsx(D,{id:"subject",value:c,onChange:_=>u(_.target.value),className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"content",className:"text-right",children:l("send_mail.content")}),e.jsx(Ts,{id:"content",value:i,onChange:_=>d(_.target.value),className:"col-span-3",rows:6})]})]}),e.jsx(Re,{children:e.jsx(G,{type:"submit",onClick:h,disabled:o,children:l(o?"send_mail.sending":"send_mail.send")})})]})})}const Wx=x.object({email_prefix:x.string().optional(),email_suffix:x.string().min(1),password:x.string().optional(),expired_at:x.number().optional().nullable(),plan_id:x.number().nullable(),generate_count:x.number().optional().nullable(),download_csv:x.boolean().optional()}).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"]}),Yx={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0,download_csv:!1};function Jx({refetch:s}){const{t:a}=V("user"),[t,l]=m.useState(!1),n=ye({resolver:_e(Wx),defaultValues:Yx,mode:"onChange"}),[o,r]=m.useState([]);return m.useEffect(()=>{t&&es.getList().then(({data:c})=>{c&&r(c)})},[t]),e.jsxs(pe,{open:t,onOpenChange:l,children:[e.jsx(rs,{asChild:!0,children:e.jsxs(G,{size:"sm",variant:"outline",className:"gap-0 space-x-2",children:[e.jsx(ze,{icon:"ion:add"}),e.jsx("div",{children:a("generate.button")})]})}),e.jsxs(ue,{className:"sm:max-w-[425px]",children:[e.jsxs(ve,{children:[e.jsx(ge,{children:a("generate.title")}),e.jsx(Le,{})]}),e.jsxs(we,{...n,children:[e.jsxs(f,{children:[e.jsx(j,{children:a("generate.form.email")}),e.jsxs("div",{className:"flex",children:[!n.watch("generate_count")&&e.jsx(v,{control:n.control,name:"email_prefix",render:({field:c})=>e.jsx(D,{className:"flex-[5] rounded-r-none",placeholder:a("generate.form.email_prefix"),...c})}),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(v,{control:n.control,name:"email_suffix",render:({field:c})=>e.jsx(D,{className:"flex-[4] rounded-l-none",placeholder:a("generate.form.email_domain"),...c})})]})]}),e.jsx(v,{control:n.control,name:"password",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:a("generate.form.password")}),e.jsx(D,{placeholder:a("generate.form.password_placeholder"),...c}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"expired_at",render:({field:c})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(j,{children:a("generate.form.expire_time")}),e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsx(b,{children:e.jsxs(G,{variant:"outline",className:y("w-full pl-3 text-left font-normal",!c.value&&"text-muted-foreground"),children:[c.value?Ce(c.value):e.jsx("span",{children:a("generate.form.expire_time_placeholder")}),e.jsx(Kt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(bs,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(Pc,{asChild:!0,children:e.jsx(G,{variant:"outline",className:"w-full",onClick:()=>{c.onChange(null)},children:a("generate.form.permanent")})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(rt,{mode:"single",selected:c.value?new Date(c.value*1e3):void 0,onSelect:u=>{u&&c.onChange(u?.getTime()/1e3)}})})]})]})]})}),e.jsx(v,{control:n.control,name:"plan_id",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:a("generate.form.subscription")}),e.jsx(b,{children:e.jsxs(X,{value:c.value?c.value.toString():"null",onValueChange:u=>c.onChange(u==="null"?null:parseInt(u)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:a("generate.form.subscription_none")})}),e.jsxs(J,{children:[e.jsx($,{value:"null",children:a("generate.form.subscription_none")}),o.map(u=>e.jsx($,{value:u.id.toString(),children:u.name},u.id))]})]})})]})}),!n.watch("email_prefix")&&e.jsx(v,{control:n.control,name:"generate_count",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:a("generate.form.generate_count")}),e.jsx(D,{type:"number",placeholder:a("generate.form.generate_count_placeholder"),value:c.value||"",onChange:u=>c.onChange(u.target.value?parseInt(u.target.value):null)})]})}),n.watch("generate_count")&&e.jsx(v,{control:n.control,name:"download_csv",render:({field:c})=>e.jsxs(f,{className:"flex cursor-pointer flex-row items-center space-x-2 space-y-0",children:[e.jsx(b,{children:e.jsx(Tn,{checked:c.value,onCheckedChange:c.onChange})}),e.jsx(j,{children:a("generate.form.download_csv")})]})})]}),e.jsxs(Re,{children:[e.jsx(G,{variant:"outline",onClick:()=>l(!1),children:a("generate.form.cancel")}),e.jsx(G,{onClick:()=>n.handleSubmit(async c=>{if(c.download_csv){const u=await ws.generate(c);if(u&&u instanceof Blob){const i=window.URL.createObjectURL(u),d=document.createElement("a");d.href=i,d.download=`users_${new Date().getTime()}.csv`,document.body.appendChild(d),d.click(),d.remove(),window.URL.revokeObjectURL(i),A.success(a("generate.form.success")),n.reset(),s(),l(!1)}}else{const{data:u}=await ws.generate(c);u&&(A.success(a("generate.form.success")),n.reset(),s(),l(!1))}})(),children:a("generate.form.submit")})]})]})]})}const qr=ol,Qx=cl,Xx=dl,Hr=m.forwardRef(({className:s,...a},t)=>e.jsx(ja,{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),...a,ref:t}));Hr.displayName=ja.displayName;const Zx=Zs("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"}}),Dn=m.forwardRef(({side:s="right",className:a,children:t,...l},n)=>e.jsxs(Xx,{children:[e.jsx(Hr,{}),e.jsxs(va,{ref:n,className:y(Zx({side:s}),a),...l,children:[e.jsxs(mn,{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(ds,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),t]})]}));Dn.displayName=va.displayName;const Pn=({className:s,...a})=>e.jsx("div",{className:y("flex flex-col space-y-2 text-center sm:text-left",s),...a});Pn.displayName="SheetHeader";const Ur=({className:s,...a})=>e.jsx("div",{className:y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...a});Ur.displayName="SheetFooter";const En=m.forwardRef(({className:s,...a},t)=>e.jsx(ba,{ref:t,className:y("text-lg font-semibold text-foreground",s),...a}));En.displayName=ba.displayName;const Rn=m.forwardRef(({className:s,...a},t)=>e.jsx(ya,{ref:t,className:y("text-sm text-muted-foreground",s),...a}));Rn.displayName=ya.displayName;function eh({table:s,refetch:a,permissionGroups:t=[],subscriptionPlans:l=[]}){const{t:n}=V("user"),{toast:o}=Ar(),r=s.getState().columnFilters.length>0,[c,u]=m.useState([]),[i,d]=m.useState(!1),[h,_]=m.useState(!1),[k,S]=m.useState(!1),[C,N]=m.useState(!1),g=async()=>{try{const W=await ws.dumpCSV({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),te=W;console.log(W);const q=new Blob([te],{type:"text/csv;charset=utf-8;"}),L=window.URL.createObjectURL(q),U=document.createElement("a");U.href=L,U.setAttribute("download",`users_${new Date().toISOString()}.csv`),document.body.appendChild(U),U.click(),U.remove(),window.URL.revokeObjectURL(L),o({title:n("messages.success"),description:n("messages.export.success")})}catch{o({title:n("messages.error"),description:n("messages.export.failed"),variant:"destructive"})}},T=async()=>{try{N(!0),await ws.batchBan({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),o({title:n("messages.success"),description:n("messages.batch_ban.success")}),a()}catch{o({title:n("messages.error"),description:n("messages.batch_ban.failed"),variant:"destructive"})}finally{N(!1),S(!1)}},R=[{label:n("filter.fields.email"),value:"email",type:"text",operators:[{label:n("filter.operators.contains"),value:"contains"},{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.id"),value:"id",type:"number",operators:[{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.plan_id"),value:"plan_id",type:"select",operators:[{label:n("filter.operators.eq"),value:"eq"}],useOptions:!0},{label:n("filter.fields.transfer_enable"),value:"transfer_enable",type:"number",unit:"GB",operators:[{label:n("filter.operators.gt"),value:"gt"},{label:n("filter.operators.lt"),value:"lt"},{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.total_used"),value:"total_used",type:"number",unit:"GB",operators:[{label:n("filter.operators.gt"),value:"gt"},{label:n("filter.operators.lt"),value:"lt"},{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.online_count"),value:"online_count",type:"number",operators:[{label:n("filter.operators.eq"),value:"eq"},{label:n("filter.operators.gt"),value:"gt"},{label:n("filter.operators.lt"),value:"lt"}]},{label:n("filter.fields.expired_at"),value:"expired_at",type:"date",operators:[{label:n("filter.operators.lt"),value:"lt"},{label:n("filter.operators.gt"),value:"gt"},{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.uuid"),value:"uuid",type:"text",operators:[{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.token"),value:"token",type:"text",operators:[{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.banned"),value:"banned",type:"select",operators:[{label:n("filter.operators.eq"),value:"eq"}],options:[{label:n("filter.status.normal"),value:"0"},{label:n("filter.status.banned"),value:"1"}]},{label:n("filter.fields.remark"),value:"remarks",type:"text",operators:[{label:n("filter.operators.contains"),value:"contains"},{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.inviter_email"),value:"invite_user.email",type:"text",operators:[{label:n("filter.operators.contains"),value:"contains"},{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.invite_user_id"),value:"invite_user_id",type:"number",operators:[{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.is_admin"),value:"is_admin",type:"boolean",operators:[{label:n("filter.operators.eq"),value:"eq"}]},{label:n("filter.fields.is_staff"),value:"is_staff",type:"boolean",operators:[{label:n("filter.operators.eq"),value:"eq"}]}],p=W=>W*1024*1024*1024,w=W=>W/(1024*1024*1024),I=()=>{u([...c,{field:"",operator:"",value:""}])},H=W=>{u(c.filter((te,q)=>q!==W))},O=(W,te,q)=>{const L=[...c];if(L[W]={...L[W],[te]:q},te==="field"){const U=R.find(ms=>ms.value===q);U&&(L[W].operator=U.operators[0].value,L[W].value=U.type==="boolean"?!1:"")}u(L)},K=(W,te)=>{const q=R.find(L=>L.value===W.field);if(!q)return null;switch(q.type){case"text":return e.jsx(D,{placeholder:n("filter.sheet.value"),value:W.value,onChange:L=>O(te,"value",L.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{type:"number",placeholder:n("filter.sheet.value_number",{unit:q.unit}),value:q.unit==="GB"?w(W.value||0):W.value,onChange:L=>{const U=Number(L.target.value);O(te,"value",q.unit==="GB"?p(U):U)}}),q.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:q.unit})]});case"date":return e.jsx(rt,{mode:"single",selected:W.value,onSelect:L=>O(te,"value",L),className:"flex flex-1 justify-center rounded-md border"});case"select":return e.jsxs(X,{value:W.value,onValueChange:L=>O(te,"value",L),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:n("filter.sheet.value")})}),e.jsx(J,{children:q.useOptions?l.map(L=>e.jsx($,{value:L.value.toString(),children:L.label},L.value)):q.options?.map(L=>e.jsx($,{value:L.value.toString(),children:L.label},L.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ee,{checked:W.value,onCheckedChange:L=>O(te,"value",L)}),e.jsx(xa,{children:W.value?n("filter.boolean.true"):n("filter.boolean.false")})]});default:return null}},oe=()=>{const W=c.filter(te=>te.field&&te.operator&&te.value!=="").map(te=>{const q=R.find(U=>U.value===te.field);let L=te.value;return te.operator==="contains"?{id:te.field,value:L}:(q?.type==="date"&&L instanceof Date&&(L=Math.floor(L.getTime()/1e3)),q?.type==="boolean"&&(L=L?1:0),{id:te.field,value:`${te.operator}:${L}`})});s.setColumnFilters(W),d(!1)};return e.jsxs("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(Jx,{refetch:a}),e.jsx(D,{placeholder:n("filter.email_search"),value:s.getColumn("email")?.getFilterValue()??"",onChange:W=>s.getColumn("email")?.setFilterValue(W.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(qr,{open:i,onOpenChange:d,children:[e.jsx(Qx,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Ec,{className:"mr-2 h-4 w-4"}),n("filter.advanced"),c.length>0&&e.jsx(B,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:c.length})]})}),e.jsxs(Dn,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(Pn,{children:[e.jsx(En,{children:n("filter.sheet.title")}),e.jsx(Rn,{children:n("filter.sheet.description")})]}),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:n("filter.sheet.conditions")}),e.jsx(E,{variant:"outline",size:"sm",onClick:I,children:n("filter.sheet.add")})]}),e.jsx(Nt,{className:"h-[calc(100vh-280px)] ",children:e.jsx("div",{className:"space-y-4",children:c.map((W,te)=>e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(xa,{children:n("filter.sheet.condition",{number:te+1})}),e.jsx(E,{variant:"ghost",size:"sm",onClick:()=>H(te),children:e.jsx(ds,{className:"h-4 w-4"})})]}),e.jsxs(X,{value:W.field,onValueChange:q=>O(te,"field",q),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:n("filter.sheet.field")})}),e.jsx(J,{children:e.jsx(Be,{children:R.map(q=>e.jsx($,{value:q.value,className:"cursor-pointer",children:q.label},q.value))})})]}),W.field&&e.jsxs(X,{value:W.operator,onValueChange:q=>O(te,"operator",q),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:n("filter.sheet.operator")})}),e.jsx(J,{children:R.find(q=>q.value===W.field)?.operators.map(q=>e.jsx($,{value:q.value,children:q.label},q.value))})]}),W.field&&W.operator&&K(W,te)]},te))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(E,{variant:"outline",onClick:()=>{u([]),d(!1)},children:n("filter.sheet.reset")}),e.jsx(E,{onClick:oe,children:n("filter.sheet.apply")})]})]})]})]}),r&&e.jsxs(E,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),u([])},className:"h-8 px-2 lg:px-3",children:[n("filter.sheet.reset"),e.jsx(ds,{className:"ml-2 h-4 w-4"})]}),e.jsxs(Es,{modal:!1,children:[e.jsx(Rs,{asChild:!0,children:e.jsx(E,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:n("actions.title")})}),e.jsxs(Cs,{children:[e.jsx(Ne,{onClick:()=>_(!0),children:n("actions.send_email")}),e.jsx(Ne,{onClick:g,children:n("actions.export_csv")}),e.jsx(yt,{}),e.jsx(Ne,{onClick:()=>S(!0),className:"text-red-600 focus:text-red-600",children:n("actions.batch_ban")})]})]})]}),e.jsx(Gx,{open:h,onOpenChange:_,table:s}),e.jsx(Cn,{open:k,onOpenChange:S,children:e.jsxs(Ta,{children:[e.jsxs(Da,{children:[e.jsx(Ea,{children:n("actions.confirm_ban.title")}),e.jsx(Ra,{children:n(r?"actions.confirm_ban.filtered_description":"actions.confirm_ban.all_description")})]}),e.jsxs(Pa,{children:[e.jsx(La,{disabled:C,children:n("actions.confirm_ban.cancel")}),e.jsx(Ia,{onClick:T,disabled:C,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:n(C?"actions.confirm_ban.banning":"actions.confirm_ban.confirm")})]})]})})]})}const Kr=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"})}),Br=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"})}),sh=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"})}),th=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"})}),Ja=[{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:Yc(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Kr,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:Oe(s.original.u)})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Br,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:Oe(s.original.d)})]})},{accessorKey:"server_rate",header:"倍率",cell:({row:s})=>{const a=s.original.server_rate;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(B,{variant:"outline",className:"font-mono",children:[a,"x"]})})}},{id:"total",header:"总计",cell:({row:s})=>{const a=s.original.u+s.original.d;return e.jsx("div",{className:"flex items-center justify-end font-mono text-sm",children:Oe(a)})}}];function Gr({user_id:s,dialogTrigger:a}){const{t}=V(["traffic"]),[l,n]=m.useState(!1),[o,r]=m.useState({pageIndex:0,pageSize:20}),{data:c,isLoading:u}=ne({queryKey:["userStats",s,o,l],queryFn:()=>l?ws.getStats({user_id:s,pageSize:o.pageSize,page:o.pageIndex+1}):null}),i=Je({data:c?.data??[],columns:Ja,pageCount:Math.ceil((c?.total??0)/o.pageSize),state:{pagination:o},manualPagination:!0,getCoreRowModel:Qe(),onPaginationChange:r});return e.jsxs(pe,{open:l,onOpenChange:n,children:[e.jsx(rs,{asChild:!0,children:a}),e.jsxs(ue,{className:"sm:max-w-[700px]",children:[e.jsx(ve,{children:e.jsx(ge,{children:t("trafficRecord.title")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(bn,{children:[e.jsx(yn,{children:i.getHeaderGroups().map(d=>e.jsx(As,{children:d.headers.map(h=>e.jsx(_n,{className:y("h-10 px-2 text-xs",h.id==="total"&&"text-right"),children:h.isPlaceholder?null:da(h.column.columnDef.header,h.getContext())},h.id))},d.id))}),e.jsx(Nn,{children:u?Array.from({length:o.pageSize}).map((d,h)=>e.jsx(As,{children:Array.from({length:Ja.length}).map((_,k)=>e.jsx(jt,{className:"p-2",children:e.jsx(ce,{className:"h-6 w-full"})},k))},h)):i.getRowModel().rows?.length?i.getRowModel().rows.map(d=>e.jsx(As,{"data-state":d.getIsSelected()&&"selected",className:"h-10",children:d.getVisibleCells().map(h=>e.jsx(jt,{className:"px-2",children:da(h.column.columnDef.cell,h.getContext())},h.id))},d.id)):e.jsx(As,{children:e.jsx(jt,{colSpan:Ja.length,className:"h-24 text-center",children:t("trafficRecord.noRecords")})})})]})}),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:t("trafficRecord.perPage")}),e.jsxs(X,{value:`${i.getState().pagination.pageSize}`,onValueChange:d=>{i.setPageSize(Number(d))},children:[e.jsx(Y,{className:"h-8 w-[70px]",children:e.jsx(Z,{placeholder:i.getState().pagination.pageSize})}),e.jsx(J,{side:"top",children:[10,20,30,40,50].map(d=>e.jsx($,{value:`${d}`,children:d},d))})]}),e.jsx("p",{className:"text-sm font-medium",children:t("trafficRecord.records")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"flex w-[100px] items-center justify-center text-sm",children:t("trafficRecord.page",{current:i.getState().pagination.pageIndex+1,total:i.getPageCount()})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>i.previousPage(),disabled:!i.getCanPreviousPage()||u,children:e.jsx(sh,{className:"h-4 w-4"})}),e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>i.nextPage(),disabled:!i.getCanNextPage()||u,children:e.jsx(th,{className:"h-4 w-4"})})]})]})]})]})]})]})}function ah({onConfirm:s,children:a,title:t="确认操作",description:l="确定要执行此操作吗?",cancelText:n="取消",confirmText:o="确认",variant:r="default",className:c}){return e.jsxs(Cn,{children:[e.jsx(Tr,{asChild:!0,children:a}),e.jsxs(Ta,{className:y("sm:max-w-[425px]",c),children:[e.jsxs(Da,{children:[e.jsx(Ea,{children:t}),e.jsx(Ra,{children:l})]}),e.jsxs(Pa,{children:[e.jsx(La,{asChild:!0,children:e.jsx(E,{variant:"outline",children:n})}),e.jsx(Ia,{asChild:!0,children:e.jsx(E,{variant:r,onClick:s,children:o})})]})]})]})}const nh=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"})}),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:"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"})}),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:"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"})}),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:"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"})}),oh=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"})}),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:"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"})}),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:"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"})}),mh=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:"M20 6h-4V5a3 3 0 0 0-3-3h-2a3 3 0 0 0-3 3v1H4a1 1 0 0 0 0 2h1v11a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V8h1a1 1 0 0 0 0-2M10 5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1h-4Zm7 14a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V8h10Z"})}),uh=(s,a,t,l)=>{const{t:n}=V("user");return[{accessorKey:"is_admin",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.is_admin")}),enableSorting:!1,enableHiding:!0,filterFn:(o,r,c)=>c.includes(o.getValue(r)),size:0},{accessorKey:"is_staff",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.is_staff")}),enableSorting:!1,enableHiding:!0,filterFn:(o,r,c)=>c.includes(o.getValue(r)),size:0},{accessorKey:"id",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.id")}),cell:({row:o})=>e.jsx(B,{variant:"outline",children:o.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.email")}),cell:({row:o})=>{const r=o.original.t||0,c=Date.now()/1e3-r<120,u=Math.floor(Date.now()/1e3-r);let i=c?n("columns.online_status.online"):r===0?n("columns.online_status.never"):n("columns.online_status.last_online",{time:Ce(r)});if(!c&&r!==0){const d=Math.floor(u/60),h=Math.floor(d/60),_=Math.floor(h/24);_>0?i+=` +`+n("columns.online_status.offline_duration.days",{count:_}):h>0?i+=` +`+n("columns.online_status.offline_duration.hours",{count:h}):d>0?i+=` +`+n("columns.online_status.offline_duration.minutes",{count:d}):i+=` +`+n("columns.online_status.offline_duration.seconds",{count:u})}return e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{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",c?"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:o.original.email})]})}),e.jsx(de,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:i})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.online_count")}),cell:({row:o})=>{const r=o.original.device_limit,c=o.original.online_count||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(B,{variant:"outline",className:y("min-w-[4rem] justify-center",r!==null&&c>=r?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[c," / ",r===null?"∞":r]})})}),e.jsx(de,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:r===null?n("columns.device_limit.unlimited"):n("columns.device_limit.limited",{count:r})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.status")}),cell:({row:o})=>{const r=o.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(B,{className:y("min-w-20 justify-center transition-colors",r?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:n(r?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(o,r,c)=>c.includes(o.getValue(r))},{accessorKey:"plan_id",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.subscription")}),cell:({row:o})=>e.jsx("div",{className:"min-w-[10em] break-all",children:o.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.group")}),cell:({row:o})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(B,{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:o.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.used_traffic")}),cell:({row:o})=>{const r=Oe(o.original?.total_used),c=Oe(o.original?.transfer_enable),u=o.original?.total_used/o.original?.transfer_enable*100||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{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:r}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:y("h-full rounded-full transition-all",u>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(u,100)}%`}})})]})}),e.jsx(de,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[n("columns.total_traffic"),": ",c]})})]})})}},{accessorKey:"transfer_enable",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.total_traffic")}),cell:({row:o})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:Oe(o.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.expire_time")}),cell:({row:o})=>{const r=o.original.expired_at,c=Date.now()/1e3,u=r!=null&&re.jsx(z,{column:o,title:n("columns.balance")}),cell:({row:o})=>{const r=pt(o.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:r})]})}},{accessorKey:"commission_balance",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.commission")}),cell:({row:o})=>{const r=pt(o.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:r})]})}},{accessorKey:"created_at",header:({column:o})=>e.jsx(z,{column:o,title:n("columns.register_time")}),cell:({row:o})=>e.jsx("div",{className:"truncate",children:Ce(o.original?.created_at)}),size:1e3},{id:"actions",header:({column:o})=>e.jsx(z,{column:o,className:"justify-end",title:n("columns.actions")}),cell:({row:o,table:r})=>e.jsxs(Es,{modal:!0,children:[e.jsx(Rs,{asChild:!0,children:e.jsx("div",{className:"text-center",children:e.jsx(G,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":n("columns.actions"),children:e.jsx(ua,{className:"size-4"})})})}),e.jsxs(Cs,{align:"end",className:"min-w-[40px]",children:[e.jsx(Ne,{onSelect:c=>{c.preventDefault(),t(o.original),l(!0)},className:"p-0",children:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(nh,{className:"mr-2"}),n("columns.actions_menu.edit")]})}),e.jsx(Ne,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(Or,{defaultValues:{email:o.original.email},trigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(lh,{className:"mr-2 "}),n("columns.actions_menu.assign_order")]})})}),e.jsx(Ne,{onSelect:()=>{ha(o.original.subscribe_url).then(()=>{A.success(n("common:copy.success"))})},className:"p-0",children:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(rh,{className:"mr-2"}),n("columns.actions_menu.copy_url")]})}),e.jsx(Ne,{onSelect:()=>{ws.resetSecret(o.original.id).then(({data:c})=>{c&&A.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(ih,{className:"mr-2 "}),n("columns.actions_menu.reset_secret")]})}),e.jsx(Ne,{onSelect:()=>{},className:"p-0",children:e.jsxs(st,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=eq:${o.original?.id}`,children:[e.jsx(oh,{className:"mr-2"}),n("columns.actions_menu.orders")]})}),e.jsx(Ne,{onSelect:()=>{r.setColumnFilters([{id:"invite_user_id",value:"eq:"+o.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(ch,{className:"mr-2 "}),n("columns.actions_menu.invites")]})}),e.jsx(Ne,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(Gr,{user_id:o.original?.id,dialogTrigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(dh,{className:"mr-2 "}),n("columns.actions_menu.traffic_records")]})})}),e.jsx(Ne,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(ah,{title:n("columns.actions_menu.delete_confirm_title"),description:n("columns.actions_menu.delete_confirm_description",{email:o.original.email}),cancelText:n("common:cancel"),confirmText:n("common:confirm"),variant:"destructive",onConfirm:async()=>{try{const{data:c}=await ws.destroy(o.original.id);c&&(A.success(n("common:delete.success")),s())}catch{A.error(n("common:delete.failed"))}},children:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5 text-destructive hover:text-destructive",children:[e.jsx(mh,{className:"mr-2"}),n("columns.actions_menu.delete")]})})})]})]})}]},Wr=m.createContext(void 0),In=()=>{const s=m.useContext(Wr);if(!s)throw new Error("useUserEdit must be used within an UserEditProvider");return s},Yr=({children:s,refreshData:a})=>{const[t,l]=m.useState(!1),[n,o]=m.useState(null),r={isOpen:t,setIsOpen:l,editingUser:n,setEditingUser:o,refreshData:a};return e.jsx(Wr.Provider,{value:r,children:s})},xh=x.object({id:x.number(),email:x.string().email(),invite_user_email:x.string().email().nullable().optional(),password:x.string().optional().nullable(),balance:x.coerce.number(),commission_balance:x.coerce.number(),u:x.number(),d:x.number(),transfer_enable:x.number(),expired_at:x.number().nullable(),plan_id:x.number().nullable(),banned:x.number(),commission_type:x.number(),commission_rate:x.number().nullable(),discount:x.number().nullable(),speed_limit:x.number().nullable(),device_limit:x.number().nullable(),is_admin:x.number(),is_staff:x.number(),remarks:x.string().nullable()});function Jr(){const{t:s}=V("user"),{isOpen:a,setIsOpen:t,editingUser:l,refreshData:n}=In(),[o,r]=m.useState(!1),[c,u]=m.useState([]),i=ye({resolver:_e(xh),defaultValues:{id:0,email:"",invite_user_email:null,password:null,balance:0,commission_balance:0,u:0,d:0,transfer_enable:0,expired_at:null,plan_id:null,banned:0,commission_type:0,commission_rate:null,discount:null,speed_limit:null,device_limit:null,is_admin:0,is_staff:0,remarks:null}});return m.useEffect(()=>{a&&es.getList().then(({data:d})=>{u(d)})},[a]),m.useEffect(()=>{if(l){const d=l.invite_user?.email,{invite_user:h,..._}=l;i.reset({..._,invite_user_email:d||null,password:null})}},[l,i]),e.jsx(qr,{open:a,onOpenChange:t,children:e.jsxs(Dn,{className:"max-w-[90%] space-y-4",children:[e.jsxs(Pn,{children:[e.jsx(En,{children:s("edit.title")}),e.jsx(Rn,{})]}),e.jsxs(we,{...i,children:[e.jsx(v,{control:i.control,name:"email",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.email")}),e.jsx(b,{children:e.jsx(D,{...d,placeholder:s("edit.form.email_placeholder")})}),e.jsx(P,{...d})]})}),e.jsx(v,{control:i.control,name:"invite_user_email",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.inviter_email")}),e.jsx(b,{children:e.jsx(D,{value:d.value||"",onChange:h=>d.onChange(h.target.value?h.target.value:null),placeholder:s("edit.form.inviter_email_placeholder")})}),e.jsx(P,{...d})]})}),e.jsx(v,{control:i.control,name:"password",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.password")}),e.jsx(b,{children:e.jsx(D,{type:"password",value:d.value||"",onChange:d.onChange,placeholder:s("edit.form.password_placeholder")})}),e.jsx(P,{...d})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(v,{control:i.control,name:"balance",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.balance")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:d.value||"",onChange:d.onChange,placeholder:s("edit.form.balance_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(P,{...d})]})}),e.jsx(v,{control:i.control,name:"commission_balance",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_balance")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:d.value||"",onChange:d.onChange,placeholder:s("edit.form.commission_balance_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(P,{...d})]})}),e.jsx(v,{control:i.control,name:"u",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.upload")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{value:d.value/1024/1024/1024||"",onChange:h=>d.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.upload_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(P,{...d})]})}),e.jsx(v,{control:i.control,name:"d",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.download")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:d.value/1024/1024/1024||"",onChange:h=>d.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.download_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(P,{...d})]})})]}),e.jsx(v,{control:i.control,name:"transfer_enable",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.total_traffic")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:d.value/1024/1024/1024||"",onChange:h=>d.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.total_traffic_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(P,{})]})}),e.jsx(v,{control:i.control,name:"expired_at",render:({field:d})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(j,{children:s("edit.form.expire_time")}),e.jsxs(Ss,{open:o,onOpenChange:r,children:[e.jsx(ks,{asChild:!0,children:e.jsx(b,{children:e.jsxs(E,{type:"button",variant:"outline",className:y("w-full pl-3 text-left font-normal",!d.value&&"text-muted-foreground"),onClick:()=>r(!0),children:[d.value?Ce(d.value):e.jsx("span",{children:s("edit.form.expire_time_placeholder")}),e.jsx(Kt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(bs,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:h=>{h.preventDefault()},onEscapeKeyDown:h=>{h.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(E,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{d.onChange(null),r(!1)},children:s("edit.form.expire_time_permanent")}),e.jsx(E,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const h=new Date;h.setMonth(h.getMonth()+1),h.setHours(23,59,59,999),d.onChange(Math.floor(h.getTime()/1e3)),r(!1)},children:s("edit.form.expire_time_1month")}),e.jsx(E,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const h=new Date;h.setMonth(h.getMonth()+3),h.setHours(23,59,59,999),d.onChange(Math.floor(h.getTime()/1e3)),r(!1)},children:s("edit.form.expire_time_3months")})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(rt,{mode:"single",selected:d.value?new Date(d.value*1e3):void 0,onSelect:h=>{if(h){const _=new Date(d.value?d.value*1e3:Date.now());h.setHours(_.getHours(),_.getMinutes(),_.getSeconds()),d.onChange(Math.floor(h.getTime()/1e3))}},disabled:h=>h{const h=new Date;h.setHours(23,59,59,999),d.onChange(Math.floor(h.getTime()/1e3))},className:"h-6 px-2 text-xs",children:s("edit.form.expire_time_today")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{type:"datetime-local",step:"1",value:Ce(d.value,"YYYY-MM-DDTHH:mm:ss"),onChange:h=>{const _=new Date(h.target.value);isNaN(_.getTime())||d.onChange(Math.floor(_.getTime()/1e3))},className:"flex-1"}),e.jsx(E,{type:"button",variant:"outline",onClick:()=>r(!1),children:s("edit.form.expire_time_confirm")})]})]})]})})]}),e.jsx(P,{})]})}),e.jsx(v,{control:i.control,name:"plan_id",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.subscription")}),e.jsx(b,{children:e.jsxs(X,{value:d.value!==null?String(d.value):"null",onValueChange:h=>d.onChange(h==="null"?null:parseInt(h)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(J,{children:[e.jsx($,{value:"null",children:s("edit.form.subscription_none")}),c.map(h=>e.jsx($,{value:String(h.id),children:h.name},h.id))]})]})})]})}),e.jsx(v,{control:i.control,name:"banned",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.account_status")}),e.jsx(b,{children:e.jsxs(X,{value:d.value.toString(),onValueChange:h=>d.onChange(parseInt(h)),children:[e.jsx(Y,{children:e.jsx(Z,{})}),e.jsxs(J,{children:[e.jsx($,{value:"1",children:s("columns.status_text.banned")}),e.jsx($,{value:"0",children:s("columns.status_text.normal")})]})]})})]})}),e.jsx(v,{control:i.control,name:"commission_type",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_type")}),e.jsx(b,{children:e.jsxs(X,{value:d.value.toString(),onValueChange:h=>d.onChange(parseInt(h)),children:[e.jsx(Y,{children:e.jsx(Z,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(J,{children:[e.jsx($,{value:"0",children:s("edit.form.commission_type_system")}),e.jsx($,{value:"1",children:s("edit.form.commission_type_cycle")}),e.jsx($,{value:"2",children:s("edit.form.commission_type_onetime")})]})]})})]})}),e.jsx(v,{control:i.control,name:"commission_rate",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_rate")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:d.value||"",onChange:h=>d.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.commission_rate_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(v,{control:i.control,name:"discount",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.discount")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:d.value||"",onChange:h=>d.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.discount_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(P,{})]})}),e.jsx(v,{control:i.control,name:"speed_limit",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.speed_limit")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:d.value||"",onChange:h=>d.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.speed_limit_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(P,{})]})}),e.jsx(v,{control:i.control,name:"device_limit",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.device_limit")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:d.value||"",onChange:h=>d.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.device_limit_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(P,{})]})}),e.jsx(v,{control:i.control,name:"is_admin",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.is_admin")}),e.jsx("div",{className:"py-2",children:e.jsx(b,{children:e.jsx(ee,{checked:d.value===1,onCheckedChange:h=>d.onChange(h?1:0)})})})]})}),e.jsx(v,{control:i.control,name:"is_staff",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.is_staff")}),e.jsx("div",{className:"py-2",children:e.jsx(b,{children:e.jsx(ee,{checked:d.value===1,onCheckedChange:h=>d.onChange(h?1:0)})})})]})}),e.jsx(v,{control:i.control,name:"remarks",render:({field:d})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.remarks")}),e.jsx(b,{children:e.jsx(Ts,{className:"h-24",value:d.value||"",onChange:h=>d.onChange(h.currentTarget.value??null),placeholder:s("edit.form.remarks_placeholder")})}),e.jsx(P,{})]})}),e.jsxs(Ur,{children:[e.jsx(E,{variant:"outline",onClick:()=>t(!1),children:s("edit.form.cancel")}),e.jsx(E,{type:"submit",onClick:()=>{i.handleSubmit(d=>{ws.update(d).then(({data:h})=>{h&&(A.success(s("edit.form.success")),t(!1),n())})})()},children:s("edit.form.submit")})]})]})]})})}function hh(){const[s]=tr(),[a,t]=m.useState({}),[l,n]=m.useState({is_admin:!1,is_staff:!1}),[o,r]=m.useState([]),[c,u]=m.useState([]),[i,d]=m.useState({pageIndex:0,pageSize:20});m.useEffect(()=>{const p=s.get("email");p&&r(w=>w.some(H=>H.id==="email")?w:[...w,{id:"email",value:p}])},[s]);const{refetch:h,data:_,isLoading:k}=ne({queryKey:["userList",i,o,c],queryFn:()=>ws.getList({pageSize:i.pageSize,current:i.pageIndex+1,filter:o,sort:c})}),[S,C]=m.useState([]),[N,g]=m.useState([]);m.useEffect(()=>{at.getList().then(({data:p})=>{C(p)}),es.getList().then(({data:p})=>{g(p)})},[]);const T=S.map(p=>({label:p.name,value:p.id})),R=N.map(p=>({label:p.name,value:p.id}));return e.jsxs(Yr,{refreshData:h,children:[e.jsx(ph,{data:_?.data??[],rowCount:_?.total??0,sorting:c,setSorting:u,columnVisibility:l,setColumnVisibility:n,rowSelection:a,setRowSelection:t,columnFilters:o,setColumnFilters:r,pagination:i,setPagination:d,refetch:h,serverGroupList:S,permissionGroups:T,subscriptionPlans:R}),e.jsx(Jr,{})]})}function ph({data:s,rowCount:a,sorting:t,setSorting:l,columnVisibility:n,setColumnVisibility:o,rowSelection:r,setRowSelection:c,columnFilters:u,setColumnFilters:i,pagination:d,setPagination:h,refetch:_,serverGroupList:k,permissionGroups:S,subscriptionPlans:C}){const{setIsOpen:N,setEditingUser:g}=In(),T=Je({data:s,columns:uh(_,k,g,N),state:{sorting:t,columnVisibility:n,rowSelection:r,columnFilters:u,pagination:d},rowCount:a,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:c,onSortingChange:l,onColumnFiltersChange:i,onColumnVisibilityChange:o,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),onPaginationChange:h,getSortedRowModel:vs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Vs(),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.jsxs("div",{className:"space-y-4",children:[e.jsx(eh,{table:T,refetch:_,serverGroupList:k,permissionGroups:S,subscriptionPlans:C}),e.jsx(is,{table:T})]})}function gh(){const{t:s}=V("user");return e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("manage.title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("manage.description")})]})}),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(hh,{})})})]})]})}const fh=Object.freeze(Object.defineProperty({__proto__:null,default:gh},Symbol.toStringTag,{value:"Module"}));function jh({column:s,title:a,options:t}){const l=new Set(s?.getFilterValue());return e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsxs(G,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Rc,{className:"mr-2 h-4 w-4"}),a,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(B,{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(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):t.filter(n=>l.has(n.value)).map(n=>e.jsx(B,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:n.label},`selected-${n.value}`))})]})]})}),e.jsx(bs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Us,{children:[e.jsx(nt,{placeholder:a}),e.jsxs(Ks,{children:[e.jsx(lt,{children:"No results found."}),e.jsx(as,{children:t.map(n=>{const o=l.has(n.value);return e.jsxs($e,{onSelect:()=>{o?l.delete(n.value):l.add(n.value);const r=Array.from(l);s?.setFilterValue(r.length?r: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(Ic,{className:y("h-4 w-4")})}),n.icon&&e.jsx(n.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:n.label})]},`option-${n.value}`)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(St,{}),e.jsx(as,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const vh=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 bh({table:s}){const{t:a}=V("ticket");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(Bt,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(Ct,{className:"grid w-full grid-cols-2",children:[e.jsx(Ee,{value:"0",children:a("status.pending")}),e.jsx(Ee,{value:"1",children:a("status.closed")})]})}),s.getColumn("level")&&e.jsx(jh,{column:s.getColumn("level"),title:a("columns.level"),options:[{label:a("level.low"),value:qe.LOW,icon:vh,color:"gray"},{label:a("level.medium"),value:qe.MIDDLE,icon:Kr,color:"yellow"},{label:a("level.high"),value:qe.HIGH,icon:Br,color:"red"}]})]})})}function yh(){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 Nh=Zs("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"}}),Qr=m.forwardRef(({className:s,variant:a,layout:t,children:l,...n},o)=>e.jsx("div",{className:y(Nh({variant:a,layout:t,className:s}),"relative group"),ref:o,...n,children:m.Children.map(l,r=>m.isValidElement(r)&&typeof r.type!="string"?m.cloneElement(r,{variant:a,layout:t}):r)}));Qr.displayName="ChatBubble";const _h=Zs("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"}}),Xr=m.forwardRef(({className:s,variant:a,layout:t,isLoading:l=!1,children:n,...o},r)=>e.jsx("div",{className:y(_h({variant:a,layout:t,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:r,...o,children:l?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(yh,{})}):n}));Xr.displayName="ChatBubbleMessage";const wh=m.forwardRef(({variant:s,className:a,children:t,...l},n)=>e.jsx("div",{ref:n,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",a),...l,children:t}));wh.displayName="ChatBubbleActionWrapper";const Zr=m.forwardRef(({className:s,...a},t)=>e.jsx(Ts,{autoComplete:"off",ref:t,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),...a}));Zr.displayName="ChatInput";const ei=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"})}),si=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"})}),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:"m11.29 12l3.54-3.54a1 1 0 0 0 0-1.41a1 1 0 0 0-1.42 0l-4.24 4.24a1 1 0 0 0 0 1.42L13.41 17a1 1 0 0 0 .71.29a1 1 0 0 0 .71-.29a1 1 0 0 0 0-1.41Z"})}),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:"M21.71 20.29L18 16.61A9 9 0 1 0 16.61 18l3.68 3.68a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.39M11 18a7 7 0 1 1 7-7a7 7 0 0 1-7 7"})}),Sh=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"})}),kh=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 Th(){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(ce,{className:"h-8 w-3/4"}),e.jsx(ce,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(ce,{className:"h-20 w-2/3"},s))})]})}function Dh(){return e.jsx("div",{className:"space-y-4 p-4",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"h-5 w-4/5"}),e.jsx(ce,{className:"h-4 w-2/3"}),e.jsx(ce,{className:"h-3 w-1/2"})]},s))})}function Ph({ticket:s,isActive:a,onClick:t}){const{t:l}=V("ticket"),n=o=>{switch(o){case qe.HIGH:return"bg-red-50 text-red-600 border-red-200";case qe.MIDDLE:return"bg-yellow-50 text-yellow-600 border-yellow-200";case qe.LOW:return"bg-green-50 text-green-600 border-green-200";default:return"bg-gray-50 text-gray-600 border-gray-200"}};return e.jsxs("div",{className:y("flex cursor-pointer flex-col border-b p-4 hover:bg-accent/50",a&&"bg-accent"),onClick:t,children:[e.jsxs("div",{className:"flex max-w-[280px] items-center justify-between gap-2",children:[e.jsx("h4",{className:"flex-1 truncate font-medium",children:s.subject}),e.jsx(B,{variant:s.status===Hs.CLOSED?"secondary":"default",className:"shrink-0",children:s.status===Hs.CLOSED?l("status.closed"):l("status.processing")})]}),e.jsx("div",{className:"mt-1 max-w-[280px] truncate text-sm text-muted-foreground",children:s.user?.email}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[e.jsx("time",{className:"text-muted-foreground",children:Ce(s.updated_at)}),e.jsx("div",{className:y("rounded-full border px-2 py-0.5 text-xs font-medium",n(s.level)),children:l(`level.${s.level===qe.LOW?"low":s.level===qe.MIDDLE?"medium":"high"}`)})]})]})}function Eh({ticketId:s,dialogTrigger:a}){const{t}=V("ticket"),l=Is(),n=m.useRef(null),o=m.useRef(null),[r,c]=m.useState(!1),[u,i]=m.useState(""),[d,h]=m.useState(!1),[_,k]=m.useState(s),[S,C]=m.useState(""),[N,g]=m.useState(!1),{setIsOpen:T,setEditingUser:R}=In(),{data:p,isLoading:w,refetch:I}=ne({queryKey:["tickets",r],queryFn:()=>r?ft.getList({filter:[{id:"status",value:[Hs.OPENING]}]}):Promise.resolve(null),enabled:r}),{data:H,refetch:O,isLoading:K}=ne({queryKey:["ticket",_,r],queryFn:()=>r?ft.getInfo(_):Promise.resolve(null),refetchInterval:r?5e3:!1,retry:3}),oe=H?.data,te=(p?.data||[]).filter(le=>le.subject.toLowerCase().includes(S.toLowerCase())||le.user?.email.toLowerCase().includes(S.toLowerCase())),q=(le="smooth")=>{if(n.current){const{scrollHeight:ys,clientHeight:Fs}=n.current;n.current.scrollTo({top:ys-Fs,behavior:le})}};m.useEffect(()=>{if(!r)return;const le=requestAnimationFrame(()=>{q("instant"),setTimeout(()=>q(),1e3)});return()=>{cancelAnimationFrame(le)}},[r,oe?.messages]);const L=async()=>{const le=u.trim();!le||d||(h(!0),ft.reply({id:_,message:le}).then(()=>{i(""),O(),q(),setTimeout(()=>{o.current?.focus()},0)}).finally(()=>{h(!1)}))},U=async()=>{ft.close(_).then(()=>{A.success(t("actions.close_success")),O(),I()})},ms=()=>{oe?.user&&l("/finance/order?user_id="+oe.user.id)},De=oe?.status===Hs.CLOSED;return e.jsxs(pe,{open:r,onOpenChange:c,children:[e.jsx(rs,{asChild:!0,children:a??e.jsx(G,{variant:"outline",children:t("actions.view_ticket")})}),e.jsxs(ue,{className:"flex h-[90vh] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(ge,{}),e.jsxs("div",{className:"flex h-full",children:[e.jsx(G,{variant:"ghost",size:"icon",className:"absolute left-2 top-2 z-50 md:hidden",onClick:()=>g(!N),children:e.jsx(sl,{className:y("h-4 w-4 transition-transform",!N&&"rotate-180")})}),e.jsxs("div",{className:y("absolute inset-y-0 left-0 z-40 flex flex-col border-r bg-background transition-transform duration-200 ease-in-out md:relative",N?"-translate-x-full":"translate-x-0","w-80 md:w-80 md:translate-x-0"),children:[e.jsxs("div",{className:"space-y-4 border-b p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold",children:t("list.title")}),e.jsx(G,{variant:"ghost",size:"icon",className:"hidden h-8 w-8 md:flex",onClick:()=>g(!N),children:e.jsx(sl,{className:y("h-4 w-4 transition-transform",!N&&"rotate-180")})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ch,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"}),e.jsx(D,{placeholder:t("list.search_placeholder"),value:S,onChange:le=>C(le.target.value),className:"pl-8"})]})]}),e.jsx(Nt,{className:"flex-1",children:e.jsx("div",{className:"w-full",children:w?e.jsx(Dh,{}):te.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-4 text-muted-foreground",children:t(S?"list.no_search_results":"list.no_tickets")}):te.map(le=>e.jsx(Ph,{ticket:le,isActive:le.id===_,onClick:()=>{k(le.id),window.innerWidth<768&&g(!0)}},le.id))})})]}),e.jsxs("div",{className:"relative flex flex-1 flex-col",children:[!N&&e.jsx("div",{className:"absolute inset-0 z-30 bg-black/20 md:hidden",onClick:()=>g(!0)}),K?e.jsx(Th,{}):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:oe?.subject}),e.jsx(B,{variant:De?"secondary":"default",children:t(De?"status.closed":"status.processing")}),!De&&e.jsx(ns,{title:t("actions.close_confirm_title"),description:t("actions.close_confirm_description"),confirmText:t("actions.close_confirm_button"),variant:"destructive",onConfirm:U,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(ei,{className:"h-4 w-4"}),t("actions.close_ticket")]})})]}),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(Ut,{className:"h-4 w-4"}),e.jsx("span",{children:oe?.user?.email})]}),e.jsx(ke,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(si,{className:"h-4 w-4"}),e.jsxs("span",{children:[t("detail.created_at")," ",Ce(oe?.created_at)]})]}),e.jsx(ke,{orientation:"vertical",className:"h-4"}),e.jsx(B,{variant:"outline",children:oe?.level!=null&&t(`level.${oe.level===qe.LOW?"low":oe.level===qe.MIDDLE?"medium":"high"}`)})]})]}),oe?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.user_info"),onClick:()=>{R(oe.user),T(!0)},children:e.jsx(Ut,{className:"h-4 w-4"})}),e.jsx(Gr,{user_id:oe.user.id,dialogTrigger:e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.traffic_records"),children:e.jsx(Sh,{className:"h-4 w-4"})})}),e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.order_records"),onClick:ms,children:e.jsx(kh,{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:oe?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t("detail.no_messages")}):oe?.messages?.map(le=>e.jsx(Qr,{variant:le.is_from_admin?"sent":"received",className:le.is_from_admin?"ml-auto":"mr-auto",children:e.jsx(Xr,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:le.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:Ce(le.created_at)})})]})})},le.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(Zr,{ref:o,disabled:De||d,placeholder:t(De?"detail.input.closed_placeholder":"detail.input.reply_placeholder"),className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:u,onChange:le=>i(le.target.value),onKeyDown:le=>{le.key==="Enter"&&!le.shiftKey&&(le.preventDefault(),L())}}),e.jsx(G,{disabled:De||d||!u.trim(),onClick:L,children:t(d?"detail.input.sending":"detail.input.send")})]})})]})]})]})]})]})}const 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:"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"})}),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:"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"})}),Lh=s=>{const{t:a}=V("ticket");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.id")}),cell:({row:t})=>e.jsx(B,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.subject")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rh,{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(z,{column:t,title:a("columns.level")}),cell:({row:t})=>{const l=t.getValue("level"),n=l===qe.LOW?"default":l===qe.MIDDLE?"secondary":"destructive";return e.jsx(B,{variant:n,className:"whitespace-nowrap",children:a(`level.${l===qe.LOW?"low":l===qe.MIDDLE?"medium":"high"}`)})},filterFn:(t,l,n)=>n.includes(t.getValue(l))},{accessorKey:"status",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.status")}),cell:({row:t})=>{const l=t.getValue("status"),n=t.original.reply_status,o=l===Hs.CLOSED?a("status.closed"):a(n===0?"status.replied":"status.pending"),r=l===Hs.CLOSED?"default":n===0?"secondary":"destructive";return e.jsx(B,{variant:r,className:"whitespace-nowrap",children:o})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.updated_at")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(si,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:Ce(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(z,{column:t,title:a("columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:Ce(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:a("columns.actions")}),cell:({row:t})=>{const l=t.original.status!==Hs.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Eh,{ticketId:t.original.id,dialogTrigger:e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",title:a("actions.view_details"),children:e.jsx(Ih,{className:"h-4 w-4"})})}),l&&e.jsx(ns,{title:a("actions.close_confirm_title"),description:a("actions.close_confirm_description"),confirmText:a("actions.close_confirm_button"),variant:"destructive",onConfirm:async()=>{ft.close(t.original.id).then(()=>{A.success(a("actions.close_success")),s()})},children:e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",title:a("actions.close_ticket"),children:e.jsx(ei,{className:"h-4 w-4"})})})]})}}]};function Vh(){const[s,a]=m.useState({}),[t,l]=m.useState({}),[n,o]=m.useState([{id:"status",value:"0"}]),[r,c]=m.useState([]),[u,i]=m.useState({pageIndex:0,pageSize:20}),{refetch:d,data:h}=ne({queryKey:["orderList",u,n,r],queryFn:()=>ft.getList({pageSize:u.pageSize,current:u.pageIndex+1,filter:n,sort:r})}),_=Je({data:h?.data??[],columns:Lh(d),state:{sorting:r,columnVisibility:t,rowSelection:s,columnFilters:n,pagination:u},rowCount:h?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:c,onColumnFiltersChange:o,onColumnVisibilityChange:l,getCoreRowModel:Qe(),getFilteredRowModel:js(),getPaginationRowModel:ls(),onPaginationChange:i,getSortedRowModel:vs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Vs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(bh,{table:_,refetch:d}),e.jsx(is,{table:_,showPagination:!0})]})}function Fh(){const{t:s}=V("ticket");return e.jsxs(Yr,{refreshData:()=>{},children:[e.jsxs(Ve,{children:[e.jsxs(Fe,{children:[e.jsx(Xe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ue,{}),e.jsx(Ke,{})]})]}),e.jsxs(Ae,{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:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),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(Vh,{})})]})]}),e.jsx(Jr,{})]})}const Mh=Object.freeze(Object.defineProperty({__proto__:null,default:Fh},Symbol.toStringTag,{value:"Module"}));export{qh as a,$h as c,Ah as g,Hh as r}; diff --git a/public/assets/admin/assets/vendor.js b/public/assets/admin/assets/vendor.js index 3a53640..ce9309e 100644 --- a/public/assets/admin/assets/vendor.js +++ b/public/assets/admin/assets/vendor.js @@ -537,7 +537,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho - less than the value passed to \`max\` (or ${k5} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. -Defaulting to \`null\`.`}var mtt=fY,vtt=hY;function kHe(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function THe(e){const[t,n]=v.useState(void 0);return On(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,s;if("borderBoxSize"in o){const u=o.borderBoxSize,l=Array.isArray(u)?u[0]:u;a=l.inlineSize,s=l.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var T5="Switch",[MHe,ytt]=Di(T5),[RHe,DHe]=MHe(T5),gY=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:o,required:a,disabled:s,value:u="on",onCheckedChange:l,form:c,...f}=e,[h,p]=v.useState(null),m=Nt(t,S=>p(S)),y=v.useRef(!1),b=h?c||!!h.closest("form"):!0,[w=!1,x]=Ts({prop:i,defaultProp:o,onChange:l});return I.jsxs(RHe,{scope:n,checked:w,disabled:s,children:[I.jsx(gt.button,{type:"button",role:"switch","aria-checked":w,"aria-required":a,"data-state":yY(w),"data-disabled":s?"":void 0,disabled:s,value:u,...f,ref:m,onClick:Ye(e.onClick,S=>{x(O=>!O),b&&(y.current=S.isPropagationStopped(),y.current||S.stopPropagation())})}),b&&I.jsx($He,{control:h,bubbles:!y.current,name:r,value:u,checked:w,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"}})]})});gY.displayName=T5;var mY="SwitchThumb",vY=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=DHe(mY,n);return I.jsx(gt.span,{"data-state":yY(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});vY.displayName=mY;var $He=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=v.useRef(null),a=kHe(n),s=THe(t);return v.useEffect(()=>{const u=o.current,l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"checked").set;if(a!==n&&f){const h=new Event("click",{bubbles:r});f.call(u,n),u.dispatchEvent(h)}},[a,n,r]),I.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function yY(e){return e?"checked":"unchecked"}var btt=gY,xtt=vY;/** +Defaulting to \`null\`.`}var mtt=fY,vtt=hY;/** * table-core * * Copyright (c) TanStack @@ -546,10 +546,10 @@ Defaulting to \`null\`.`}var mtt=fY,vtt=hY;function kHe(e){const t=v.useRef({val * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function fl(e,t){return typeof e=="function"?e(t):e}function Wo(e,t){return n=>{t.setState(r=>({...r,[e]:fl(n,r[e])}))}}function N2(e){return e instanceof Function}function IHe(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function NHe(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const a=t(o);a!=null&&a.length&&r(a)})};return r(e),n}function St(e,t,n){let r=[],i;return o=>{let a;n.key&&n.debug&&(a=Date.now());const s=e(o);if(!(s.length!==r.length||s.some((c,f)=>r[f]!==c)))return i;r=s;let l;if(n.key&&n.debug&&(l=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const c=Math.round((Date.now()-a)*100)/100,f=Math.round((Date.now()-l)*100)/100,h=f/16,p=(m,y)=>{for(m=String(m);m.lengthtypeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function fl(e,t){return typeof e=="function"?e(t):e}function Wo(e,t){return n=>{t.setState(r=>({...r,[e]:fl(n,r[e])}))}}function N2(e){return e instanceof Function}function kHe(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function THe(e,t){const n=[],r=i=>{i.forEach(o=>{n.push(o);const a=t(o);a!=null&&a.length&&r(a)})};return r(e),n}function St(e,t,n){let r=[],i;return o=>{let a;n.key&&n.debug&&(a=Date.now());const s=e(o);if(!(s.length!==r.length||s.some((c,f)=>r[f]!==c)))return i;r=s;let l;if(n.key&&n.debug&&(l=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const c=Math.round((Date.now()-a)*100)/100,f=Math.round((Date.now()-l)*100)/100,h=f/16,p=(m,y)=>{for(m=String(m);m.length{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:r}}function LHe(e,t,n,r){const i=()=>{var a;return(a=o.getValue())!=null?a:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:St(()=>[e,n,t,o],(a,s,u,l)=>({table:a,column:s,row:u,cell:l,getValue:l.getValue,renderValue:l.renderValue}),Ct(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(o,n,t,e)},{}),o}function FHe(e,t,n,r){var i,o;const s={...e._getDefaultColumnDef(),...t},u=s.accessorKey;let l=(i=(o=s.id)!=null?o:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?i:typeof s.header=="string"?s.header:void 0,c;if(s.accessorFn?c=s.accessorFn:u&&(u.includes(".")?c=h=>{let p=h;for(const y of u.split(".")){var m;p=(m=p)==null?void 0:m[y]}return p}:c=h=>h[s.accessorKey]),!l)throw new Error;let f={id:`${String(l)}`,accessorFn:c,parent:r,depth:n,columnDef:s,columns:[],getFlatColumns:St(()=>[!0],()=>{var h;return[f,...(h=f.columns)==null?void 0:h.flatMap(p=>p.getFlatColumns())]},Ct(e.options,"debugColumns")),getLeafColumns:St(()=>[e._getOrderColumnsFn()],h=>{var p;if((p=f.columns)!=null&&p.length){let m=f.columns.flatMap(y=>y.getLeafColumns());return h(m)}return[f]},Ct(e.options,"debugColumns"))};for(const h of e._features)h.createColumn==null||h.createColumn(f,e);return f}const Si="debugHeaders";function fN(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],s=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(s),a.push(u)};return s(o),a},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(o,e)}),o}const jHe={createTable:e=>{e.getHeaderGroups=St(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,a;const s=(o=r?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?o:[],u=(a=i?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?a:[],l=n.filter(f=>!(r!=null&&r.includes(f.id))&&!(i!=null&&i.includes(f.id)));return Wy(t,[...s,...l,...u],e)},Ct(e.options,Si)),e.getCenterHeaderGroups=St(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),Wy(t,n,e,"center")),Ct(e.options,Si)),e.getLeftHeaderGroups=St(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(s=>s.id===a)).filter(Boolean))!=null?i:[];return Wy(t,o,e,"left")},Ct(e.options,Si)),e.getRightHeaderGroups=St(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(s=>s.id===a)).filter(Boolean))!=null?i:[];return Wy(t,o,e,"right")},Ct(e.options,Si)),e.getFooterGroups=St(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Ct(e.options,Si)),e.getLeftFooterGroups=St(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Ct(e.options,Si)),e.getCenterFooterGroups=St(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Ct(e.options,Si)),e.getRightFooterGroups=St(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Ct(e.options,Si)),e.getFlatHeaders=St(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ct(e.options,Si)),e.getLeftFlatHeaders=St(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ct(e.options,Si)),e.getCenterFlatHeaders=St(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ct(e.options,Si)),e.getRightFlatHeaders=St(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ct(e.options,Si)),e.getCenterLeafHeaders=St(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Ct(e.options,Si)),e.getLeftLeafHeaders=St(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Ct(e.options,Si)),e.getRightLeafHeaders=St(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Ct(e.options,Si)),e.getLeafHeaders=St(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,a,s,u,l;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(a=(s=n[0])==null?void 0:s.headers)!=null?a:[],...(u=(l=r[0])==null?void 0:l.headers)!=null?u:[]].map(c=>c.getLeafHeaders()).flat()},Ct(e.options,Si))}};function Wy(e,t,n,r){var i,o;let a=0;const s=function(h,p){p===void 0&&(p=1),a=Math.max(a,p),h.filter(m=>m.getIsVisible()).forEach(m=>{var y;(y=m.columns)!=null&&y.length&&s(m.columns,p+1)},0)};s(e);let u=[];const l=(h,p)=>{const m={depth:p,id:[r,`${p}`].filter(Boolean).join("_"),headers:[]},y=[];h.forEach(b=>{const w=[...y].reverse()[0],x=b.column.depth===m.depth;let S,O=!1;if(x&&b.column.parent?S=b.column.parent:(S=b.column,O=!0),w&&w?.column===S)w.subHeaders.push(b);else{const E=fN(n,S,{id:[r,p,S.id,b?.id].filter(Boolean).join("_"),isPlaceholder:O,placeholderId:O?`${y.filter(C=>C.column===S).length}`:void 0,depth:p,index:y.length});E.subHeaders.push(b),y.push(E)}m.headers.push(b),b.headerGroup=m}),u.push(m),p>0&&l(y,p-1)},c=t.map((h,p)=>fN(n,h,{depth:a,index:p}));l(c,a-1),u.reverse();const f=h=>h.filter(m=>m.column.getIsVisible()).map(m=>{let y=0,b=0,w=[0];m.subHeaders&&m.subHeaders.length?(w=[],f(m.subHeaders).forEach(S=>{let{colSpan:O,rowSpan:E}=S;y+=O,w.push(E)})):y=1;const x=Math.min(...w);return b=b+x,m.colSpan=y,m.rowSpan=b,{colSpan:y,rowSpan:b}});return f((i=(o=u[0])==null?void 0:o.headers)!=null?i:[]),u}const M5=(e,t,n,r,i,o,a)=>{let s={id:t,index:r,original:n,depth:i,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(s._valuesCache.hasOwnProperty(u))return s._valuesCache[u];const l=e.getColumn(u);if(l!=null&&l.accessorFn)return s._valuesCache[u]=l.accessorFn(s.original,r),s._valuesCache[u]},getUniqueValues:u=>{if(s._uniqueValuesCache.hasOwnProperty(u))return s._uniqueValuesCache[u];const l=e.getColumn(u);if(l!=null&&l.accessorFn)return l.columnDef.getUniqueValues?(s._uniqueValuesCache[u]=l.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[u]):(s._uniqueValuesCache[u]=[s.getValue(u)],s._uniqueValuesCache[u])},renderValue:u=>{var l;return(l=s.getValue(u))!=null?l:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>NHe(s.subRows,u=>u.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let u=[],l=s;for(;;){const c=l.getParentRow();if(!c)break;u.push(c),l=c}return u.reverse()},getAllCells:St(()=>[e.getAllLeafColumns()],u=>u.map(l=>LHe(e,s,l,l.id)),Ct(e.options,"debugRows")),_getAllCellsByColumnId:St(()=>[s.getAllCells()],u=>u.reduce((l,c)=>(l[c.column.id]=c,l),{}),Ct(e.options,"debugRows"))};for(let u=0;u{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},bY=(e,t,n)=>{var r,i;const o=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(o))};bY.autoRemove=e=>Ka(e);const xY=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};xY.autoRemove=e=>Ka(e);const wY=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};wY.autoRemove=e=>Ka(e);const _Y=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};_Y.autoRemove=e=>Ka(e)||!(e!=null&&e.length);const SY=(e,t,n)=>!n.some(r=>{var i;return!((i=e.getValue(t))!=null&&i.includes(r))});SY.autoRemove=e=>Ka(e)||!(e!=null&&e.length);const CY=(e,t,n)=>n.some(r=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)});CY.autoRemove=e=>Ka(e)||!(e!=null&&e.length);const EY=(e,t,n)=>e.getValue(t)===n;EY.autoRemove=e=>Ka(e);const OY=(e,t,n)=>e.getValue(t)==n;OY.autoRemove=e=>Ka(e);const R5=(e,t,n)=>{let[r,i]=n;const o=e.getValue(t);return o>=r&&o<=i};R5.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,a=n===null||Number.isNaN(i)?1/0:i;if(o>a){const s=o;o=a,a=s}return[o,a]};R5.autoRemove=e=>Ka(e)||Ka(e[0])&&Ka(e[1]);const eu={includesString:bY,includesStringSensitive:xY,equalsString:wY,arrIncludes:_Y,arrIncludesAll:SY,arrIncludesSome:CY,equals:EY,weakEquals:OY,inNumberRange:R5};function Ka(e){return e==null||e===""}const UHe={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Wo("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);return typeof r=="string"?eu.includesString:typeof r=="number"?eu.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?eu.equals:Array.isArray(r)?eu.arrIncludes:eu.weakEquals},e.getFilterFn=()=>{var n,r;return N2(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:eu[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const i=e.getFilterFn(),o=r?.find(c=>c.id===e.id),a=fl(n,o?o.value:void 0);if(dN(i,a,e)){var s;return(s=r?.filter(c=>c.id!==e.id))!=null?s:[]}const u={id:e.id,value:a};if(o){var l;return(l=r?.map(c=>c.id===e.id?u:c))!=null?l:[]}return r!=null&&r.length?[...r,u]:[u]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=i=>{var o;return(o=fl(t,i))==null?void 0:o.filter(a=>{const s=n.find(u=>u.id===a.id);if(s){const u=s.getFilterFn();if(dN(u,a.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function dN(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const zHe=(e,t,n)=>n.reduce((r,i)=>{const o=i.getValue(e);return r+(typeof o=="number"?o:0)},0),WHe=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},VHe=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r=o)&&(r=o)}),r},HHe=(e,t,n)=>{let r,i;return n.forEach(o=>{const a=o.getValue(e);a!=null&&(r===void 0?a>=a&&(r=i=a):(r>a&&(r=a),i{let n=0,r=0;if(t.forEach(i=>{let o=i.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},KHe=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!IHe(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((o,a)=>o-a);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},GHe=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),YHe=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,ZHe=(e,t)=>t.length,U3={sum:zHe,min:WHe,max:VHe,extent:HHe,mean:qHe,median:KHe,unique:GHe,uniqueCount:YHe,count:ZHe},XHe={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Wo("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);if(typeof r=="number")return U3.sum;if(Object.prototype.toString.call(r)==="[object Date]")return U3.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return N2(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:U3[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function QHe(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(a=>a.id===o)).filter(Boolean),...r]}const JHe={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Wo("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=St(n=>[$0(t,n)],n=>n.findIndex(r=>r.id===e.id),Ct(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=$0(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const i=$0(t,n);return((r=i[i.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=St(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>i=>{let o=[];if(!(t!=null&&t.length))o=i;else{const a=[...t],s=[...i];for(;s.length&&a.length;){const u=a.shift(),l=s.findIndex(c=>c.id===u);l>-1&&o.push(s.splice(l,1)[0])}o=[...o,...s]}return QHe(o,n,r)},Ct(e.options,"debugTable"))}},z3=()=>({left:[],right:[]}),eqe={getInitialState:e=>({columnPinning:z3(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Wo("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var o,a;if(n==="right"){var s,u;return{left:((s=i?.left)!=null?s:[]).filter(f=>!(r!=null&&r.includes(f))),right:[...((u=i?.right)!=null?u:[]).filter(f=>!(r!=null&&r.includes(f))),...r]}}if(n==="left"){var l,c;return{left:[...((l=i?.left)!=null?l:[]).filter(f=>!(r!=null&&r.includes(f))),...r],right:((c=i?.right)!=null?c:[]).filter(f=>!(r!=null&&r.includes(f)))}}return{left:((o=i?.left)!=null?o:[]).filter(f=>!(r!=null&&r.includes(f))),right:((a=i?.right)!=null?a:[]).filter(f=>!(r!=null&&r.includes(f)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var i,o,a;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((o=(a=t.options.enableColumnPinning)!=null?a:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(s=>s.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(s=>r?.includes(s)),a=n.some(s=>i?.includes(s));return o?"left":a?"right":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();return i?(n=(r=t.getState().columnPinning)==null||(r=r[i])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=St(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(a=>!o.includes(a.column.id))},Ct(t.options,"debugRows")),e.getLeftVisibleCells=St(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(a=>a.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),Ct(t.options,"debugRows")),e.getRightVisibleCells=St(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(a=>a.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),Ct(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?z3():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:z3())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var i,o;return!!((i=r.left)!=null&&i.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=St(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),Ct(e.options,"debugColumns")),e.getRightLeafColumns=St(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),Ct(e.options,"debugColumns")),e.getCenterLeafColumns=St(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(o=>!i.includes(o.id))},Ct(e.options,"debugColumns"))}},Vy={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},W3=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),tqe={getDefaultColumnDef:()=>Vy,getInitialState:e=>({columnSizing:{},columnSizingInfo:W3(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Wo("columnSizing",e),onColumnSizingInfoChange:Wo("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,i;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Vy.minSize,(r=o??e.columnDef.size)!=null?r:Vy.size),(i=e.columnDef.maxSize)!=null?i:Vy.maxSize)},e.getStart=St(n=>[n,$0(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((i,o)=>i+o.getSize(),0),Ct(t.options,"debugColumns")),e.getAfter=St(n=>[n,$0(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((i,o)=>i+o.getSize(),0),Ct(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...i}=n;return i})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var o;n+=(o=i.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),i=r?.getCanResize();return o=>{if(!r||!i||(o.persist==null||o.persist(),V3(o)&&o.touches&&o.touches.length>1))return;const a=e.getSize(),s=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[r.id,r.getSize()]],u=V3(o)?Math.round(o.touches[0].clientX):o.clientX,l={},c=(w,x)=>{typeof x=="number"&&(t.setColumnSizingInfo(S=>{var O,E;const C=t.options.columnResizeDirection==="rtl"?-1:1,P=(x-((O=S?.startOffset)!=null?O:0))*C,M=Math.max(P/((E=S?.startSize)!=null?E:0),-.999999);return S.columnSizingStart.forEach(N=>{let[B,V]=N;l[B]=Math.round(Math.max(V+V*M,0)*100)/100}),{...S,deltaOffset:P,deltaPercentage:M}}),(t.options.columnResizeMode==="onChange"||w==="end")&&t.setColumnSizing(S=>({...S,...l})))},f=w=>c("move",w),h=w=>{c("end",w),t.setColumnSizingInfo(x=>({...x,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=n||typeof document<"u"?document:null,m={moveHandler:w=>f(w.clientX),upHandler:w=>{p?.removeEventListener("mousemove",m.moveHandler),p?.removeEventListener("mouseup",m.upHandler),h(w.clientX)}},y={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),f(w.touches[0].clientX),!1),upHandler:w=>{var x;p?.removeEventListener("touchmove",y.moveHandler),p?.removeEventListener("touchend",y.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),h((x=w.touches[0])==null?void 0:x.clientX)}},b=nqe()?{passive:!1}:!1;V3(o)?(p?.addEventListener("touchmove",y.moveHandler,b),p?.addEventListener("touchend",y.upHandler,b)):(p?.addEventListener("mousemove",m.moveHandler,b),p?.addEventListener("mouseup",m.upHandler,b)),t.setColumnSizingInfo(w=>({...w,startOffset:u,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?W3():(n=e.initialState.columnSizingInfo)!=null?n:W3())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0}}};let Hy=null;function nqe(){if(typeof Hy=="boolean")return Hy;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Hy=e,Hy}function V3(e){return e.type==="touchstart"}const rqe={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Wo("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const i=e.columns;return(n=i.length?i.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=St(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),Ct(t.options,"debugRows")),e.getVisibleCells=St(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],Ct(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>St(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),Ct(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,o)=>({...i,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function $0(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const iqe={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},oqe={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Wo("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,i,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>eu.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return N2(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:eu[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},aqe={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Wo("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var i,o;e.setExpanded(r?{}:(i=(o=e.initialState)==null?void 0:o.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const a=o.split(".");r=Math.max(r,a.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var i;const o=r===!0?!0:!!(r!=null&&r[e.id]);let a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(s=>{a[s]=!0}):a=r,n=(i=n)!=null?i:!o,!o&&n)return{...a,[e.id]:!0};if(o&&!n){const{[e.id]:s,...u}=a;return u}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r?.[e.id])},e.getCanExpand=()=>{var n,r,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},M4=0,R4=10,H3=()=>({pageIndex:M4,pageSize:R4}),sqe={getInitialState:e=>({...e,pagination:{...H3(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Wo("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const i=o=>fl(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=r=>{var i;e.setPagination(r?H3():(i=e.initialState.pagination)!=null?i:H3())},e.setPageIndex=r=>{e.setPagination(i=>{let o=fl(r,i.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,a)),{...i,pageIndex:o}})},e.resetPageIndex=r=>{var i,o;e.setPageIndex(r?M4:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?i:M4)},e.resetPageSize=r=>{var i,o;e.setPageSize(r?R4:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?i:R4)},e.setPageSize=r=>{e.setPagination(i=>{const o=Math.max(1,fl(r,i.pageSize)),a=i.pageSize*i.pageIndex,s=Math.floor(a/o);return{...i,pageIndex:s,pageSize:o}})},e.setPageCount=r=>e.setPagination(i=>{var o;let a=fl(r,(o=e.options.pageCount)!=null?o:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...i,pageCount:a}}),e.getPageOptions=St(()=>[e.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((o,a)=>a)),i},Ct(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},q3=()=>({top:[],bottom:[]}),uqe={getInitialState:e=>({rowPinning:q3(),...e}),getDefaultOptions:e=>({onRowPinningChange:Wo("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{const o=r?e.getLeafRows().map(u=>{let{id:l}=u;return l}):[],a=i?e.getParentRows().map(u=>{let{id:l}=u;return l}):[],s=new Set([...a,e.id,...o]);t.setRowPinning(u=>{var l,c;if(n==="bottom"){var f,h;return{top:((f=u?.top)!=null?f:[]).filter(y=>!(s!=null&&s.has(y))),bottom:[...((h=u?.bottom)!=null?h:[]).filter(y=>!(s!=null&&s.has(y))),...Array.from(s)]}}if(n==="top"){var p,m;return{top:[...((p=u?.top)!=null?p:[]).filter(y=>!(s!=null&&s.has(y))),...Array.from(s)],bottom:((m=u?.bottom)!=null?m:[]).filter(y=>!(s!=null&&s.has(y)))}}return{top:((l=u?.top)!=null?l:[]).filter(y=>!(s!=null&&s.has(y))),bottom:((c=u?.bottom)!=null?c:[]).filter(y=>!(s!=null&&s.has(y)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:i}=t.options;return typeof r=="function"?r(e):(n=r??i)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,o=n.some(s=>r?.includes(s)),a=n.some(s=>i?.includes(s));return o?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();if(!i)return-1;const o=(n=i==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(a=>{let{id:s}=a;return s});return(r=o?.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?q3():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:q3())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var i,o;return!!((i=r.top)!=null&&i.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(n??[]).map(a=>{const s=e.getRow(a,!0);return s.getIsAllParentsExpanded()?s:null}):(n??[]).map(a=>t.find(s=>s.id===a))).filter(Boolean).map(a=>({...a,position:r}))},e.getTopRows=St(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),Ct(e.options,"debugRows")),e.getBottomRows=St(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),Ct(e.options,"debugRows")),e.getCenterRows=St(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const i=new Set([...n??[],...r??[]]);return t.filter(o=>!i.has(o.id))},Ct(e.options,"debugRows"))}},lqe={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Wo("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):i.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(o=>{D4(i,o.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=St(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?K3(e,n):{rows:[],flatRows:[],rowsById:{}},Ct(e.options,"debugTable")),e.getFilteredSelectedRowModel=St(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?K3(e,n):{rows:[],flatRows:[],rowsById:{}},Ct(e.options,"debugTable")),e.getGroupedSelectedRowModel=St(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?K3(e,n):{rows:[],flatRows:[],rowsById:{}},Ct(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(i=>!n[i.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const i=e.getIsSelected();t.setRowSelection(o=>{var a;if(n=typeof n<"u"?n:!i,e.getCanSelect()&&i===n)return o;const s={...o};return D4(s,e.id,n,(a=r?.selectChildren)!=null?a:!0,t),s})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return D5(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return $4(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return $4(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var i;n&&e.toggleSelected((i=r.target)==null?void 0:i.checked)}}}},D4=(e,t,n,r,i)=>{var o;const a=i.getRow(t,!0);n?(a.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),a.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=a.subRows)!=null&&o.length&&a.getCanSelectSubRows()&&a.subRows.forEach(s=>D4(e,s.id,n,r,i))};function K3(e,t){const n=e.getState().rowSelection,r=[],i={},o=function(a,s){return a.map(u=>{var l;const c=D5(u,n);if(c&&(r.push(u),i[u.id]=u),(l=u.subRows)!=null&&l.length&&(u={...u,subRows:o(u.subRows)}),c)return u}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function D5(e,t){var n;return(n=t[e.id])!=null?n:!1}function $4(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,o=!1;return e.subRows.forEach(a=>{if(!(o&&!i)&&(a.getCanSelect()&&(D5(a,t)?o=!0:i=!1),a.subRows&&a.subRows.length)){const s=$4(a,t);s==="all"?o=!0:(s==="some"&&(o=!0),i=!1)}}),i?"all":o?"some":!1}const I4=/([0-9]+)/gm,cqe=(e,t,n)=>AY(Nl(e.getValue(n)).toLowerCase(),Nl(t.getValue(n)).toLowerCase()),fqe=(e,t,n)=>AY(Nl(e.getValue(n)),Nl(t.getValue(n))),dqe=(e,t,n)=>$5(Nl(e.getValue(n)).toLowerCase(),Nl(t.getValue(n)).toLowerCase()),hqe=(e,t,n)=>$5(Nl(e.getValue(n)),Nl(t.getValue(n))),pqe=(e,t,n)=>{const r=e.getValue(n),i=t.getValue(n);return r>i?1:r$5(e.getValue(n),t.getValue(n));function $5(e,t){return e===t?0:e>t?1:-1}function Nl(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function AY(e,t){const n=e.split(I4).filter(Boolean),r=t.split(I4).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),o=r.shift(),a=parseInt(i,10),s=parseInt(o,10),u=[a,s].sort();if(isNaN(u[0])){if(i>o)return 1;if(o>i)return-1;continue}if(isNaN(u[1]))return isNaN(a)?-1:1;if(a>s)return 1;if(s>a)return-1}return n.length-r.length}const Qp={alphanumeric:cqe,alphanumericCaseSensitive:fqe,text:dqe,textCaseSensitive:hqe,datetime:pqe,basic:gqe},mqe={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Wo("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const o=i?.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Qp.datetime;if(typeof o=="string"&&(r=!0,o.split(I4).length>1))return Qp.alphanumeric}return r?Qp.text:Qp.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof n?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return N2(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Qp[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const i=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(a=>{const s=a?.find(p=>p.id===e.id),u=a?.findIndex(p=>p.id===e.id);let l=[],c,f=o?n:i==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&r?s?c="toggle":c="add":a!=null&&a.length&&u!==a.length-1?c="replace":s?c="toggle":c="replace",c==="toggle"&&(o||i||(c="remove")),c==="add"){var h;l=[...a,{id:e.id,desc:f}],l.splice(0,l.length-((h=t.options.maxMultiSortColCount)!=null?h:Number.MAX_SAFE_INTEGER))}else c==="toggle"?l=a.map(p=>p.id===e.id?{...p,desc:f}:p):c==="remove"?l=a.filter(p=>p.id!==e.id):l=[{id:e.id,desc:f}];return l})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,i;const o=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:a==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},vqe=[jHe,rqe,JHe,eqe,BHe,UHe,iqe,oqe,mqe,XHe,aqe,sqe,uqe,lqe,tqe];function yqe(e){var t,n;const r=[...vqe,...(t=e._features)!=null?t:[]];let i={_features:r};const o=i._features.reduce((h,p)=>Object.assign(h,p.getDefaultOptions==null?void 0:p.getDefaultOptions(i)),{}),a=h=>i.options.mergeOptions?i.options.mergeOptions(o,h):{...o,...h};let u={...{},...(n=e.initialState)!=null?n:{}};i._features.forEach(h=>{var p;u=(p=h.getInitialState==null?void 0:h.getInitialState(u))!=null?p:u});const l=[];let c=!1;const f={_features:r,options:{...o,...e},initialState:u,_queue:h=>{l.push(h),c||(c=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();c=!1}).catch(p=>setTimeout(()=>{throw p})))},reset:()=>{i.setState(i.initialState)},setOptions:h=>{const p=fl(h,i.options);i.options=a(p)},getState:()=>i.options.state,setState:h=>{i.options.onStateChange==null||i.options.onStateChange(h)},_getRowId:(h,p,m)=>{var y;return(y=i.options.getRowId==null?void 0:i.options.getRowId(h,p,m))!=null?y:`${m?[m.id,p].join("."):p}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(h,p)=>{let m=(p?i.getPrePaginationRowModel():i.getRowModel()).rowsById[h];if(!m&&(m=i.getCoreRowModel().rowsById[h],!m))throw new Error;return m},_getDefaultColumnDef:St(()=>[i.options.defaultColumn],h=>{var p;return h=(p=h)!=null?p:{},{header:m=>{const y=m.header.column.columnDef;return y.accessorKey?y.accessorKey:y.accessorFn?y.id:null},cell:m=>{var y,b;return(y=(b=m.renderValue())==null||b.toString==null?void 0:b.toString())!=null?y:null},...i._features.reduce((m,y)=>Object.assign(m,y.getDefaultColumnDef==null?void 0:y.getDefaultColumnDef()),{}),...h}},Ct(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:St(()=>[i._getColumnDefs()],h=>{const p=function(m,y,b){return b===void 0&&(b=0),m.map(w=>{const x=FHe(i,w,b,y),S=w;return x.columns=S.columns?p(S.columns,x,b+1):[],x})};return p(h)},Ct(e,"debugColumns")),getAllFlatColumns:St(()=>[i.getAllColumns()],h=>h.flatMap(p=>p.getFlatColumns()),Ct(e,"debugColumns")),_getAllFlatColumnsById:St(()=>[i.getAllFlatColumns()],h=>h.reduce((p,m)=>(p[m.id]=m,p),{}),Ct(e,"debugColumns")),getAllLeafColumns:St(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(h,p)=>{let m=h.flatMap(y=>y.getLeafColumns());return p(m)},Ct(e,"debugColumns")),getColumn:h=>i._getAllFlatColumnsById()[h]};Object.assign(i,f);for(let h=0;hSt(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,o,a){o===void 0&&(o=0);const s=[];for(let l=0;le._autoResetPageIndex()))}function bqe(e){const t=[],n=r=>{var i;t.push(r),(i=r.subRows)!=null&&i.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function PY(e,t,n){return n.options.filterFromLeafRows?xqe(e,t,n):wqe(e,t,n)}function xqe(e,t,n){var r;const i=[],o={},a=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,s=function(u,l){l===void 0&&(l=0);const c=[];for(let h=0;hSt(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,i)=>{if(!n.rows.length||!(r!=null&&r.length)&&!i)return n;const o=[...r.map(s=>s.id).filter(s=>s!==t),i?"__global__":void 0].filter(Boolean),a=s=>{for(let u=0;uSt(()=>{var n;return[(n=e.getColumn(t))==null?void 0:n.getFacetedRowModel()]},n=>{if(!n)return new Map;let r=new Map;for(let o=0;oSt(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let h=0;h{var p;const m=e.getColumn(h.id);if(!m)return;const y=m.getFilterFn();y&&i.push({id:h.id,filterFn:y,resolvedValue:(p=y.resolveFilterValue==null?void 0:y.resolveFilterValue(h.value))!=null?p:h.value})});const a=(n??[]).map(h=>h.id),s=e.getGlobalFilterFn(),u=e.getAllLeafColumns().filter(h=>h.getCanGlobalFilter());r&&s&&u.length&&(a.push("__global__"),u.forEach(h=>{var p;o.push({id:h.id,filterFn:s,resolvedValue:(p=s.resolveFilterValue==null?void 0:s.resolveFilterValue(r))!=null?p:r})}));let l,c;for(let h=0;h{p.columnFiltersMeta[y]=b})}if(o.length){for(let m=0;m{p.columnFiltersMeta[y]=b})){p.columnFilters.__global__=!0;break}}p.columnFilters.__global__!==!0&&(p.columnFilters.__global__=!1)}}const f=h=>{for(let p=0;pe._autoResetPageIndex()))}function Ett(e){return t=>St(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:i,pageIndex:o}=n;let{rows:a,flatRows:s,rowsById:u}=r;const l=i*o,c=l+i;a=a.slice(l,c);let f;t.options.paginateExpandedRows?f={rows:a,flatRows:s,rowsById:u}:f=bqe({rows:a,flatRows:s,rowsById:u}),f.flatRows=[];const h=p=>{f.flatRows.push(p),p.subRows.length&&p.subRows.forEach(h)};return f.rows.forEach(h),f},Ct(t.options,"debugTable"))}function Ott(){return e=>St(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,i=[],o=r.filter(u=>{var l;return(l=e.getColumn(u.id))==null?void 0:l.getCanSort()}),a={};o.forEach(u=>{const l=e.getColumn(u.id);l&&(a[u.id]={sortUndefined:l.columnDef.sortUndefined,invertSorting:l.columnDef.invertSorting,sortingFn:l.getSortingFn()})});const s=u=>{const l=u.map(c=>({...c}));return l.sort((c,f)=>{for(let p=0;p{var f;i.push(c),(f=c.subRows)!=null&&f.length&&(c.subRows=s(c.subRows))}),l};return{rows:s(n.rows),flatRows:i,rowsById:n.rowsById}},Ct(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/** + color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,n?.key)}return i}}function Ct(e,t,n,r){return{debug:()=>{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:r}}function MHe(e,t,n,r){const i=()=>{var a;return(a=o.getValue())!=null?a:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:St(()=>[e,n,t,o],(a,s,u,l)=>({table:a,column:s,row:u,cell:l,getValue:l.getValue,renderValue:l.renderValue}),Ct(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(o,n,t,e)},{}),o}function RHe(e,t,n,r){var i,o;const s={...e._getDefaultColumnDef(),...t},u=s.accessorKey;let l=(i=(o=s.id)!=null?o:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?i:typeof s.header=="string"?s.header:void 0,c;if(s.accessorFn?c=s.accessorFn:u&&(u.includes(".")?c=h=>{let p=h;for(const y of u.split(".")){var m;p=(m=p)==null?void 0:m[y]}return p}:c=h=>h[s.accessorKey]),!l)throw new Error;let f={id:`${String(l)}`,accessorFn:c,parent:r,depth:n,columnDef:s,columns:[],getFlatColumns:St(()=>[!0],()=>{var h;return[f,...(h=f.columns)==null?void 0:h.flatMap(p=>p.getFlatColumns())]},Ct(e.options,"debugColumns")),getLeafColumns:St(()=>[e._getOrderColumnsFn()],h=>{var p;if((p=f.columns)!=null&&p.length){let m=f.columns.flatMap(y=>y.getLeafColumns());return h(m)}return[f]},Ct(e.options,"debugColumns"))};for(const h of e._features)h.createColumn==null||h.createColumn(f,e);return f}const Si="debugHeaders";function fN(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],s=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(s),a.push(u)};return s(o),a},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(o,e)}),o}const DHe={createTable:e=>{e.getHeaderGroups=St(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,a;const s=(o=r?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?o:[],u=(a=i?.map(f=>n.find(h=>h.id===f)).filter(Boolean))!=null?a:[],l=n.filter(f=>!(r!=null&&r.includes(f.id))&&!(i!=null&&i.includes(f.id)));return Wy(t,[...s,...l,...u],e)},Ct(e.options,Si)),e.getCenterHeaderGroups=St(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),Wy(t,n,e,"center")),Ct(e.options,Si)),e.getLeftHeaderGroups=St(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(s=>s.id===a)).filter(Boolean))!=null?i:[];return Wy(t,o,e,"left")},Ct(e.options,Si)),e.getRightHeaderGroups=St(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(s=>s.id===a)).filter(Boolean))!=null?i:[];return Wy(t,o,e,"right")},Ct(e.options,Si)),e.getFooterGroups=St(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Ct(e.options,Si)),e.getLeftFooterGroups=St(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Ct(e.options,Si)),e.getCenterFooterGroups=St(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Ct(e.options,Si)),e.getRightFooterGroups=St(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Ct(e.options,Si)),e.getFlatHeaders=St(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ct(e.options,Si)),e.getLeftFlatHeaders=St(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ct(e.options,Si)),e.getCenterFlatHeaders=St(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ct(e.options,Si)),e.getRightFlatHeaders=St(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),Ct(e.options,Si)),e.getCenterLeafHeaders=St(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Ct(e.options,Si)),e.getLeftLeafHeaders=St(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Ct(e.options,Si)),e.getRightLeafHeaders=St(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Ct(e.options,Si)),e.getLeafHeaders=St(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,a,s,u,l;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(a=(s=n[0])==null?void 0:s.headers)!=null?a:[],...(u=(l=r[0])==null?void 0:l.headers)!=null?u:[]].map(c=>c.getLeafHeaders()).flat()},Ct(e.options,Si))}};function Wy(e,t,n,r){var i,o;let a=0;const s=function(h,p){p===void 0&&(p=1),a=Math.max(a,p),h.filter(m=>m.getIsVisible()).forEach(m=>{var y;(y=m.columns)!=null&&y.length&&s(m.columns,p+1)},0)};s(e);let u=[];const l=(h,p)=>{const m={depth:p,id:[r,`${p}`].filter(Boolean).join("_"),headers:[]},y=[];h.forEach(b=>{const w=[...y].reverse()[0],x=b.column.depth===m.depth;let S,O=!1;if(x&&b.column.parent?S=b.column.parent:(S=b.column,O=!0),w&&w?.column===S)w.subHeaders.push(b);else{const E=fN(n,S,{id:[r,p,S.id,b?.id].filter(Boolean).join("_"),isPlaceholder:O,placeholderId:O?`${y.filter(C=>C.column===S).length}`:void 0,depth:p,index:y.length});E.subHeaders.push(b),y.push(E)}m.headers.push(b),b.headerGroup=m}),u.push(m),p>0&&l(y,p-1)},c=t.map((h,p)=>fN(n,h,{depth:a,index:p}));l(c,a-1),u.reverse();const f=h=>h.filter(m=>m.column.getIsVisible()).map(m=>{let y=0,b=0,w=[0];m.subHeaders&&m.subHeaders.length?(w=[],f(m.subHeaders).forEach(S=>{let{colSpan:O,rowSpan:E}=S;y+=O,w.push(E)})):y=1;const x=Math.min(...w);return b=b+x,m.colSpan=y,m.rowSpan=b,{colSpan:y,rowSpan:b}});return f((i=(o=u[0])==null?void 0:o.headers)!=null?i:[]),u}const T5=(e,t,n,r,i,o,a)=>{let s={id:t,index:r,original:n,depth:i,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(s._valuesCache.hasOwnProperty(u))return s._valuesCache[u];const l=e.getColumn(u);if(l!=null&&l.accessorFn)return s._valuesCache[u]=l.accessorFn(s.original,r),s._valuesCache[u]},getUniqueValues:u=>{if(s._uniqueValuesCache.hasOwnProperty(u))return s._uniqueValuesCache[u];const l=e.getColumn(u);if(l!=null&&l.accessorFn)return l.columnDef.getUniqueValues?(s._uniqueValuesCache[u]=l.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[u]):(s._uniqueValuesCache[u]=[s.getValue(u)],s._uniqueValuesCache[u])},renderValue:u=>{var l;return(l=s.getValue(u))!=null?l:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>THe(s.subRows,u=>u.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let u=[],l=s;for(;;){const c=l.getParentRow();if(!c)break;u.push(c),l=c}return u.reverse()},getAllCells:St(()=>[e.getAllLeafColumns()],u=>u.map(l=>MHe(e,s,l,l.id)),Ct(e.options,"debugRows")),_getAllCellsByColumnId:St(()=>[s.getAllCells()],u=>u.reduce((l,c)=>(l[c.column.id]=c,l),{}),Ct(e.options,"debugRows"))};for(let u=0;u{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},gY=(e,t,n)=>{var r,i;const o=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(o))};gY.autoRemove=e=>Ka(e);const mY=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};mY.autoRemove=e=>Ka(e);const vY=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};vY.autoRemove=e=>Ka(e);const yY=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};yY.autoRemove=e=>Ka(e)||!(e!=null&&e.length);const bY=(e,t,n)=>!n.some(r=>{var i;return!((i=e.getValue(t))!=null&&i.includes(r))});bY.autoRemove=e=>Ka(e)||!(e!=null&&e.length);const xY=(e,t,n)=>n.some(r=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)});xY.autoRemove=e=>Ka(e)||!(e!=null&&e.length);const wY=(e,t,n)=>e.getValue(t)===n;wY.autoRemove=e=>Ka(e);const _Y=(e,t,n)=>e.getValue(t)==n;_Y.autoRemove=e=>Ka(e);const M5=(e,t,n)=>{let[r,i]=n;const o=e.getValue(t);return o>=r&&o<=i};M5.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,a=n===null||Number.isNaN(i)?1/0:i;if(o>a){const s=o;o=a,a=s}return[o,a]};M5.autoRemove=e=>Ka(e)||Ka(e[0])&&Ka(e[1]);const eu={includesString:gY,includesStringSensitive:mY,equalsString:vY,arrIncludes:yY,arrIncludesAll:bY,arrIncludesSome:xY,equals:wY,weakEquals:_Y,inNumberRange:M5};function Ka(e){return e==null||e===""}const IHe={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Wo("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);return typeof r=="string"?eu.includesString:typeof r=="number"?eu.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?eu.equals:Array.isArray(r)?eu.arrIncludes:eu.weakEquals},e.getFilterFn=()=>{var n,r;return N2(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:eu[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const i=e.getFilterFn(),o=r?.find(c=>c.id===e.id),a=fl(n,o?o.value:void 0);if(dN(i,a,e)){var s;return(s=r?.filter(c=>c.id!==e.id))!=null?s:[]}const u={id:e.id,value:a};if(o){var l;return(l=r?.map(c=>c.id===e.id?u:c))!=null?l:[]}return r!=null&&r.length?[...r,u]:[u]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=i=>{var o;return(o=fl(t,i))==null?void 0:o.filter(a=>{const s=n.find(u=>u.id===a.id);if(s){const u=s.getFilterFn();if(dN(u,a.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function dN(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const NHe=(e,t,n)=>n.reduce((r,i)=>{const o=i.getValue(e);return r+(typeof o=="number"?o:0)},0),LHe=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},FHe=(e,t,n)=>{let r;return n.forEach(i=>{const o=i.getValue(e);o!=null&&(r=o)&&(r=o)}),r},jHe=(e,t,n)=>{let r,i;return n.forEach(o=>{const a=o.getValue(e);a!=null&&(r===void 0?a>=a&&(r=i=a):(r>a&&(r=a),i{let n=0,r=0;if(t.forEach(i=>{let o=i.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},UHe=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!kHe(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((o,a)=>o-a);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},zHe=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),WHe=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,VHe=(e,t)=>t.length,U3={sum:NHe,min:LHe,max:FHe,extent:jHe,mean:BHe,median:UHe,unique:zHe,uniqueCount:WHe,count:VHe},HHe={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Wo("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);if(typeof r=="number")return U3.sum;if(Object.prototype.toString.call(r)==="[object Date]")return U3.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return N2(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:U3[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function qHe(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(a=>a.id===o)).filter(Boolean),...r]}const KHe={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Wo("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=St(n=>[$0(t,n)],n=>n.findIndex(r=>r.id===e.id),Ct(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=$0(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const i=$0(t,n);return((r=i[i.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=St(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>i=>{let o=[];if(!(t!=null&&t.length))o=i;else{const a=[...t],s=[...i];for(;s.length&&a.length;){const u=a.shift(),l=s.findIndex(c=>c.id===u);l>-1&&o.push(s.splice(l,1)[0])}o=[...o,...s]}return qHe(o,n,r)},Ct(e.options,"debugTable"))}},z3=()=>({left:[],right:[]}),GHe={getInitialState:e=>({columnPinning:z3(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Wo("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var o,a;if(n==="right"){var s,u;return{left:((s=i?.left)!=null?s:[]).filter(f=>!(r!=null&&r.includes(f))),right:[...((u=i?.right)!=null?u:[]).filter(f=>!(r!=null&&r.includes(f))),...r]}}if(n==="left"){var l,c;return{left:[...((l=i?.left)!=null?l:[]).filter(f=>!(r!=null&&r.includes(f))),...r],right:((c=i?.right)!=null?c:[]).filter(f=>!(r!=null&&r.includes(f)))}}return{left:((o=i?.left)!=null?o:[]).filter(f=>!(r!=null&&r.includes(f))),right:((a=i?.right)!=null?a:[]).filter(f=>!(r!=null&&r.includes(f)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var i,o,a;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((o=(a=t.options.enableColumnPinning)!=null?a:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(s=>s.id),{left:r,right:i}=t.getState().columnPinning,o=n.some(s=>r?.includes(s)),a=n.some(s=>i?.includes(s));return o?"left":a?"right":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();return i?(n=(r=t.getState().columnPinning)==null||(r=r[i])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=St(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(a=>!o.includes(a.column.id))},Ct(t.options,"debugRows")),e.getLeftVisibleCells=St(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(a=>a.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),Ct(t.options,"debugRows")),e.getRightVisibleCells=St(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(a=>a.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),Ct(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?z3():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:z3())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var i,o;return!!((i=r.left)!=null&&i.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=St(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),Ct(e.options,"debugColumns")),e.getRightLeafColumns=St(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(i=>i.id===r)).filter(Boolean),Ct(e.options,"debugColumns")),e.getCenterLeafColumns=St(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const i=[...n??[],...r??[]];return t.filter(o=>!i.includes(o.id))},Ct(e.options,"debugColumns"))}},Vy={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},W3=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),YHe={getDefaultColumnDef:()=>Vy,getInitialState:e=>({columnSizing:{},columnSizingInfo:W3(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Wo("columnSizing",e),onColumnSizingInfoChange:Wo("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,i;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Vy.minSize,(r=o??e.columnDef.size)!=null?r:Vy.size),(i=e.columnDef.maxSize)!=null?i:Vy.maxSize)},e.getStart=St(n=>[n,$0(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((i,o)=>i+o.getSize(),0),Ct(t.options,"debugColumns")),e.getAfter=St(n=>[n,$0(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((i,o)=>i+o.getSize(),0),Ct(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...i}=n;return i})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var o;n+=(o=i.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),i=r?.getCanResize();return o=>{if(!r||!i||(o.persist==null||o.persist(),V3(o)&&o.touches&&o.touches.length>1))return;const a=e.getSize(),s=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[r.id,r.getSize()]],u=V3(o)?Math.round(o.touches[0].clientX):o.clientX,l={},c=(w,x)=>{typeof x=="number"&&(t.setColumnSizingInfo(S=>{var O,E;const C=t.options.columnResizeDirection==="rtl"?-1:1,P=(x-((O=S?.startOffset)!=null?O:0))*C,M=Math.max(P/((E=S?.startSize)!=null?E:0),-.999999);return S.columnSizingStart.forEach(N=>{let[B,V]=N;l[B]=Math.round(Math.max(V+V*M,0)*100)/100}),{...S,deltaOffset:P,deltaPercentage:M}}),(t.options.columnResizeMode==="onChange"||w==="end")&&t.setColumnSizing(S=>({...S,...l})))},f=w=>c("move",w),h=w=>{c("end",w),t.setColumnSizingInfo(x=>({...x,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=n||typeof document<"u"?document:null,m={moveHandler:w=>f(w.clientX),upHandler:w=>{p?.removeEventListener("mousemove",m.moveHandler),p?.removeEventListener("mouseup",m.upHandler),h(w.clientX)}},y={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),f(w.touches[0].clientX),!1),upHandler:w=>{var x;p?.removeEventListener("touchmove",y.moveHandler),p?.removeEventListener("touchend",y.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),h((x=w.touches[0])==null?void 0:x.clientX)}},b=ZHe()?{passive:!1}:!1;V3(o)?(p?.addEventListener("touchmove",y.moveHandler,b),p?.addEventListener("touchend",y.upHandler,b)):(p?.addEventListener("mousemove",m.moveHandler,b),p?.addEventListener("mouseup",m.upHandler,b)),t.setColumnSizingInfo(w=>({...w,startOffset:u,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?W3():(n=e.initialState.columnSizingInfo)!=null?n:W3())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?t:0}}};let Hy=null;function ZHe(){if(typeof Hy=="boolean")return Hy;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Hy=e,Hy}function V3(e){return e.type==="touchstart"}const XHe={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Wo("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const i=e.columns;return(n=i.length?i.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=St(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),Ct(t.options,"debugRows")),e.getVisibleCells=St(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],Ct(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>St(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),Ct(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,o)=>({...i,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function $0(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const QHe={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},JHe={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Wo("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,i,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>eu.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return N2(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:eu[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},eqe={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Wo("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var i,o;e.setExpanded(r?{}:(i=(o=e.initialState)==null?void 0:o.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const a=o.split(".");r=Math.max(r,a.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var i;const o=r===!0?!0:!!(r!=null&&r[e.id]);let a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(s=>{a[s]=!0}):a=r,n=(i=n)!=null?i:!o,!o&&n)return{...a,[e.id]:!0};if(o&&!n){const{[e.id]:s,...u}=a;return u}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r?.[e.id])},e.getCanExpand=()=>{var n,r,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},M4=0,R4=10,H3=()=>({pageIndex:M4,pageSize:R4}),tqe={getInitialState:e=>({...e,pagination:{...H3(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Wo("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t){e._queue(()=>{t=!0});return}if((r=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const i=o=>fl(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=r=>{var i;e.setPagination(r?H3():(i=e.initialState.pagination)!=null?i:H3())},e.setPageIndex=r=>{e.setPagination(i=>{let o=fl(r,i.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,a)),{...i,pageIndex:o}})},e.resetPageIndex=r=>{var i,o;e.setPageIndex(r?M4:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?i:M4)},e.resetPageSize=r=>{var i,o;e.setPageSize(r?R4:(i=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?i:R4)},e.setPageSize=r=>{e.setPagination(i=>{const o=Math.max(1,fl(r,i.pageSize)),a=i.pageSize*i.pageIndex,s=Math.floor(a/o);return{...i,pageIndex:s,pageSize:o}})},e.setPageCount=r=>e.setPagination(i=>{var o;let a=fl(r,(o=e.options.pageCount)!=null?o:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...i,pageCount:a}}),e.getPageOptions=St(()=>[e.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((o,a)=>a)),i},Ct(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},q3=()=>({top:[],bottom:[]}),nqe={getInitialState:e=>({rowPinning:q3(),...e}),getDefaultOptions:e=>({onRowPinningChange:Wo("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{const o=r?e.getLeafRows().map(u=>{let{id:l}=u;return l}):[],a=i?e.getParentRows().map(u=>{let{id:l}=u;return l}):[],s=new Set([...a,e.id,...o]);t.setRowPinning(u=>{var l,c;if(n==="bottom"){var f,h;return{top:((f=u?.top)!=null?f:[]).filter(y=>!(s!=null&&s.has(y))),bottom:[...((h=u?.bottom)!=null?h:[]).filter(y=>!(s!=null&&s.has(y))),...Array.from(s)]}}if(n==="top"){var p,m;return{top:[...((p=u?.top)!=null?p:[]).filter(y=>!(s!=null&&s.has(y))),...Array.from(s)],bottom:((m=u?.bottom)!=null?m:[]).filter(y=>!(s!=null&&s.has(y)))}}return{top:((l=u?.top)!=null?l:[]).filter(y=>!(s!=null&&s.has(y))),bottom:((c=u?.bottom)!=null?c:[]).filter(y=>!(s!=null&&s.has(y)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:i}=t.options;return typeof r=="function"?r(e):(n=r??i)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,o=n.some(s=>r?.includes(s)),a=n.some(s=>i?.includes(s));return o?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const i=e.getIsPinned();if(!i)return-1;const o=(n=i==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(a=>{let{id:s}=a;return s});return(r=o?.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?q3():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:q3())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var i,o;return!!((i=r.top)!=null&&i.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(n??[]).map(a=>{const s=e.getRow(a,!0);return s.getIsAllParentsExpanded()?s:null}):(n??[]).map(a=>t.find(s=>s.id===a))).filter(Boolean).map(a=>({...a,position:r}))},e.getTopRows=St(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),Ct(e.options,"debugRows")),e.getBottomRows=St(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),Ct(e.options,"debugRows")),e.getCenterRows=St(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const i=new Set([...n??[],...r??[]]);return t.filter(o=>!i.has(o.id))},Ct(e.options,"debugRows"))}},rqe={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Wo("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):i.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(o=>{D4(i,o.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=St(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?K3(e,n):{rows:[],flatRows:[],rowsById:{}},Ct(e.options,"debugTable")),e.getFilteredSelectedRowModel=St(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?K3(e,n):{rows:[],flatRows:[],rowsById:{}},Ct(e.options,"debugTable")),e.getGroupedSelectedRowModel=St(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?K3(e,n):{rows:[],flatRows:[],rowsById:{}},Ct(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(i=>!n[i.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const i=e.getIsSelected();t.setRowSelection(o=>{var a;if(n=typeof n<"u"?n:!i,e.getCanSelect()&&i===n)return o;const s={...o};return D4(s,e.id,n,(a=r?.selectChildren)!=null?a:!0,t),s})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return R5(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return $4(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return $4(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var i;n&&e.toggleSelected((i=r.target)==null?void 0:i.checked)}}}},D4=(e,t,n,r,i)=>{var o;const a=i.getRow(t,!0);n?(a.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),a.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=a.subRows)!=null&&o.length&&a.getCanSelectSubRows()&&a.subRows.forEach(s=>D4(e,s.id,n,r,i))};function K3(e,t){const n=e.getState().rowSelection,r=[],i={},o=function(a,s){return a.map(u=>{var l;const c=R5(u,n);if(c&&(r.push(u),i[u.id]=u),(l=u.subRows)!=null&&l.length&&(u={...u,subRows:o(u.subRows)}),c)return u}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:i}}function R5(e,t){var n;return(n=t[e.id])!=null?n:!1}function $4(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,o=!1;return e.subRows.forEach(a=>{if(!(o&&!i)&&(a.getCanSelect()&&(R5(a,t)?o=!0:i=!1),a.subRows&&a.subRows.length)){const s=$4(a,t);s==="all"?o=!0:(s==="some"&&(o=!0),i=!1)}}),i?"all":o?"some":!1}const I4=/([0-9]+)/gm,iqe=(e,t,n)=>SY(Nl(e.getValue(n)).toLowerCase(),Nl(t.getValue(n)).toLowerCase()),oqe=(e,t,n)=>SY(Nl(e.getValue(n)),Nl(t.getValue(n))),aqe=(e,t,n)=>D5(Nl(e.getValue(n)).toLowerCase(),Nl(t.getValue(n)).toLowerCase()),sqe=(e,t,n)=>D5(Nl(e.getValue(n)),Nl(t.getValue(n))),uqe=(e,t,n)=>{const r=e.getValue(n),i=t.getValue(n);return r>i?1:rD5(e.getValue(n),t.getValue(n));function D5(e,t){return e===t?0:e>t?1:-1}function Nl(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function SY(e,t){const n=e.split(I4).filter(Boolean),r=t.split(I4).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),o=r.shift(),a=parseInt(i,10),s=parseInt(o,10),u=[a,s].sort();if(isNaN(u[0])){if(i>o)return 1;if(o>i)return-1;continue}if(isNaN(u[1]))return isNaN(a)?-1:1;if(a>s)return 1;if(s>a)return-1}return n.length-r.length}const Qp={alphanumeric:iqe,alphanumericCaseSensitive:oqe,text:aqe,textCaseSensitive:sqe,datetime:uqe,basic:lqe},cqe={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Wo("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const o=i?.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Qp.datetime;if(typeof o=="string"&&(r=!0,o.split(I4).length>1))return Qp.alphanumeric}return r?Qp.text:Qp.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof n?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return N2(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Qp[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const i=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(a=>{const s=a?.find(p=>p.id===e.id),u=a?.findIndex(p=>p.id===e.id);let l=[],c,f=o?n:i==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&r?s?c="toggle":c="add":a!=null&&a.length&&u!==a.length-1?c="replace":s?c="toggle":c="replace",c==="toggle"&&(o||i||(c="remove")),c==="add"){var h;l=[...a,{id:e.id,desc:f}],l.splice(0,l.length-((h=t.options.maxMultiSortColCount)!=null?h:Number.MAX_SAFE_INTEGER))}else c==="toggle"?l=a.map(p=>p.id===e.id?{...p,desc:f}:p):c==="remove"?l=a.filter(p=>p.id!==e.id):l=[{id:e.id,desc:f}];return l})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,i;const o=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:a==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(i=>i.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},fqe=[DHe,XHe,KHe,GHe,$He,IHe,QHe,JHe,cqe,HHe,eqe,tqe,nqe,rqe,YHe];function dqe(e){var t,n;const r=[...fqe,...(t=e._features)!=null?t:[]];let i={_features:r};const o=i._features.reduce((h,p)=>Object.assign(h,p.getDefaultOptions==null?void 0:p.getDefaultOptions(i)),{}),a=h=>i.options.mergeOptions?i.options.mergeOptions(o,h):{...o,...h};let u={...{},...(n=e.initialState)!=null?n:{}};i._features.forEach(h=>{var p;u=(p=h.getInitialState==null?void 0:h.getInitialState(u))!=null?p:u});const l=[];let c=!1;const f={_features:r,options:{...o,...e},initialState:u,_queue:h=>{l.push(h),c||(c=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();c=!1}).catch(p=>setTimeout(()=>{throw p})))},reset:()=>{i.setState(i.initialState)},setOptions:h=>{const p=fl(h,i.options);i.options=a(p)},getState:()=>i.options.state,setState:h=>{i.options.onStateChange==null||i.options.onStateChange(h)},_getRowId:(h,p,m)=>{var y;return(y=i.options.getRowId==null?void 0:i.options.getRowId(h,p,m))!=null?y:`${m?[m.id,p].join("."):p}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(h,p)=>{let m=(p?i.getPrePaginationRowModel():i.getRowModel()).rowsById[h];if(!m&&(m=i.getCoreRowModel().rowsById[h],!m))throw new Error;return m},_getDefaultColumnDef:St(()=>[i.options.defaultColumn],h=>{var p;return h=(p=h)!=null?p:{},{header:m=>{const y=m.header.column.columnDef;return y.accessorKey?y.accessorKey:y.accessorFn?y.id:null},cell:m=>{var y,b;return(y=(b=m.renderValue())==null||b.toString==null?void 0:b.toString())!=null?y:null},...i._features.reduce((m,y)=>Object.assign(m,y.getDefaultColumnDef==null?void 0:y.getDefaultColumnDef()),{}),...h}},Ct(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:St(()=>[i._getColumnDefs()],h=>{const p=function(m,y,b){return b===void 0&&(b=0),m.map(w=>{const x=RHe(i,w,b,y),S=w;return x.columns=S.columns?p(S.columns,x,b+1):[],x})};return p(h)},Ct(e,"debugColumns")),getAllFlatColumns:St(()=>[i.getAllColumns()],h=>h.flatMap(p=>p.getFlatColumns()),Ct(e,"debugColumns")),_getAllFlatColumnsById:St(()=>[i.getAllFlatColumns()],h=>h.reduce((p,m)=>(p[m.id]=m,p),{}),Ct(e,"debugColumns")),getAllLeafColumns:St(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(h,p)=>{let m=h.flatMap(y=>y.getLeafColumns());return p(m)},Ct(e,"debugColumns")),getColumn:h=>i._getAllFlatColumnsById()[h]};Object.assign(i,f);for(let h=0;hSt(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,o,a){o===void 0&&(o=0);const s=[];for(let l=0;le._autoResetPageIndex()))}function hqe(e){const t=[],n=r=>{var i;t.push(r),(i=r.subRows)!=null&&i.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function CY(e,t,n){return n.options.filterFromLeafRows?pqe(e,t,n):gqe(e,t,n)}function pqe(e,t,n){var r;const i=[],o={},a=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,s=function(u,l){l===void 0&&(l=0);const c=[];for(let h=0;hSt(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,i)=>{if(!n.rows.length||!(r!=null&&r.length)&&!i)return n;const o=[...r.map(s=>s.id).filter(s=>s!==t),i?"__global__":void 0].filter(Boolean),a=s=>{for(let u=0;uSt(()=>{var n;return[(n=e.getColumn(t))==null?void 0:n.getFacetedRowModel()]},n=>{if(!n)return new Map;let r=new Map;for(let o=0;oSt(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let h=0;h{var p;const m=e.getColumn(h.id);if(!m)return;const y=m.getFilterFn();y&&i.push({id:h.id,filterFn:y,resolvedValue:(p=y.resolveFilterValue==null?void 0:y.resolveFilterValue(h.value))!=null?p:h.value})});const a=(n??[]).map(h=>h.id),s=e.getGlobalFilterFn(),u=e.getAllLeafColumns().filter(h=>h.getCanGlobalFilter());r&&s&&u.length&&(a.push("__global__"),u.forEach(h=>{var p;o.push({id:h.id,filterFn:s,resolvedValue:(p=s.resolveFilterValue==null?void 0:s.resolveFilterValue(r))!=null?p:r})}));let l,c;for(let h=0;h{p.columnFiltersMeta[y]=b})}if(o.length){for(let m=0;m{p.columnFiltersMeta[y]=b})){p.columnFilters.__global__=!0;break}}p.columnFilters.__global__!==!0&&(p.columnFilters.__global__=!1)}}const f=h=>{for(let p=0;pe._autoResetPageIndex()))}function Stt(e){return t=>St(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:i,pageIndex:o}=n;let{rows:a,flatRows:s,rowsById:u}=r;const l=i*o,c=l+i;a=a.slice(l,c);let f;t.options.paginateExpandedRows?f={rows:a,flatRows:s,rowsById:u}:f=hqe({rows:a,flatRows:s,rowsById:u}),f.flatRows=[];const h=p=>{f.flatRows.push(p),p.subRows.length&&p.subRows.forEach(h)};return f.rows.forEach(h),f},Ct(t.options,"debugTable"))}function Ctt(){return e=>St(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,i=[],o=r.filter(u=>{var l;return(l=e.getColumn(u.id))==null?void 0:l.getCanSort()}),a={};o.forEach(u=>{const l=e.getColumn(u.id);l&&(a[u.id]={sortUndefined:l.columnDef.sortUndefined,invertSorting:l.columnDef.invertSorting,sortingFn:l.getSortingFn()})});const s=u=>{const l=u.map(c=>({...c}));return l.sort((c,f)=>{for(let p=0;p{var f;i.push(c),(f=c.subRows)!=null&&f.length&&(c.subRows=s(c.subRows))}),l};return{rows:s(n.rows),flatRows:i,rowsById:n.rowsById}},Ct(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/** * react-table * * Copyright (c) TanStack @@ -558,13 +558,13 @@ Defaulting to \`null\`.`}var mtt=fY,vtt=hY;function kHe(e){const t=v.useRef({val * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Att(e,t){return e?_qe(e)?v.createElement(e,t):e:null}function _qe(e){return Sqe(e)||typeof e=="function"||Cqe(e)}function Sqe(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Cqe(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Ptt(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:yqe(t)})),[r,i]=v.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:a=>{i(a),e.onStateChange==null||e.onStateChange(a)}})),n.current}const kY=Object.freeze({left:0,top:0,width:16,height:16}),Lx=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),I5=Object.freeze({...kY,...Lx}),N4=Object.freeze({...I5,body:"",hidden:!1});function Eqe(e,t){const n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function hN(e,t){const n=Eqe(e,t);for(const r in N4)r in Lx?r in e&&!(r in n)&&(n[r]=Lx[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function Oqe(e,t){const n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function o(a){if(n[a])return i[a]=[];if(!(a in i)){i[a]=null;const s=r[a]&&r[a].parent,u=s&&o(s);u&&(i[a]=[s].concat(u))}return i[a]}return Object.keys(n).concat(Object.keys(r)).forEach(o),i}function Aqe(e,t,n){const r=e.icons,i=e.aliases||Object.create(null);let o={};function a(s){o=hN(r[s]||i[s],o)}return a(t),n.forEach(a),hN(e,o)}function TY(e,t){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(i=>{t(i,null),n.push(i)});const r=Oqe(e);for(const i in r){const o=r[i];o&&(t(i,Aqe(e,i,o)),n.push(i))}return n}const Pqe={provider:"",aliases:{},not_found:{},...kY};function G3(e,t){for(const n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function MY(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!G3(e,Pqe))return null;const n=t.icons;for(const i in n){const o=n[i];if(!i||typeof o.body!="string"||!G3(o,N4))return null}const r=t.aliases||Object.create(null);for(const i in r){const o=r[i],a=o.parent;if(!i||typeof a!="string"||!n[a]&&!r[a]||!G3(o,N4))return null}return t}const RY=/^[a-z0-9]+(-[a-z0-9]+)*$/,L2=(e,t,n,r="")=>{const i=e.split(":");if(e.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const s=i.pop(),u=i.pop(),l={provider:i.length>0?i[0]:r,prefix:u,name:s};return t&&!w1(l)?null:l}const o=i[0],a=o.split("-");if(a.length>1){const s={provider:r,prefix:a.shift(),name:a.join("-")};return t&&!w1(s)?null:s}if(n&&r===""){const s={provider:r,prefix:"",name:o};return t&&!w1(s,n)?null:s}return null},w1=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1,pN=Object.create(null);function kqe(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function cf(e,t){const n=pN[e]||(pN[e]=Object.create(null));return n[t]||(n[t]=kqe(e,t))}function N5(e,t){return MY(t)?TY(t,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function Tqe(e,t,n){try{if(typeof n.body=="string")return e.icons[t]={...n},!0}catch{}return!1}let um=!1;function DY(e){return typeof e=="boolean"&&(um=e),um}function gN(e){const t=typeof e=="string"?L2(e,!0,um):e;if(t){const n=cf(t.provider,t.prefix),r=t.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Mqe(e,t){const n=L2(e,!0,um);if(!n)return!1;const r=cf(n.provider,n.prefix);return t?Tqe(r,n.name,t):(r.missing.add(n.name),!0)}function Rqe(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),um&&!t&&!e.prefix){let i=!1;return MY(e)&&(e.prefix="",TY(e,(o,a)=>{Mqe(o,a)&&(i=!0)})),i}const n=e.prefix;if(!w1({provider:t,prefix:n,name:"a"}))return!1;const r=cf(t,n);return!!N5(r,e)}const $Y=Object.freeze({width:null,height:null}),IY=Object.freeze({...$Y,...Lx}),Dqe=/(-?[0-9.]*[0-9]+[0-9.]*)/g,$qe=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function mN(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const r=e.split(Dqe);if(r===null||!r.length)return e;const i=[];let o=r.shift(),a=$qe.test(o);for(;;){if(a){const s=parseFloat(o);isNaN(s)?i.push(o):i.push(Math.ceil(s*t*n)/n)}else i.push(o);if(o=r.shift(),o===void 0)return i.join("");a=!a}}function Iqe(e,t="defs"){let n="";const r=e.indexOf("<"+t);for(;r>=0;){const i=e.indexOf(">",r),o=e.indexOf("",o);if(a===-1)break;n+=e.slice(i+1,o).trim(),e=e.slice(0,r).trim()+e.slice(a+1)}return{defs:n,content:e}}function Nqe(e,t){return e?""+e+""+t:t}function Lqe(e,t,n){const r=Iqe(e);return Nqe(r.defs,t+r.content+n)}const Fqe=e=>e==="unset"||e==="undefined"||e==="none";function jqe(e,t){const n={...I5,...e},r={...IY,...t},i={left:n.left,top:n.top,width:n.width,height:n.height};let o=n.body;[n,r].forEach(y=>{const b=[],w=y.hFlip,x=y.vFlip;let S=y.rotate;w?x?S+=2:(b.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),b.push("scale(-1 1)"),i.top=i.left=0):x&&(b.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),b.push("scale(1 -1)"),i.top=i.left=0);let O;switch(S<0&&(S-=Math.floor(S/4)*4),S=S%4,S){case 1:O=i.height/2+i.top,b.unshift("rotate(90 "+O.toString()+" "+O.toString()+")");break;case 2:b.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:O=i.width/2+i.left,b.unshift("rotate(-90 "+O.toString()+" "+O.toString()+")");break}S%2===1&&(i.left!==i.top&&(O=i.left,i.left=i.top,i.top=O),i.width!==i.height&&(O=i.width,i.width=i.height,i.height=O)),b.length&&(o=Lqe(o,'',""))});const a=r.width,s=r.height,u=i.width,l=i.height;let c,f;a===null?(f=s===null?"1em":s==="auto"?l:s,c=mN(f,u/l)):(c=a==="auto"?u:a,f=s===null?mN(c,l/u):s==="auto"?l:s);const h={},p=(y,b)=>{Fqe(b)||(h[y]=b.toString())};p("width",c),p("height",f);const m=[i.left,i.top,u,l];return h.viewBox=m.join(" "),{attributes:h,viewBox:m,body:o}}const Bqe=/\sid="(\S+)"/g,Uqe="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let zqe=0;function Wqe(e,t=Uqe){const n=[];let r;for(;r=Bqe.exec(e);)n.push(r[1]);if(!n.length)return e;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(o=>{const a=typeof t=="function"?t(o):t+(zqe++).toString(),s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+s+')([")]|\\.[a-z])',"g"),"$1"+a+i+"$3")}),e=e.replace(new RegExp(i,"g"),""),e}const L4=Object.create(null);function Vqe(e,t){L4[e]=t}function F4(e){return L4[e]||L4[""]}function L5(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const F5=Object.create(null),Jp=["https://api.simplesvg.com","https://api.unisvg.com"],_1=[];for(;Jp.length>0;)Jp.length===1||Math.random()>.5?_1.push(Jp.shift()):_1.push(Jp.pop());F5[""]=L5({resources:["https://api.iconify.design"].concat(_1)});function Hqe(e,t){const n=L5(t);return n===null?!1:(F5[e]=n,!0)}function j5(e){return F5[e]}const qqe=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let vN=qqe();function Kqe(e,t){const n=j5(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let i=0;n.resources.forEach(a=>{i=Math.max(i,a.length)});const o=t+".json?icons=";r=n.maxURL-i-n.path.length-o.length}return r}function Gqe(e){return e===404}const Yqe=(e,t,n)=>{const r=[],i=Kqe(e,t),o="icons";let a={type:o,provider:e,prefix:t,icons:[]},s=0;return n.forEach((u,l)=>{s+=u.length+1,s>=i&&l>0&&(r.push(a),a={type:o,provider:e,prefix:t,icons:[]},s=u.length),a.icons.push(u)}),r.push(a),r};function Zqe(e){if(typeof e=="string"){const t=j5(e);if(t)return t.path}return"/"}const Xqe=(e,t,n)=>{if(!vN){n("abort",424);return}let r=Zqe(t.provider);switch(t.type){case"icons":{const o=t.prefix,s=t.icons.join(","),u=new URLSearchParams({icons:s});r+=o+".json?"+u.toString();break}case"custom":{const o=t.uri;r+=o.slice(0,1)==="/"?o.slice(1):o;break}default:n("abort",400);return}let i=503;vN(e+r).then(o=>{const a=o.status;if(a!==200){setTimeout(()=>{n(Gqe(a)?"abort":"next",a)});return}return i=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?n("abort",o):n("next",i)});return}setTimeout(()=>{n("success",o)})}).catch(()=>{n("next",i)})},Qqe={prepare:Yqe,send:Xqe};function Jqe(e){const t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((i,o)=>i.provider!==o.provider?i.provider.localeCompare(o.provider):i.prefix!==o.prefix?i.prefix.localeCompare(o.prefix):i.name.localeCompare(o.name));let r={provider:"",prefix:"",name:""};return e.forEach(i=>{if(r.name===i.name&&r.prefix===i.prefix&&r.provider===i.provider)return;r=i;const o=i.provider,a=i.prefix,s=i.name,u=n[o]||(n[o]=Object.create(null)),l=u[a]||(u[a]=cf(o,a));let c;s in l.icons?c=t.loaded:a===""||l.missing.has(s)?c=t.missing:c=t.pending;const f={provider:o,prefix:a,name:s};c.push(f)}),t}function NY(e,t){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(i=>i.id!==t))})}function eKe(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1;const r=e.provider,i=e.prefix;t.forEach(o=>{const a=o.icons,s=a.pending.length;a.pending=a.pending.filter(u=>{if(u.prefix!==i)return!0;const l=u.name;if(e.icons[l])a.loaded.push({provider:r,prefix:i,name:l});else if(e.missing.has(l))a.missing.push({provider:r,prefix:i,name:l});else return n=!0,!0;return!1}),a.pending.length!==s&&(n||NY([e],o.id),o.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),o.abort))})}))}let tKe=0;function nKe(e,t,n){const r=tKe++,i=NY.bind(null,n,r);if(!t.pending.length)return i;const o={id:r,icons:t,callback:e,abort:i};return n.forEach(a=>{(a.loaderCallbacks||(a.loaderCallbacks=[])).push(o)}),i}function rKe(e,t=!0,n=!1){const r=[];return e.forEach(i=>{const o=typeof i=="string"?L2(i,t,n):i;o&&r.push(o)}),r}var iKe={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function oKe(e,t,n,r){const i=e.resources.length,o=e.random?Math.floor(Math.random()*i):e.index;let a;if(e.random){let C=e.resources.slice(0);for(a=[];C.length>1;){const P=Math.floor(Math.random()*C.length);a.push(C[P]),C=C.slice(0,P).concat(C.slice(P+1))}a=a.concat(C)}else a=e.resources.slice(o).concat(e.resources.slice(0,o));const s=Date.now();let u="pending",l=0,c,f=null,h=[],p=[];typeof r=="function"&&p.push(r);function m(){f&&(clearTimeout(f),f=null)}function y(){u==="pending"&&(u="aborted"),m(),h.forEach(C=>{C.status==="pending"&&(C.status="aborted")}),h=[]}function b(C,P){P&&(p=[]),typeof C=="function"&&p.push(C)}function w(){return{startTime:s,payload:t,status:u,queriesSent:l,queriesPending:h.length,subscribe:b,abort:y}}function x(){u="failed",p.forEach(C=>{C(void 0,c)})}function S(){h.forEach(C=>{C.status==="pending"&&(C.status="aborted")}),h=[]}function O(C,P,M){const N=P!=="success";switch(h=h.filter(B=>B!==C),u){case"pending":break;case"failed":if(N||!e.dataAfterTimeout)return;break;default:return}if(P==="abort"){c=M,x();return}if(N){c=M,h.length||(a.length?E():x());return}if(m(),S(),!e.random){const B=e.resources.indexOf(C.resource);B!==-1&&B!==e.index&&(e.index=B)}u="completed",p.forEach(B=>{B(M)})}function E(){if(u!=="pending")return;m();const C=a.shift();if(C===void 0){if(h.length){f=setTimeout(()=>{m(),u==="pending"&&(S(),x())},e.timeout);return}x();return}const P={status:"pending",resource:C,callback:(M,N)=>{O(P,M,N)}};h.push(P),l++,f=setTimeout(E,e.rotate),n(C,t,P.callback)}return setTimeout(E),w}function LY(e){const t={...iKe,...e};let n=[];function r(){n=n.filter(s=>s().status==="pending")}function i(s,u,l){const c=oKe(t,s,u,(f,h)=>{r(),l&&l(f,h)});return n.push(c),c}function o(s){return n.find(u=>s(u))||null}return{query:i,find:o,setIndex:s=>{t.index=s},getIndex:()=>t.index,cleanup:r}}function yN(){}const Y3=Object.create(null);function aKe(e){if(!Y3[e]){const t=j5(e);if(!t)return;const n=LY(t),r={config:t,redundancy:n};Y3[e]=r}return Y3[e]}function sKe(e,t,n){let r,i;if(typeof e=="string"){const o=F4(e);if(!o)return n(void 0,424),yN;i=o.send;const a=aKe(e);a&&(r=a.redundancy)}else{const o=L5(e);if(o){r=LY(o);const a=e.resources?e.resources[0]:"",s=F4(a);s&&(i=s.send)}}return!r||!i?(n(void 0,424),yN):r.query(t,i,n)().abort}const bN="iconify2",lm="iconify",FY=lm+"-count",xN=lm+"-version",jY=36e5,uKe=168,lKe=50;function j4(e,t){try{return e.getItem(t)}catch{}}function B5(e,t,n){try{return e.setItem(t,n),!0}catch{}}function wN(e,t){try{e.removeItem(t)}catch{}}function B4(e,t){return B5(e,FY,t.toString())}function U4(e){return parseInt(j4(e,FY))||0}const F2={local:!0,session:!0},BY={local:new Set,session:new Set};let U5=!1;function cKe(e){U5=e}let qy=typeof window>"u"?{}:window;function UY(e){const t=e+"Storage";try{if(qy&&qy[t]&&typeof qy[t].length=="number")return qy[t]}catch{}F2[e]=!1}function zY(e,t){const n=UY(e);if(!n)return;const r=j4(n,xN);if(r!==bN){if(r){const s=U4(n);for(let u=0;u{const u=lm+s.toString(),l=j4(n,u);if(typeof l=="string"){try{const c=JSON.parse(l);if(typeof c=="object"&&typeof c.cached=="number"&&c.cached>i&&typeof c.provider=="string"&&typeof c.data=="object"&&typeof c.data.prefix=="string"&&t(c,s))return!0}catch{}wN(n,u)}};let a=U4(n);for(let s=a-1;s>=0;s--)o(s)||(s===a-1?(a--,B4(n,a)):BY[e].add(s))}function WY(){if(!U5){cKe(!0);for(const e in F2)zY(e,t=>{const n=t.data,r=t.provider,i=n.prefix,o=cf(r,i);if(!N5(o,n).length)return!1;const a=n.lastModified||-1;return o.lastModifiedCached=o.lastModifiedCached?Math.min(o.lastModifiedCached,a):a,!0})}}function fKe(e,t){const n=e.lastModifiedCached;if(n&&n>=t)return n===t;if(e.lastModifiedCached=t,n)for(const r in F2)zY(r,i=>{const o=i.data;return i.provider!==e.provider||o.prefix!==e.prefix||o.lastModified===t});return!0}function dKe(e,t){U5||WY();function n(r){let i;if(!F2[r]||!(i=UY(r)))return;const o=BY[r];let a;if(o.size)o.delete(a=Array.from(o).shift());else if(a=U4(i),a>=lKe||!B4(i,a+1))return;const s={cached:Math.floor(Date.now()/jY),provider:e.provider,data:t};return B5(i,lm+a.toString(),JSON.stringify(s))}t.lastModified&&!fKe(e,t.lastModified)||Object.keys(t.icons).length&&(t.not_found&&(t=Object.assign({},t),delete t.not_found),n("local")||n("session"))}function hKe(){}function pKe(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,eKe(e)}))}function gKe(e){const t=[],n=[];return e.forEach(r=>{(r.match(RY)?t:n).push(r)}),{valid:t,invalid:n}}function e0(e,t,n,r){function i(){const o=e.pendingIcons;t.forEach(a=>{o&&o.delete(a),e.icons[a]||e.missing.add(a)})}if(n&&typeof n=="object")try{if(!N5(e,n).length){i();return}r&&dKe(e,n)}catch(o){console.error(o)}i(),pKe(e)}function _N(e,t){e instanceof Promise?e.then(n=>{t(n)}).catch(()=>{t(null)}):t(e)}function mKe(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,i=e.iconsToLoad;if(delete e.iconsToLoad,!i||!i.length)return;const o=e.loadIcon;if(e.loadIcons&&(i.length>1||!o)){_N(e.loadIcons(i,r,n),c=>{e0(e,i,c,!1)});return}if(o){i.forEach(c=>{const f=o(c,r,n);_N(f,h=>{const p=h?{prefix:r,icons:{[c]:h}}:null;e0(e,[c],p,!1)})});return}const{valid:a,invalid:s}=gKe(i);if(s.length&&e0(e,s,null,!1),!a.length)return;const u=r.match(RY)?F4(n):null;if(!u){e0(e,a,null,!1);return}u.prepare(n,r,a).forEach(c=>{sKe(n,c,f=>{e0(e,c.icons,f,!0)})})}))}const vKe=(e,t)=>{const n=rKe(e,!0,DY()),r=Jqe(n);if(!r.pending.length){let u=!0;return setTimeout(()=>{u&&t(r.loaded,r.missing,r.pending,hKe)}),()=>{u=!1}}const i=Object.create(null),o=[];let a,s;return r.pending.forEach(u=>{const{provider:l,prefix:c}=u;if(c===s&&l===a)return;a=l,s=c,o.push(cf(l,c));const f=i[l]||(i[l]=Object.create(null));f[c]||(f[c]=[])}),r.pending.forEach(u=>{const{provider:l,prefix:c,name:f}=u,h=cf(l,c),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(f)||(p.add(f),i[l][c].push(f))}),o.forEach(u=>{const l=i[u.provider][u.prefix];l.length&&mKe(u,l)}),nKe(t,r,o)};function yKe(e,t){const n={...e};for(const r in t){const i=t[r],o=typeof i;r in $Y?(i===null||i&&(o==="string"||o==="number"))&&(n[r]=i):o===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const bKe=/[\s,]+/;function xKe(e,t){t.split(bKe).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function wKe(e,t=0){const n=e.replace(/^-?[0-9.]*/,"");function r(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(e);return isNaN(i)?0:r(i)}else if(n!==e){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let o=parseFloat(e.slice(0,e.length-n.length));return isNaN(o)?0:(o=o/i,o%1===0?r(o):0)}}return t}function _Ke(e,t){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in t)n+=" "+r+'="'+t[r]+'"';return'"+e+""}function SKe(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function CKe(e){return"data:image/svg+xml,"+SKe(e)}function EKe(e){return'url("'+CKe(e)+'")'}let I0;function OKe(){try{I0=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{I0=null}}function AKe(e){return I0===void 0&&OKe(),I0?I0.createHTML(e):e}const VY={...IY,inline:!1},PKe={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},kKe={display:"inline-block"},z4={backgroundColor:"currentColor"},HY={backgroundColor:"transparent"},SN={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},CN={WebkitMask:z4,mask:z4,background:HY};for(const e in CN){const t=CN[e];for(const n in SN)t[e+n]=SN[n]}const TKe={...VY,inline:!0};function EN(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const MKe=(e,t,n)=>{const r=t.inline?TKe:VY,i=yKe(r,t),o=t.mode||"svg",a={},s=t.style||{},u={...o==="svg"?PKe:{}};if(n){const b=L2(n,!1,!0);if(b){const w=["iconify"],x=["provider","prefix"];for(const S of x)b[S]&&w.push("iconify--"+b[S]);u.className=w.join(" ")}}for(let b in t){const w=t[b];if(w!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":break;case"_ref":u.ref=w;break;case"className":u[b]=(u[b]?u[b]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":i[b]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&xKe(i,w);break;case"color":a.color=w;break;case"rotate":typeof w=="string"?i[b]=wKe(w):typeof w=="number"&&(i[b]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete u["aria-hidden"];break;default:r[b]===void 0&&(u[b]=w)}}const l=jqe(e,i),c=l.attributes;if(i.inline&&(a.verticalAlign="-0.125em"),o==="svg"){u.style={...a,...s},Object.assign(u,c);let b=0,w=t.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),u.dangerouslySetInnerHTML={__html:AKe(Wqe(l.body,w?()=>w+"ID"+b++:"iconifyReact"))},v.createElement("svg",u)}const{body:f,width:h,height:p}=e,m=o==="mask"||(o==="bg"?!1:f.indexOf("currentColor")!==-1),y=_Ke(f,{...c,width:h+"",height:p+""});return u.style={...a,"--svg":EKe(y),width:EN(c.width),height:EN(c.height),...kKe,...m?z4:HY,...s},v.createElement("span",u)};DY(!0);Vqe("",Qqe);if(typeof document<"u"&&typeof window<"u"){WY();const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Rqe(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let n in t){const r="IconifyProviders["+n+"] is invalid.";try{const i=t[n];if(typeof i!="object"||!i||i.resources===void 0)continue;Hqe(n,i)||console.error(r)}catch{console.error(r)}}}}function qY(e){const[t,n]=v.useState(!!e.ssr),[r,i]=v.useState({});function o(p){if(p){const m=e.icon;if(typeof m=="object")return{name:"",data:m};const y=gN(m);if(y)return{name:m,data:y}}return{name:""}}const[a,s]=v.useState(o(!!e.ssr));function u(){const p=r.callback;p&&(p(),i({}))}function l(p){if(JSON.stringify(a)!==JSON.stringify(p))return u(),s(p),!0}function c(){var p;const m=e.icon;if(typeof m=="object"){l({name:"",data:m});return}const y=gN(m);if(l({name:m,data:y}))if(y===void 0){const b=vKe([m],c);i({callback:b})}else y&&((p=e.onLoad)===null||p===void 0||p.call(e,m))}v.useEffect(()=>(n(!0),u),[]),v.useEffect(()=>{t&&c()},[e.icon,t]);const{name:f,data:h}=a;return h?MKe({...I5,...h},e,f):e.children?e.children:v.createElement("span",{})}const ktt=v.forwardRef((e,t)=>qY({...e,_ref:t}));v.forwardRef((e,t)=>qY({inline:!0,...e,_ref:t}));var KY="AlertDialog",[RKe,Ttt]=Di(KY,[uz]),Du=uz(),GY=e=>{const{__scopeAlertDialog:t,...n}=e,r=Du(t);return I.jsx(yve,{...r,...n,modal:!0})};GY.displayName=KY;var DKe="AlertDialogTrigger",YY=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(bve,{...i,...r,ref:t})});YY.displayName=DKe;var $Ke="AlertDialogPortal",ZY=e=>{const{__scopeAlertDialog:t,...n}=e,r=Du(t);return I.jsx(xve,{...r,...n})};ZY.displayName=$Ke;var IKe="AlertDialogOverlay",XY=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(wve,{...i,...r,ref:t})});XY.displayName=IKe;var jd="AlertDialogContent",[NKe,LKe]=RKe(jd),QY=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...i}=e,o=Du(n),a=v.useRef(null),s=Nt(t,a),u=v.useRef(null);return I.jsx(pve,{contentName:jd,titleName:JY,docsSlug:"alert-dialog",children:I.jsx(NKe,{scope:n,cancelRef:u,children:I.jsxs(_ve,{role:"alertdialog",...o,...i,ref:s,onOpenAutoFocus:Ye(i.onOpenAutoFocus,l=>{l.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:l=>l.preventDefault(),onInteractOutside:l=>l.preventDefault(),children:[I.jsx(ZO,{children:r}),I.jsx(jKe,{contentRef:a})]})})})});QY.displayName=jd;var JY="AlertDialogTitle",eZ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(Sve,{...i,...r,ref:t})});eZ.displayName=JY;var tZ="AlertDialogDescription",nZ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(Cve,{...i,...r,ref:t})});nZ.displayName=tZ;var FKe="AlertDialogAction",rZ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(Cz,{...i,...r,ref:t})});rZ.displayName=FKe;var iZ="AlertDialogCancel",oZ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=LKe(iZ,n),o=Du(n),a=Nt(t,i);return I.jsx(Cz,{...o,...r,ref:a})});oZ.displayName=iZ;var jKe=({contentRef:e})=>{const t=`\`${jd}\` requires a description for the component to be accessible for screen reader users. + */function Ett(e,t){return e?mqe(e)?v.createElement(e,t):e:null}function mqe(e){return vqe(e)||typeof e=="function"||yqe(e)}function vqe(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function yqe(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Ott(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=v.useState(()=>({current:dqe(t)})),[r,i]=v.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:a=>{i(a),e.onStateChange==null||e.onStateChange(a)}})),n.current}function bqe(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function xqe(e){const[t,n]=v.useState(void 0);return On(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,s;if("borderBoxSize"in o){const u=o.borderBoxSize,l=Array.isArray(u)?u[0]:u;a=l.inlineSize,s=l.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var $5="Switch",[wqe,Att]=Di($5),[_qe,Sqe]=wqe($5),EY=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:o,required:a,disabled:s,value:u="on",onCheckedChange:l,form:c,...f}=e,[h,p]=v.useState(null),m=Nt(t,S=>p(S)),y=v.useRef(!1),b=h?c||!!h.closest("form"):!0,[w=!1,x]=Ts({prop:i,defaultProp:o,onChange:l});return I.jsxs(_qe,{scope:n,checked:w,disabled:s,children:[I.jsx(gt.button,{type:"button",role:"switch","aria-checked":w,"aria-required":a,"data-state":PY(w),"data-disabled":s?"":void 0,disabled:s,value:u,...f,ref:m,onClick:Ye(e.onClick,S=>{x(O=>!O),b&&(y.current=S.isPropagationStopped(),y.current||S.stopPropagation())})}),b&&I.jsx(Cqe,{control:h,bubbles:!y.current,name:r,value:u,checked:w,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"}})]})});EY.displayName=$5;var OY="SwitchThumb",AY=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=Sqe(OY,n);return I.jsx(gt.span,{"data-state":PY(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});AY.displayName=OY;var Cqe=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=v.useRef(null),a=bqe(n),s=xqe(t);return v.useEffect(()=>{const u=o.current,l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"checked").set;if(a!==n&&f){const h=new Event("click",{bubbles:r});f.call(u,n),u.dispatchEvent(h)}},[a,n,r]),I.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function PY(e){return e?"checked":"unchecked"}var Ptt=EY,ktt=AY;const kY=Object.freeze({left:0,top:0,width:16,height:16}),Lx=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),I5=Object.freeze({...kY,...Lx}),N4=Object.freeze({...I5,body:"",hidden:!1});function Eqe(e,t){const n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function hN(e,t){const n=Eqe(e,t);for(const r in N4)r in Lx?r in e&&!(r in n)&&(n[r]=Lx[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function Oqe(e,t){const n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function o(a){if(n[a])return i[a]=[];if(!(a in i)){i[a]=null;const s=r[a]&&r[a].parent,u=s&&o(s);u&&(i[a]=[s].concat(u))}return i[a]}return Object.keys(n).concat(Object.keys(r)).forEach(o),i}function Aqe(e,t,n){const r=e.icons,i=e.aliases||Object.create(null);let o={};function a(s){o=hN(r[s]||i[s],o)}return a(t),n.forEach(a),hN(e,o)}function TY(e,t){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(i=>{t(i,null),n.push(i)});const r=Oqe(e);for(const i in r){const o=r[i];o&&(t(i,Aqe(e,i,o)),n.push(i))}return n}const Pqe={provider:"",aliases:{},not_found:{},...kY};function G3(e,t){for(const n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function MY(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!G3(e,Pqe))return null;const n=t.icons;for(const i in n){const o=n[i];if(!i||typeof o.body!="string"||!G3(o,N4))return null}const r=t.aliases||Object.create(null);for(const i in r){const o=r[i],a=o.parent;if(!i||typeof a!="string"||!n[a]&&!r[a]||!G3(o,N4))return null}return t}const RY=/^[a-z0-9]+(-[a-z0-9]+)*$/,L2=(e,t,n,r="")=>{const i=e.split(":");if(e.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const s=i.pop(),u=i.pop(),l={provider:i.length>0?i[0]:r,prefix:u,name:s};return t&&!w1(l)?null:l}const o=i[0],a=o.split("-");if(a.length>1){const s={provider:r,prefix:a.shift(),name:a.join("-")};return t&&!w1(s)?null:s}if(n&&r===""){const s={provider:r,prefix:"",name:o};return t&&!w1(s,n)?null:s}return null},w1=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1,pN=Object.create(null);function kqe(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function cf(e,t){const n=pN[e]||(pN[e]=Object.create(null));return n[t]||(n[t]=kqe(e,t))}function N5(e,t){return MY(t)?TY(t,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function Tqe(e,t,n){try{if(typeof n.body=="string")return e.icons[t]={...n},!0}catch{}return!1}let um=!1;function DY(e){return typeof e=="boolean"&&(um=e),um}function gN(e){const t=typeof e=="string"?L2(e,!0,um):e;if(t){const n=cf(t.provider,t.prefix),r=t.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Mqe(e,t){const n=L2(e,!0,um);if(!n)return!1;const r=cf(n.provider,n.prefix);return t?Tqe(r,n.name,t):(r.missing.add(n.name),!0)}function Rqe(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),um&&!t&&!e.prefix){let i=!1;return MY(e)&&(e.prefix="",TY(e,(o,a)=>{Mqe(o,a)&&(i=!0)})),i}const n=e.prefix;if(!w1({provider:t,prefix:n,name:"a"}))return!1;const r=cf(t,n);return!!N5(r,e)}const $Y=Object.freeze({width:null,height:null}),IY=Object.freeze({...$Y,...Lx}),Dqe=/(-?[0-9.]*[0-9]+[0-9.]*)/g,$qe=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function mN(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const r=e.split(Dqe);if(r===null||!r.length)return e;const i=[];let o=r.shift(),a=$qe.test(o);for(;;){if(a){const s=parseFloat(o);isNaN(s)?i.push(o):i.push(Math.ceil(s*t*n)/n)}else i.push(o);if(o=r.shift(),o===void 0)return i.join("");a=!a}}function Iqe(e,t="defs"){let n="";const r=e.indexOf("<"+t);for(;r>=0;){const i=e.indexOf(">",r),o=e.indexOf("",o);if(a===-1)break;n+=e.slice(i+1,o).trim(),e=e.slice(0,r).trim()+e.slice(a+1)}return{defs:n,content:e}}function Nqe(e,t){return e?""+e+""+t:t}function Lqe(e,t,n){const r=Iqe(e);return Nqe(r.defs,t+r.content+n)}const Fqe=e=>e==="unset"||e==="undefined"||e==="none";function jqe(e,t){const n={...I5,...e},r={...IY,...t},i={left:n.left,top:n.top,width:n.width,height:n.height};let o=n.body;[n,r].forEach(y=>{const b=[],w=y.hFlip,x=y.vFlip;let S=y.rotate;w?x?S+=2:(b.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),b.push("scale(-1 1)"),i.top=i.left=0):x&&(b.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),b.push("scale(1 -1)"),i.top=i.left=0);let O;switch(S<0&&(S-=Math.floor(S/4)*4),S=S%4,S){case 1:O=i.height/2+i.top,b.unshift("rotate(90 "+O.toString()+" "+O.toString()+")");break;case 2:b.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:O=i.width/2+i.left,b.unshift("rotate(-90 "+O.toString()+" "+O.toString()+")");break}S%2===1&&(i.left!==i.top&&(O=i.left,i.left=i.top,i.top=O),i.width!==i.height&&(O=i.width,i.width=i.height,i.height=O)),b.length&&(o=Lqe(o,'',""))});const a=r.width,s=r.height,u=i.width,l=i.height;let c,f;a===null?(f=s===null?"1em":s==="auto"?l:s,c=mN(f,u/l)):(c=a==="auto"?u:a,f=s===null?mN(c,l/u):s==="auto"?l:s);const h={},p=(y,b)=>{Fqe(b)||(h[y]=b.toString())};p("width",c),p("height",f);const m=[i.left,i.top,u,l];return h.viewBox=m.join(" "),{attributes:h,viewBox:m,body:o}}const Bqe=/\sid="(\S+)"/g,Uqe="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let zqe=0;function Wqe(e,t=Uqe){const n=[];let r;for(;r=Bqe.exec(e);)n.push(r[1]);if(!n.length)return e;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(o=>{const a=typeof t=="function"?t(o):t+(zqe++).toString(),s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+s+')([")]|\\.[a-z])',"g"),"$1"+a+i+"$3")}),e=e.replace(new RegExp(i,"g"),""),e}const L4=Object.create(null);function Vqe(e,t){L4[e]=t}function F4(e){return L4[e]||L4[""]}function L5(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const F5=Object.create(null),Jp=["https://api.simplesvg.com","https://api.unisvg.com"],_1=[];for(;Jp.length>0;)Jp.length===1||Math.random()>.5?_1.push(Jp.shift()):_1.push(Jp.pop());F5[""]=L5({resources:["https://api.iconify.design"].concat(_1)});function Hqe(e,t){const n=L5(t);return n===null?!1:(F5[e]=n,!0)}function j5(e){return F5[e]}const qqe=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let vN=qqe();function Kqe(e,t){const n=j5(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let i=0;n.resources.forEach(a=>{i=Math.max(i,a.length)});const o=t+".json?icons=";r=n.maxURL-i-n.path.length-o.length}return r}function Gqe(e){return e===404}const Yqe=(e,t,n)=>{const r=[],i=Kqe(e,t),o="icons";let a={type:o,provider:e,prefix:t,icons:[]},s=0;return n.forEach((u,l)=>{s+=u.length+1,s>=i&&l>0&&(r.push(a),a={type:o,provider:e,prefix:t,icons:[]},s=u.length),a.icons.push(u)}),r.push(a),r};function Zqe(e){if(typeof e=="string"){const t=j5(e);if(t)return t.path}return"/"}const Xqe=(e,t,n)=>{if(!vN){n("abort",424);return}let r=Zqe(t.provider);switch(t.type){case"icons":{const o=t.prefix,s=t.icons.join(","),u=new URLSearchParams({icons:s});r+=o+".json?"+u.toString();break}case"custom":{const o=t.uri;r+=o.slice(0,1)==="/"?o.slice(1):o;break}default:n("abort",400);return}let i=503;vN(e+r).then(o=>{const a=o.status;if(a!==200){setTimeout(()=>{n(Gqe(a)?"abort":"next",a)});return}return i=501,o.json()}).then(o=>{if(typeof o!="object"||o===null){setTimeout(()=>{o===404?n("abort",o):n("next",i)});return}setTimeout(()=>{n("success",o)})}).catch(()=>{n("next",i)})},Qqe={prepare:Yqe,send:Xqe};function Jqe(e){const t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((i,o)=>i.provider!==o.provider?i.provider.localeCompare(o.provider):i.prefix!==o.prefix?i.prefix.localeCompare(o.prefix):i.name.localeCompare(o.name));let r={provider:"",prefix:"",name:""};return e.forEach(i=>{if(r.name===i.name&&r.prefix===i.prefix&&r.provider===i.provider)return;r=i;const o=i.provider,a=i.prefix,s=i.name,u=n[o]||(n[o]=Object.create(null)),l=u[a]||(u[a]=cf(o,a));let c;s in l.icons?c=t.loaded:a===""||l.missing.has(s)?c=t.missing:c=t.pending;const f={provider:o,prefix:a,name:s};c.push(f)}),t}function NY(e,t){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(i=>i.id!==t))})}function eKe(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1;const r=e.provider,i=e.prefix;t.forEach(o=>{const a=o.icons,s=a.pending.length;a.pending=a.pending.filter(u=>{if(u.prefix!==i)return!0;const l=u.name;if(e.icons[l])a.loaded.push({provider:r,prefix:i,name:l});else if(e.missing.has(l))a.missing.push({provider:r,prefix:i,name:l});else return n=!0,!0;return!1}),a.pending.length!==s&&(n||NY([e],o.id),o.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),o.abort))})}))}let tKe=0;function nKe(e,t,n){const r=tKe++,i=NY.bind(null,n,r);if(!t.pending.length)return i;const o={id:r,icons:t,callback:e,abort:i};return n.forEach(a=>{(a.loaderCallbacks||(a.loaderCallbacks=[])).push(o)}),i}function rKe(e,t=!0,n=!1){const r=[];return e.forEach(i=>{const o=typeof i=="string"?L2(i,t,n):i;o&&r.push(o)}),r}var iKe={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function oKe(e,t,n,r){const i=e.resources.length,o=e.random?Math.floor(Math.random()*i):e.index;let a;if(e.random){let C=e.resources.slice(0);for(a=[];C.length>1;){const P=Math.floor(Math.random()*C.length);a.push(C[P]),C=C.slice(0,P).concat(C.slice(P+1))}a=a.concat(C)}else a=e.resources.slice(o).concat(e.resources.slice(0,o));const s=Date.now();let u="pending",l=0,c,f=null,h=[],p=[];typeof r=="function"&&p.push(r);function m(){f&&(clearTimeout(f),f=null)}function y(){u==="pending"&&(u="aborted"),m(),h.forEach(C=>{C.status==="pending"&&(C.status="aborted")}),h=[]}function b(C,P){P&&(p=[]),typeof C=="function"&&p.push(C)}function w(){return{startTime:s,payload:t,status:u,queriesSent:l,queriesPending:h.length,subscribe:b,abort:y}}function x(){u="failed",p.forEach(C=>{C(void 0,c)})}function S(){h.forEach(C=>{C.status==="pending"&&(C.status="aborted")}),h=[]}function O(C,P,M){const N=P!=="success";switch(h=h.filter(B=>B!==C),u){case"pending":break;case"failed":if(N||!e.dataAfterTimeout)return;break;default:return}if(P==="abort"){c=M,x();return}if(N){c=M,h.length||(a.length?E():x());return}if(m(),S(),!e.random){const B=e.resources.indexOf(C.resource);B!==-1&&B!==e.index&&(e.index=B)}u="completed",p.forEach(B=>{B(M)})}function E(){if(u!=="pending")return;m();const C=a.shift();if(C===void 0){if(h.length){f=setTimeout(()=>{m(),u==="pending"&&(S(),x())},e.timeout);return}x();return}const P={status:"pending",resource:C,callback:(M,N)=>{O(P,M,N)}};h.push(P),l++,f=setTimeout(E,e.rotate),n(C,t,P.callback)}return setTimeout(E),w}function LY(e){const t={...iKe,...e};let n=[];function r(){n=n.filter(s=>s().status==="pending")}function i(s,u,l){const c=oKe(t,s,u,(f,h)=>{r(),l&&l(f,h)});return n.push(c),c}function o(s){return n.find(u=>s(u))||null}return{query:i,find:o,setIndex:s=>{t.index=s},getIndex:()=>t.index,cleanup:r}}function yN(){}const Y3=Object.create(null);function aKe(e){if(!Y3[e]){const t=j5(e);if(!t)return;const n=LY(t),r={config:t,redundancy:n};Y3[e]=r}return Y3[e]}function sKe(e,t,n){let r,i;if(typeof e=="string"){const o=F4(e);if(!o)return n(void 0,424),yN;i=o.send;const a=aKe(e);a&&(r=a.redundancy)}else{const o=L5(e);if(o){r=LY(o);const a=e.resources?e.resources[0]:"",s=F4(a);s&&(i=s.send)}}return!r||!i?(n(void 0,424),yN):r.query(t,i,n)().abort}const bN="iconify2",lm="iconify",FY=lm+"-count",xN=lm+"-version",jY=36e5,uKe=168,lKe=50;function j4(e,t){try{return e.getItem(t)}catch{}}function B5(e,t,n){try{return e.setItem(t,n),!0}catch{}}function wN(e,t){try{e.removeItem(t)}catch{}}function B4(e,t){return B5(e,FY,t.toString())}function U4(e){return parseInt(j4(e,FY))||0}const F2={local:!0,session:!0},BY={local:new Set,session:new Set};let U5=!1;function cKe(e){U5=e}let qy=typeof window>"u"?{}:window;function UY(e){const t=e+"Storage";try{if(qy&&qy[t]&&typeof qy[t].length=="number")return qy[t]}catch{}F2[e]=!1}function zY(e,t){const n=UY(e);if(!n)return;const r=j4(n,xN);if(r!==bN){if(r){const s=U4(n);for(let u=0;u{const u=lm+s.toString(),l=j4(n,u);if(typeof l=="string"){try{const c=JSON.parse(l);if(typeof c=="object"&&typeof c.cached=="number"&&c.cached>i&&typeof c.provider=="string"&&typeof c.data=="object"&&typeof c.data.prefix=="string"&&t(c,s))return!0}catch{}wN(n,u)}};let a=U4(n);for(let s=a-1;s>=0;s--)o(s)||(s===a-1?(a--,B4(n,a)):BY[e].add(s))}function WY(){if(!U5){cKe(!0);for(const e in F2)zY(e,t=>{const n=t.data,r=t.provider,i=n.prefix,o=cf(r,i);if(!N5(o,n).length)return!1;const a=n.lastModified||-1;return o.lastModifiedCached=o.lastModifiedCached?Math.min(o.lastModifiedCached,a):a,!0})}}function fKe(e,t){const n=e.lastModifiedCached;if(n&&n>=t)return n===t;if(e.lastModifiedCached=t,n)for(const r in F2)zY(r,i=>{const o=i.data;return i.provider!==e.provider||o.prefix!==e.prefix||o.lastModified===t});return!0}function dKe(e,t){U5||WY();function n(r){let i;if(!F2[r]||!(i=UY(r)))return;const o=BY[r];let a;if(o.size)o.delete(a=Array.from(o).shift());else if(a=U4(i),a>=lKe||!B4(i,a+1))return;const s={cached:Math.floor(Date.now()/jY),provider:e.provider,data:t};return B5(i,lm+a.toString(),JSON.stringify(s))}t.lastModified&&!fKe(e,t.lastModified)||Object.keys(t.icons).length&&(t.not_found&&(t=Object.assign({},t),delete t.not_found),n("local")||n("session"))}function hKe(){}function pKe(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,eKe(e)}))}function gKe(e){const t=[],n=[];return e.forEach(r=>{(r.match(RY)?t:n).push(r)}),{valid:t,invalid:n}}function e0(e,t,n,r){function i(){const o=e.pendingIcons;t.forEach(a=>{o&&o.delete(a),e.icons[a]||e.missing.add(a)})}if(n&&typeof n=="object")try{if(!N5(e,n).length){i();return}r&&dKe(e,n)}catch(o){console.error(o)}i(),pKe(e)}function _N(e,t){e instanceof Promise?e.then(n=>{t(n)}).catch(()=>{t(null)}):t(e)}function mKe(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,i=e.iconsToLoad;if(delete e.iconsToLoad,!i||!i.length)return;const o=e.loadIcon;if(e.loadIcons&&(i.length>1||!o)){_N(e.loadIcons(i,r,n),c=>{e0(e,i,c,!1)});return}if(o){i.forEach(c=>{const f=o(c,r,n);_N(f,h=>{const p=h?{prefix:r,icons:{[c]:h}}:null;e0(e,[c],p,!1)})});return}const{valid:a,invalid:s}=gKe(i);if(s.length&&e0(e,s,null,!1),!a.length)return;const u=r.match(RY)?F4(n):null;if(!u){e0(e,a,null,!1);return}u.prepare(n,r,a).forEach(c=>{sKe(n,c,f=>{e0(e,c.icons,f,!0)})})}))}const vKe=(e,t)=>{const n=rKe(e,!0,DY()),r=Jqe(n);if(!r.pending.length){let u=!0;return setTimeout(()=>{u&&t(r.loaded,r.missing,r.pending,hKe)}),()=>{u=!1}}const i=Object.create(null),o=[];let a,s;return r.pending.forEach(u=>{const{provider:l,prefix:c}=u;if(c===s&&l===a)return;a=l,s=c,o.push(cf(l,c));const f=i[l]||(i[l]=Object.create(null));f[c]||(f[c]=[])}),r.pending.forEach(u=>{const{provider:l,prefix:c,name:f}=u,h=cf(l,c),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(f)||(p.add(f),i[l][c].push(f))}),o.forEach(u=>{const l=i[u.provider][u.prefix];l.length&&mKe(u,l)}),nKe(t,r,o)};function yKe(e,t){const n={...e};for(const r in t){const i=t[r],o=typeof i;r in $Y?(i===null||i&&(o==="string"||o==="number"))&&(n[r]=i):o===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const bKe=/[\s,]+/;function xKe(e,t){t.split(bKe).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function wKe(e,t=0){const n=e.replace(/^-?[0-9.]*/,"");function r(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(e);return isNaN(i)?0:r(i)}else if(n!==e){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let o=parseFloat(e.slice(0,e.length-n.length));return isNaN(o)?0:(o=o/i,o%1===0?r(o):0)}}return t}function _Ke(e,t){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in t)n+=" "+r+'="'+t[r]+'"';return'"+e+""}function SKe(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function CKe(e){return"data:image/svg+xml,"+SKe(e)}function EKe(e){return'url("'+CKe(e)+'")'}let I0;function OKe(){try{I0=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{I0=null}}function AKe(e){return I0===void 0&&OKe(),I0?I0.createHTML(e):e}const VY={...IY,inline:!1},PKe={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},kKe={display:"inline-block"},z4={backgroundColor:"currentColor"},HY={backgroundColor:"transparent"},SN={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},CN={WebkitMask:z4,mask:z4,background:HY};for(const e in CN){const t=CN[e];for(const n in SN)t[e+n]=SN[n]}const TKe={...VY,inline:!0};function EN(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const MKe=(e,t,n)=>{const r=t.inline?TKe:VY,i=yKe(r,t),o=t.mode||"svg",a={},s=t.style||{},u={...o==="svg"?PKe:{}};if(n){const b=L2(n,!1,!0);if(b){const w=["iconify"],x=["provider","prefix"];for(const S of x)b[S]&&w.push("iconify--"+b[S]);u.className=w.join(" ")}}for(let b in t){const w=t[b];if(w!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":break;case"_ref":u.ref=w;break;case"className":u[b]=(u[b]?u[b]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":i[b]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&xKe(i,w);break;case"color":a.color=w;break;case"rotate":typeof w=="string"?i[b]=wKe(w):typeof w=="number"&&(i[b]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete u["aria-hidden"];break;default:r[b]===void 0&&(u[b]=w)}}const l=jqe(e,i),c=l.attributes;if(i.inline&&(a.verticalAlign="-0.125em"),o==="svg"){u.style={...a,...s},Object.assign(u,c);let b=0,w=t.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),u.dangerouslySetInnerHTML={__html:AKe(Wqe(l.body,w?()=>w+"ID"+b++:"iconifyReact"))},v.createElement("svg",u)}const{body:f,width:h,height:p}=e,m=o==="mask"||(o==="bg"?!1:f.indexOf("currentColor")!==-1),y=_Ke(f,{...c,width:h+"",height:p+""});return u.style={...a,"--svg":EKe(y),width:EN(c.width),height:EN(c.height),...kKe,...m?z4:HY,...s},v.createElement("span",u)};DY(!0);Vqe("",Qqe);if(typeof document<"u"&&typeof window<"u"){WY();const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Rqe(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let n in t){const r="IconifyProviders["+n+"] is invalid.";try{const i=t[n];if(typeof i!="object"||!i||i.resources===void 0)continue;Hqe(n,i)||console.error(r)}catch{console.error(r)}}}}function qY(e){const[t,n]=v.useState(!!e.ssr),[r,i]=v.useState({});function o(p){if(p){const m=e.icon;if(typeof m=="object")return{name:"",data:m};const y=gN(m);if(y)return{name:m,data:y}}return{name:""}}const[a,s]=v.useState(o(!!e.ssr));function u(){const p=r.callback;p&&(p(),i({}))}function l(p){if(JSON.stringify(a)!==JSON.stringify(p))return u(),s(p),!0}function c(){var p;const m=e.icon;if(typeof m=="object"){l({name:"",data:m});return}const y=gN(m);if(l({name:m,data:y}))if(y===void 0){const b=vKe([m],c);i({callback:b})}else y&&((p=e.onLoad)===null||p===void 0||p.call(e,m))}v.useEffect(()=>(n(!0),u),[]),v.useEffect(()=>{t&&c()},[e.icon,t]);const{name:f,data:h}=a;return h?MKe({...I5,...h},e,f):e.children?e.children:v.createElement("span",{})}const Ttt=v.forwardRef((e,t)=>qY({...e,_ref:t}));v.forwardRef((e,t)=>qY({inline:!0,...e,_ref:t}));var KY="AlertDialog",[RKe,Mtt]=Di(KY,[uz]),Du=uz(),GY=e=>{const{__scopeAlertDialog:t,...n}=e,r=Du(t);return I.jsx(yve,{...r,...n,modal:!0})};GY.displayName=KY;var DKe="AlertDialogTrigger",YY=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(bve,{...i,...r,ref:t})});YY.displayName=DKe;var $Ke="AlertDialogPortal",ZY=e=>{const{__scopeAlertDialog:t,...n}=e,r=Du(t);return I.jsx(xve,{...r,...n})};ZY.displayName=$Ke;var IKe="AlertDialogOverlay",XY=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(wve,{...i,...r,ref:t})});XY.displayName=IKe;var jd="AlertDialogContent",[NKe,LKe]=RKe(jd),QY=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...i}=e,o=Du(n),a=v.useRef(null),s=Nt(t,a),u=v.useRef(null);return I.jsx(pve,{contentName:jd,titleName:JY,docsSlug:"alert-dialog",children:I.jsx(NKe,{scope:n,cancelRef:u,children:I.jsxs(_ve,{role:"alertdialog",...o,...i,ref:s,onOpenAutoFocus:Ye(i.onOpenAutoFocus,l=>{l.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:l=>l.preventDefault(),onInteractOutside:l=>l.preventDefault(),children:[I.jsx(ZO,{children:r}),I.jsx(jKe,{contentRef:a})]})})})});QY.displayName=jd;var JY="AlertDialogTitle",eZ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(Sve,{...i,...r,ref:t})});eZ.displayName=JY;var tZ="AlertDialogDescription",nZ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(Cve,{...i,...r,ref:t})});nZ.displayName=tZ;var FKe="AlertDialogAction",rZ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Du(n);return I.jsx(Cz,{...i,...r,ref:t})});rZ.displayName=FKe;var iZ="AlertDialogCancel",oZ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=LKe(iZ,n),o=Du(n),a=Nt(t,i);return I.jsx(Cz,{...o,...r,ref:a})});oZ.displayName=iZ;var jKe=({contentRef:e})=>{const t=`\`${jd}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${jd}\` by passing a \`${tZ}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${jd}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Mtt=GY,Rtt=YY,Dtt=ZY,$tt=XY,Itt=QY,Ntt=rZ,Ltt=oZ,Ftt=eZ,jtt=nZ;function cs(){return cs=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:0,n=(li[e[t+0]]+li[e[t+1]]+li[e[t+2]]+li[e[t+3]]+"-"+li[e[t+4]]+li[e[t+5]]+"-"+li[e[t+6]]+li[e[t+7]]+"-"+li[e[t+8]]+li[e[t+9]]+"-"+li[e[t+10]]+li[e[t+11]]+li[e[t+12]]+li[e[t+13]]+li[e[t+14]]+li[e[t+15]]).toLowerCase();if(!WKe(n))throw TypeError("Stringified UUID is invalid");return n}function aZ(e,t,n){e=e||{};var r=e.random||(e.rng||UKe)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,VKe(r)}function Pr(e){return v.createElement("i",{className:"rmel-iconfont rmel-icon-"+e.type})}function HKe(e){return v.createElement("div",{className:"rc-md-navigation "+(e.visible?"visible":"in-visible")},v.createElement("div",{className:"navigation-nav left"},v.createElement("div",{className:"button-wrap"},e.left)),v.createElement("div",{className:"navigation-nav right"},v.createElement("div",{className:"button-wrap"},e.right)))}function qKe(e){return v.createElement("div",{className:"tool-bar",style:e.style},e.children)}var sZ=function(e){jn(t,e);function t(){for(var n,r=arguments.length,i=new Array(r),o=0;o"u")){var r="enUS";if(navigator.language){var i=navigator.language.split("-");r=i[0],i.length!==1&&(r+=i[i.length-1].toUpperCase())}if(navigator.browserLanguage){var o=navigator.browserLanguage.split("-");r=o[0],o[1]&&(r+=o[1].toUpperCase())}this.current!==r&&this.isAvailable(r)&&(this.current=r,dl.emit(dl.EVENT_LANG_CHANGE,this,r,this.langs[r]))}},t.isAvailable=function(r){return typeof this.langs[r]<"u"},t.add=function(r,i){this.langs[r]=i},t.setCurrent=function(r){if(!this.isAvailable(r))throw new Error("Language "+r+" is not exists");this.current!==r&&(this.current=r,dl.emit(dl.EVENT_LANG_CHANGE,this,r,this.langs[r]))},t.get=function(r,i){var o=this.langs[this.current][r]||"";return i&&Object.keys(i).forEach(function(a){o=o.replace(new RegExp("\\{"+a+"\\}","g"),i[a])}),o},t.getCurrent=function(){return this.current},e}(),Fn=new YKe;function cm(e){"@babel/helpers - typeof";return cm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cm(e)}function ZKe(e,t){if(cm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function XKe(e){var t=ZKe(e,"string");return cm(t)=="symbol"?t:t+""}function QKe(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Rtt=GY,Dtt=YY,$tt=ZY,Itt=XY,Ntt=QY,Ltt=rZ,Ftt=oZ,jtt=eZ,Btt=nZ;function cs(){return cs=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:0,n=(li[e[t+0]]+li[e[t+1]]+li[e[t+2]]+li[e[t+3]]+"-"+li[e[t+4]]+li[e[t+5]]+"-"+li[e[t+6]]+li[e[t+7]]+"-"+li[e[t+8]]+li[e[t+9]]+"-"+li[e[t+10]]+li[e[t+11]]+li[e[t+12]]+li[e[t+13]]+li[e[t+14]]+li[e[t+15]]).toLowerCase();if(!WKe(n))throw TypeError("Stringified UUID is invalid");return n}function aZ(e,t,n){e=e||{};var r=e.random||(e.rng||UKe)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,VKe(r)}function Pr(e){return v.createElement("i",{className:"rmel-iconfont rmel-icon-"+e.type})}function HKe(e){return v.createElement("div",{className:"rc-md-navigation "+(e.visible?"visible":"in-visible")},v.createElement("div",{className:"navigation-nav left"},v.createElement("div",{className:"button-wrap"},e.left)),v.createElement("div",{className:"navigation-nav right"},v.createElement("div",{className:"button-wrap"},e.right)))}function qKe(e){return v.createElement("div",{className:"tool-bar",style:e.style},e.children)}var sZ=function(e){jn(t,e);function t(){for(var n,r=arguments.length,i=new Array(r),o=0;o"u")){var r="enUS";if(navigator.language){var i=navigator.language.split("-");r=i[0],i.length!==1&&(r+=i[i.length-1].toUpperCase())}if(navigator.browserLanguage){var o=navigator.browserLanguage.split("-");r=o[0],o[1]&&(r+=o[1].toUpperCase())}this.current!==r&&this.isAvailable(r)&&(this.current=r,dl.emit(dl.EVENT_LANG_CHANGE,this,r,this.langs[r]))}},t.isAvailable=function(r){return typeof this.langs[r]<"u"},t.add=function(r,i){this.langs[r]=i},t.setCurrent=function(r){if(!this.isAvailable(r))throw new Error("Language "+r+" is not exists");this.current!==r&&(this.current=r,dl.emit(dl.EVENT_LANG_CHANGE,this,r,this.langs[r]))},t.get=function(r,i){var o=this.langs[this.current][r]||"";return i&&Object.keys(i).forEach(function(a){o=o.replace(new RegExp("\\{"+a+"\\}","g"),i[a])}),o},t.getCurrent=function(){return this.current},e}(),Fn=new YKe;function cm(e){"@babel/helpers - typeof";return cm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cm(e)}function ZKe(e,t){if(cm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cm(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function XKe(e){var t=ZKe(e,"string");return cm(t)=="symbol"?t:t+""}function QKe(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tGe(e,t){if(e){if(typeof e=="string")return ON(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ON(e,t)}}function ON(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0)for(var s=eGe(n),u;!(u=s()).done;){var l=u.value;if(typeof a[l]<"u"&&!a[l])return!1}else if(a.metaKey||a.ctrlKey||a.shiftKey||a.altKey)return!1;return a.key?a.key===i:a.keyCode===r}function X3(e,t){var n=e.split(` `),r=e.substr(0,t).split(` `),i=r.length,o=r[r.length-1].length,a=n[r.length-1],s=r.length>1?r[r.length-2]:null,u=n.length>r.length?n[r.length]:null;return{line:i,col:o,beforeText:e.substr(0,t),afterText:e.substr(t),curLine:a,prevLine:s,nextLine:u}}var rd={bold:["**","**"],italic:["*","*"],underline:["++","++"],strikethrough:["~~","~~"],quote:[` @@ -610,4 +610,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `:">",o};ap.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};rs.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 IZ(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}IZ.prototype.Token=rs;const aYe=/\r\n?|\n/g,sYe=/\0/g;function uYe(e){let t;t=e.src.replace(aYe,` `),t=t.replace(sYe,"�"),e.src=t}function lYe(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 cYe(e){const t=e.tokens;for(let n=0,r=t.length;n\s]/i.test(e)}function dYe(e){return/^<\/a\s*>/i.test(e)}function hYe(e){const t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n=0;a--){const s=i[a];if(s.type==="link_close"){for(a--;i[a].level!==s.level&&i[a].type!=="link_open";)a--;continue}if(s.type==="html_inline"&&(fYe(s.content)&&o>0&&o--,dYe(s.content)&&o++),!(o>0)&&s.type==="text"&&e.md.linkify.test(s.content)){const u=s.content;let l=e.md.linkify.match(u);const c=[];let f=s.level,h=0;l.length>0&&l[0].index===0&&a>0&&i[a-1].type==="text_special"&&(l=l.slice(1));for(let p=0;ph){const E=new e.Token("text","",0);E.content=u.slice(h,w),E.level=f,c.push(E)}const x=new e.Token("link_open","a",1);x.attrs=[["href",y]],x.level=f++,x.markup="linkify",x.info="auto",c.push(x);const S=new e.Token("text","",0);S.content=b,S.level=f,c.push(S);const O=new e.Token("link_close","a",-1);O.level=--f,O.markup="linkify",O.info="auto",c.push(O),h=l[p].lastIndex}if(h=0;n--){const r=e[n];r.type==="text"&&!t&&(r.content=r.content.replace(gYe,vYe)),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function bYe(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&NZ.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 xYe(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(pYe.test(e.tokens[t].content)&&yYe(e.tokens[t].children),NZ.test(e.tokens[t].content)&&bYe(e.tokens[t].children))}const wYe=/['"]/,LN=/['"]/g,FN="’";function Yy(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function _Ye(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 s=o.content,u=0,l=s.length;e:for(;u=0)m=s.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let y=32;if(u=48&&m<=57&&(h=f=!1),f&&h&&(f=b,h=w),!f&&!h){p&&(o.content=Yy(o.content,c.index,FN));continue}if(h)for(n=r.length-1;n>=0;n--){let O=r[n];if(r[n].level=0;t--)e.tokens[t].type!=="inline"||!wYe.test(e.tokens[t].content)||_Ye(e.tokens[t].children,e)}function CYe(e){let t,n;const r=e.tokens,i=r.length;for(let o=0;o0&&this.level++,this.tokens.push(r),r};Ns.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]};Ns.prototype.skipEmptyLines=function(t){for(let n=this.lineMax;tn;)if(!qn(this.src.charCodeAt(--t)))return t+1;return t};Ns.prototype.skipChars=function(t,n){for(let r=this.src.length;tr;)if(n!==this.src.charCodeAt(--t))return t+1;return t};Ns.prototype.getLines=function(t,n,r,i){if(t>=n)return"";const o=new Array(n-t);for(let a=0,s=t;sr?o[a]=new Array(u-r+1).join(" ")+this.src.slice(c,f):o[a]=this.src.slice(c,f)}return o.join("")};Ns.prototype.Token=rs;const EYe=65536;function nC(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function jN(e){const t=[],n=e.length;let r=0,i=e.charCodeAt(r),o=!1,a=0,s="";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 s=e.src.charCodeAt(o++);if(s!==124&&s!==45&&s!==58&&!qn(s)||a===45&&qn(s))return!1;for(;o=4)return!1;l=jN(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();const f=l.length;if(f===0||f!==c.length)return!1;if(r)return!0;const h=e.parentType;e.parentType="table";const p=e.md.block.ruler.getRules("blockquote"),m=e.push("table_open","table",1),y=[t,0];m.map=y;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 O=0;O=4||(l=jN(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),S+=f-l.length,S>EYe))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 PYe(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 s=i;i=e.skipChars(i,a);let u=i-s;if(u<3)return!1;const l=e.src.slice(s,i),c=e.src.slice(i,o);if(a===96&&c.indexOf(String.fromCharCode(a))>=0)return!1;if(r)return!0;let f=t,h=!1;for(;f++,!(f>=n||(i=s=e.bMarks[f]+e.tShift[f],o=e.eMarks[f],i=4)&&(i=e.skipChars(i,a),!(i-s=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;const s=[],u=[],l=[],c=[],f=e.md.block.ruler.getRules("blockquote"),h=e.parentType;e.parentType="blockquote";let p=!1,m;for(m=t;m=o)break;if(e.src.charCodeAt(i++)===62&&!S){let E=e.sCount[m]+1,C,P;e.src.charCodeAt(i)===32?(i++,E++,P=!1,C=!0):e.src.charCodeAt(i)===9?(C=!0,(e.bsCount[m]+E)%4===3?(i++,E++,P=!1):P=!0):C=!1;let M=E;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i=o,u.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+(C?1:0),l.push(e.sCount[m]),e.sCount[m]=M-E,c.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let O=!1;for(let E=0,C=f.length;E";const w=[t,0];b.map=w,e.md.block.tokenize(e,t,m);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 s=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[u]-e.listIndent>=4&&e.sCount[u]=e.blkIndent&&(c=!0);let f,h,p;if((p=UN(e,u))>=0){if(f=!0,a=e.bMarks[u]+e.tShift[u],h=Number(e.src.slice(a,p-1)),c&&h!==1)return!1}else if((p=BN(e,u))>=0)f=!1;else return!1;if(c&&e.skipSpaces(p)>=e.eMarks[u])return!1;if(r)return!0;const m=e.src.charCodeAt(p-1),y=e.tokens.length;f?(s=e.push("ordered_list_open","ol",1),h!==1&&(s.attrs=[["start",h]])):s=e.push("bullet_list_open","ul",1);const b=[u,0];s.map=b,s.markup=String.fromCharCode(m);let w=!1;const x=e.md.block.ruler.getRules("list"),S=e.parentType;for(e.parentType="list";u=i?P=1:P=E-O,P>4&&(P=1);const M=O+P;s=e.push("list_item_open","li",1),s.markup=String.fromCharCode(m);const N=[u,0];s.map=N,f&&(s.info=e.src.slice(a,p-1));const B=e.tight,V=e.tShift[u],W=e.sCount[u],ee=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=M,e.tight=!0,e.tShift[u]=C-e.bMarks[u],e.sCount[u]=E,C>=i&&e.isEmpty(u+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,u,n,!0),(!e.tight||w)&&(l=!1),w=e.line-u>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=ee,e.tShift[u]=V,e.sCount[u]=W,e.tight=B,s=e.push("list_item_close","li",-1),s.markup=String.fromCharCode(m),u=e.line,N[1]=u,u>=n||e.sCount[u]=4)break;let Z=!1;for(let q=0,G=x.length;q=4||e.src.charCodeAt(i)!==91)return!1;function s(x){const S=e.lineMax;if(x>=S||e.isEmpty(x))return null;let O=!1;if(e.sCount[x]-e.blkIndent>3&&(O=!0),e.sCount[x]<0&&(O=!0),!O){const P=e.md.block.ruler.getRules("reference"),M=e.parentType;e.parentType="reference";let N=!1;for(let B=0,V=P.length;B"u"&&(e.env.references={}),typeof e.env.references[w]>"u"&&(e.env.references[w]={title:b,href:f}),e.line=a),!0):!1}const $Ye=["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"],IYe="[a-zA-Z_:][a-zA-Z0-9:._-]*",NYe="[^\"'=<>`\\x00-\\x20]+",LYe="'[^']*'",FYe='"[^"]*"',jYe="(?:"+NYe+"|"+LYe+"|"+FYe+")",BYe="(?:\\s+"+IYe+"(?:\\s*=\\s*"+jYe+")?)",LZ="<[A-Za-z][A-Za-z0-9\\-]*"+BYe+"*\\s*\\/?>",FZ="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",UYe="",zYe="<[?][\\s\\S]*?[?]>",WYe="]*>",VYe="",HYe=new RegExp("^(?:"+LZ+"|"+FZ+"|"+UYe+"|"+zYe+"|"+WYe+"|"+VYe+")"),qYe=new RegExp("^(?:"+LZ+"|"+FZ+")"),ed=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(qYe.source+"\\s*$"),/^$/,!1]];function KYe(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),s=0;for(;s=4)return!1;let a=e.src.charCodeAt(i);if(a!==35||i>=o)return!1;let s=1;for(a=e.src.charCodeAt(++i);a===35&&i6||ii&&qn(e.src.charCodeAt(u-1))&&(o=u),e.line=t+1;const l=e.push("heading_open","h"+String(s),1);l.markup="########".slice(0,s),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 f=e.push("heading_close","h"+String(s),-1);return f.markup="########".slice(0,s),!0}function YYe(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,s=t+1;for(;s3)continue;if(e.sCount[s]>=e.blkIndent){let p=e.bMarks[s]+e.tShift[s];const m=e.eMarks[s];if(p=m))){o=a===61?1:2;break}}if(e.sCount[s]<0)continue;let h=!1;for(let p=0,m=r.length;p3||e.sCount[o]<0)continue;let l=!1;for(let c=0,f=r.length;c=n||e.sCount[a]=o){e.line=n;break}const u=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=!s,e.isEmpty(e.line-1)&&(s=!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};nv.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(JYe);if(!i)return!1;const o=i[1],a=e.md.linkify.matchAtStart(e.src.slice(n-o.length));if(!a)return!1;let s=a.url;if(s.length<=o.length)return!1;s=s.replace(/\*+$/,"");const u=e.md.normalizeLink(s);if(!e.md.validateLink(u))return!1;if(!t){e.pending=e.pending.slice(0,-o.length);const l=e.push("link_open","a",1);l.attrs=[["href",u]],l.markup="linkify",l.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(s);const f=e.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return e.pos+=s.length-o.length,!0}function tZe(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){Q5[e.charCodeAt(0)]=1});function nZe(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&&s<=57343&&(o+=e.src[n+1],n++)}const a="\\"+o;if(!t){const s=e.push("text_special","",0);i<256&&Q5[i]!==0?s.content=o:s.content=a,s.markup=a,s.info="escape"}return e.pos=n+1,!0}function rZe(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,s=String.fromCharCode(i.marker),u=e.tokens[i.token];u.type=a?"strong_open":"em_open",u.tag=a?"strong":"em",u.nesting=1,u.markup=a?s+s:s,u.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?s+s:s,l.content="",a&&(e.tokens[t[r-1].token].content="",e.tokens[t[i.end+1].token].content="",r--)}}function sZe(e){const t=e.tokens_meta,n=e.tokens_meta.length;WN(e,e.delimiters);for(let r=0;r=f)return!1;if(u=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(a=e.md.normalizeLink(i.str),e.md.validateLink(a)?m=i.pos:a="",u=m;m=f||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(typeof e.env.references>"u")return!1;if(m=0?r=e.src.slice(u,m++):m=p+1):m=p+1,r||(r=e.src.slice(h,p)),o=e.env.references[B2(r)],!o)return e.pos=c,!1;a=o.href,s=o.title}if(!t){e.pos=h,e.posMax=p;const y=e.push("link_open","a",1),b=[["href",a]];y.attrs=b,s&&b.push(["title",s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=m,e.posMax=f,!0}function lZe(e,t){let n,r,i,o,a,s,u,l,c="";const f=e.pos,h=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(o=m+1,o=h)return!1;for(l=o,s=e.md.helpers.parseLinkDestination(e.src,o,e.posMax),s.ok&&(c=e.md.normalizeLink(s.str),e.md.validateLink(c)?o=s.pos:c=""),l=o;o=h||e.src.charCodeAt(o)!==41)return e.pos=f,!1;o++}else{if(typeof e.env.references>"u")return!1;if(o=0?i=e.src.slice(l,o++):o=m+1):o=m+1,i||(i=e.src.slice(p,m)),a=e.env.references[B2(i)],!a)return e.pos=f,!1;c=a.href,u=a.title}if(!t){r=e.src.slice(p,m);const y=[];e.md.inline.parse(r,e.md,e.env,y);const b=e.push("image","img",0),w=[["src",c],["alt",""]];b.attrs=w,b.children=y,b.content=r,u&&w.push(["title",u])}return e.pos=o,e.posMax=h,!0}const cZe=/^([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])?)*)$/,fZe=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function dZe(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(fZe.test(o)){const a=e.md.normalizeLink(o);if(!e.md.validateLink(a))return!1;if(!t){const s=e.push("link_open","a",1);s.attrs=[["href",a]],s.markup="autolink",s.info="auto";const u=e.push("text","",0);u.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(cZe.test(o)){const a=e.md.normalizeLink("mailto:"+o);if(!e.md.validateLink(a))return!1;if(!t){const s=e.push("link_open","a",1);s.attrs=[["href",a]],s.markup="autolink",s.info="auto";const u=e.push("text","",0);u.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 hZe(e){return/^\s]/i.test(e)}function pZe(e){return/^<\/a\s*>/i.test(e)}function gZe(e){const t=e|32;return t>=97&&t<=122}function mZe(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&&!gZe(i))return!1;const o=e.src.slice(r).match(HYe);if(!o)return!1;if(!t){const a=e.push("html_inline","",0);a.content=o[0],hZe(a.content)&&e.linkLevel++,pZe(a.content)&&e.linkLevel--}return e.pos+=o[0].length,!0}const vZe=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,yZe=/^&([a-z][a-z0-9]{1,31});/i;function bZe(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(vZe);if(o){if(!t){const a=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),s=e.push("text_special","",0);s.content=Z5(a)?jx(a):jx(65533),s.markup=o[0],s.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(yZe);if(o){const a=RZ(o[0]);if(a!==o[0]){if(!t){const s=e.push("text_special","",0);s.content=a,s.markup=o[0],s.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function VN(e){const t={},n=e.length;if(!n)return;let r=0,i=-2;const o=[];for(let a=0;au;l-=o[l]+1){const f=e[l];if(f.marker===s.marker&&f.open&&f.end<0){let h=!1;if((f.close||s.open)&&(f.length+s.length)%3===0&&(f.length%3!==0||s.length%3!==0)&&(h=!0),!h){const p=l>0&&!e[l-1].open?o[l-1]+1:0;o[a]=a-l+p,o[l]=p,s.open=!1,f.end=a,f.close=!1,c=-1,i=-2;break}}}c!==-1&&(t[s.marker][(s.open?3:0)+(s.length||0)%3]=c)}}function xZe(e){const t=e.tokens_meta,n=e.tokens_meta.length;VN(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};rv.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()};rv.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 s=0;s|$))",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 K4(e){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){e[r]=n[r]})}),e}function z2(e){return Object.prototype.toString.call(e)}function SZe(e){return z2(e)==="[object String]"}function CZe(e){return z2(e)==="[object Object]"}function EZe(e){return z2(e)==="[object RegExp]"}function HN(e){return z2(e)==="[object Function]"}function OZe(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const UZ={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function AZe(e){return Object.keys(e||{}).reduce(function(t,n){return t||UZ.hasOwnProperty(n)},!1)}const PZe={"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}}},kZe="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]",TZe="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function MZe(e){e.__index__=-1,e.__text_cache__=""}function RZe(e){return function(t,n){const r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function qN(){return function(e,t){t.normalize(e)}}function Bx(e){const t=e.re=_Ze(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(kZe),n.push(t.src_xn),t.src_tlds=n.join("|");function r(s){return s.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(s,u){throw new Error('(LinkifyIt) Invalid schema "'+s+'": '+u)}Object.keys(e.__schemas__).forEach(function(s){const u=e.__schemas__[s];if(u===null)return;const l={validate:null,link:null};if(e.__compiled__[s]=l,CZe(u)){EZe(u.validate)?l.validate=RZe(u.validate):HN(u.validate)?l.validate=u.validate:o(s,u),HN(u.normalize)?l.normalize=u.normalize:u.normalize?o(s,u):l.normalize=qN();return}if(SZe(u)){i.push(s);return}o(s,u)}),i.forEach(function(s){e.__compiled__[e.__schemas__[s]]&&(e.__compiled__[s].validate=e.__compiled__[e.__schemas__[s]].validate,e.__compiled__[s].normalize=e.__compiled__[e.__schemas__[s]].normalize)}),e.__compiled__[""]={validate:null,normalize:qN()};const a=Object.keys(e.__compiled__).filter(function(s){return s.length>0&&e.__compiled__[s]}).map(OZe).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"),MZe(e)}function DZe(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 G4(e,t){const n=new DZe(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function Vo(e,t){if(!(this instanceof Vo))return new Vo(e,t);t||AZe(e)&&(t=e,e={}),this.__opts__=K4({},UZ,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=K4({},PZe,e),this.__compiled__={},this.__tlds__=TZe,this.__tlds_replaced__=!1,this.re={},Bx(this)}Vo.prototype.add=function(t,n){return this.__schemas__[t]=n,Bx(this),this};Vo.prototype.set=function(t){return this.__opts__=K4(this.__opts__,t),this};Vo.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let n,r,i,o,a,s,u,l,c;if(this.re.schema_test.test(t)){for(u=this.re.schema_search,u.lastIndex=0;(n=u.exec(t))!==null;)if(o=this.testSchemaAt(t,n[2],u.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,s=i.index+i[0].length,(this.__index__<0||athis.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=s))),this.__index__>=0};Vo.prototype.pretest=function(t){return this.re.pretest.test(t)};Vo.prototype.testSchemaAt=function(t,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(t,r,this):0};Vo.prototype.match=function(t){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===t&&(n.push(G4(this,r)),r=this.__last_index__);let i=r?t.slice(r):t;for(;this.test(i);)n.push(G4(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};Vo.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,G4(this,0)):null};Vo.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(),Bx(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,Bx(this),this)};Vo.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};Vo.prototype.onCompile=function(){};const Bd=2147483647,xs=36,J5=1,pm=26,$Ze=38,IZe=700,zZ=72,WZ=128,VZ="-",NZe=/^xn--/,LZe=/[^\0-\x7F]/,FZe=/[\x2E\u3002\uFF0E\uFF61]/g,jZe={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},oC=xs-J5,ws=Math.floor,aC=String.fromCharCode;function Ju(e){throw new RangeError(jZe[e])}function BZe(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function HZ(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(FZe,".");const i=e.split("."),o=BZe(i,t).join(".");return r+o}function qZ(e){const t=[];let n=0;const r=e.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...e),zZe=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:xs},KN=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},KZ=function(e,t,n){let r=0;for(e=n?ws(e/IZe):e>>1,e+=ws(e/t);e>oC*pm>>1;r+=xs)e=ws(e/oC);return ws(r+(oC+1)*e/(e+$Ze))},GZ=function(e){const t=[],n=e.length;let r=0,i=WZ,o=zZ,a=e.lastIndexOf(VZ);a<0&&(a=0);for(let s=0;s=128&&Ju("not-basic"),t.push(e.charCodeAt(s));for(let s=a>0?a+1:0;s=n&&Ju("invalid-input");const h=zZe(e.charCodeAt(s++));h>=xs&&Ju("invalid-input"),h>ws((Bd-r)/c)&&Ju("overflow"),r+=h*c;const p=f<=o?J5:f>=o+pm?pm:f-o;if(hws(Bd/m)&&Ju("overflow"),c*=m}const l=t.length+1;o=KZ(r-u,l,u==0),ws(r/l)>Bd-i&&Ju("overflow"),i+=ws(r/l),r%=l,t.splice(r++,0,i)}return String.fromCodePoint(...t)},YZ=function(e){const t=[];e=qZ(e);const n=e.length;let r=WZ,i=0,o=zZ;for(const u of e)u<128&&t.push(aC(u));const a=t.length;let s=a;for(a&&t.push(VZ);s=r&&cws((Bd-i)/l)&&Ju("overflow"),i+=(u-r)*l,r=u;for(const c of e)if(cBd&&Ju("overflow"),c===r){let f=i;for(let h=xs;;h+=xs){const p=h<=o?J5:h>=o+pm?pm:h-o;if(f=0))try{t.hostname=ZZ.toASCII(t.hostname)}catch{}return tv(q5(t))}function JZe(e){const t=K5(e,!0);if(t.hostname&&(!t.protocol||XZ.indexOf(t.protocol)>=0))try{t.hostname=ZZ.toUnicode(t.hostname)}catch{}return Ph(q5(t),Ph.defaultChars+"%")}function Ja(e,t){if(!(this instanceof Ja))return new Ja(e,t);t||Y5(e)||(t=e||{},e="default"),this.inline=new rv,this.block=new U2,this.core=new X5,this.renderer=new ap,this.linkify=new Vo,this.validateLink=XZe,this.normalizeLink=QZe,this.normalizeLinkText=JZe,this.utils=tYe,this.helpers=j2({},oYe),this.options={},this.configure(e),t&&this.set(t)}Ja.prototype.set=function(e){return j2(this.options,e),this};Ja.prototype.configure=function(e){const t=this;if(Y5(e)){const n=e;if(e=GZe[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};Ja.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};Ja.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};Ja.prototype.use=function(e){const t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this};Ja.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};Ja.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)};Ja.prototype.parseInline=function(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens};Ja.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var QZ={exports:{}};(function(e){(function(t){var n=function(T){var D,$=new Float64Array(16);if(T)for(D=0;D>24&255,T[D+1]=$>>16&255,T[D+2]=$>>8&255,T[D+3]=$&255,T[D+4]=A>>24&255,T[D+5]=A>>16&255,T[D+6]=A>>8&255,T[D+7]=A&255}function y(T,D,$,A,L){var Q,te=0;for(Q=0;Q>>8)-1}function b(T,D,$,A){return y(T,D,$,A,16)}function w(T,D,$,A){return y(T,D,$,A,32)}function x(T,D,$,A){for(var L=A[0]&255|(A[1]&255)<<8|(A[2]&255)<<16|(A[3]&255)<<24,Q=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,te=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,fe=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,_e=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,je=A[4]&255|(A[5]&255)<<8|(A[6]&255)<<16|(A[7]&255)<<24,Ve=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,Ie=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,nt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=A[8]&255|(A[9]&255)<<8|(A[10]&255)<<16|(A[11]&255)<<24,Ot=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,pt=$[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=A[12]&255|(A[13]&255)<<8|(A[14]&255)<<16|(A[15]&255)<<24,Qe=L,ut=Q,Xe=te,Ne=fe,qe=_e,Ge=je,pe=Ve,he=ct,Re=Ie,Oe=nt,Pe=bt,Be=Ot,vt=pt,jt=ht,Bt=xt,It=wt,J,Zt=0;Zt<20;Zt+=2)J=Qe+vt|0,qe^=J<<7|J>>>25,J=qe+Qe|0,Re^=J<<9|J>>>23,J=Re+qe|0,vt^=J<<13|J>>>19,J=vt+Re|0,Qe^=J<<18|J>>>14,J=Ge+ut|0,Oe^=J<<7|J>>>25,J=Oe+Ge|0,jt^=J<<9|J>>>23,J=jt+Oe|0,ut^=J<<13|J>>>19,J=ut+jt|0,Ge^=J<<18|J>>>14,J=Pe+pe|0,Bt^=J<<7|J>>>25,J=Bt+Pe|0,Xe^=J<<9|J>>>23,J=Xe+Bt|0,pe^=J<<13|J>>>19,J=pe+Xe|0,Pe^=J<<18|J>>>14,J=It+Be|0,Ne^=J<<7|J>>>25,J=Ne+It|0,he^=J<<9|J>>>23,J=he+Ne|0,Be^=J<<13|J>>>19,J=Be+he|0,It^=J<<18|J>>>14,J=Qe+Ne|0,ut^=J<<7|J>>>25,J=ut+Qe|0,Xe^=J<<9|J>>>23,J=Xe+ut|0,Ne^=J<<13|J>>>19,J=Ne+Xe|0,Qe^=J<<18|J>>>14,J=Ge+qe|0,pe^=J<<7|J>>>25,J=pe+Ge|0,he^=J<<9|J>>>23,J=he+pe|0,qe^=J<<13|J>>>19,J=qe+he|0,Ge^=J<<18|J>>>14,J=Pe+Oe|0,Be^=J<<7|J>>>25,J=Be+Pe|0,Re^=J<<9|J>>>23,J=Re+Be|0,Oe^=J<<13|J>>>19,J=Oe+Re|0,Pe^=J<<18|J>>>14,J=It+Bt|0,vt^=J<<7|J>>>25,J=vt+It|0,jt^=J<<9|J>>>23,J=jt+vt|0,Bt^=J<<13|J>>>19,J=Bt+jt|0,It^=J<<18|J>>>14;Qe=Qe+L|0,ut=ut+Q|0,Xe=Xe+te|0,Ne=Ne+fe|0,qe=qe+_e|0,Ge=Ge+je|0,pe=pe+Ve|0,he=he+ct|0,Re=Re+Ie|0,Oe=Oe+nt|0,Pe=Pe+bt|0,Be=Be+Ot|0,vt=vt+pt|0,jt=jt+ht|0,Bt=Bt+xt|0,It=It+wt|0,T[0]=Qe>>>0&255,T[1]=Qe>>>8&255,T[2]=Qe>>>16&255,T[3]=Qe>>>24&255,T[4]=ut>>>0&255,T[5]=ut>>>8&255,T[6]=ut>>>16&255,T[7]=ut>>>24&255,T[8]=Xe>>>0&255,T[9]=Xe>>>8&255,T[10]=Xe>>>16&255,T[11]=Xe>>>24&255,T[12]=Ne>>>0&255,T[13]=Ne>>>8&255,T[14]=Ne>>>16&255,T[15]=Ne>>>24&255,T[16]=qe>>>0&255,T[17]=qe>>>8&255,T[18]=qe>>>16&255,T[19]=qe>>>24&255,T[20]=Ge>>>0&255,T[21]=Ge>>>8&255,T[22]=Ge>>>16&255,T[23]=Ge>>>24&255,T[24]=pe>>>0&255,T[25]=pe>>>8&255,T[26]=pe>>>16&255,T[27]=pe>>>24&255,T[28]=he>>>0&255,T[29]=he>>>8&255,T[30]=he>>>16&255,T[31]=he>>>24&255,T[32]=Re>>>0&255,T[33]=Re>>>8&255,T[34]=Re>>>16&255,T[35]=Re>>>24&255,T[36]=Oe>>>0&255,T[37]=Oe>>>8&255,T[38]=Oe>>>16&255,T[39]=Oe>>>24&255,T[40]=Pe>>>0&255,T[41]=Pe>>>8&255,T[42]=Pe>>>16&255,T[43]=Pe>>>24&255,T[44]=Be>>>0&255,T[45]=Be>>>8&255,T[46]=Be>>>16&255,T[47]=Be>>>24&255,T[48]=vt>>>0&255,T[49]=vt>>>8&255,T[50]=vt>>>16&255,T[51]=vt>>>24&255,T[52]=jt>>>0&255,T[53]=jt>>>8&255,T[54]=jt>>>16&255,T[55]=jt>>>24&255,T[56]=Bt>>>0&255,T[57]=Bt>>>8&255,T[58]=Bt>>>16&255,T[59]=Bt>>>24&255,T[60]=It>>>0&255,T[61]=It>>>8&255,T[62]=It>>>16&255,T[63]=It>>>24&255}function S(T,D,$,A){for(var L=A[0]&255|(A[1]&255)<<8|(A[2]&255)<<16|(A[3]&255)<<24,Q=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,te=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,fe=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,_e=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,je=A[4]&255|(A[5]&255)<<8|(A[6]&255)<<16|(A[7]&255)<<24,Ve=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,Ie=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,nt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=A[8]&255|(A[9]&255)<<8|(A[10]&255)<<16|(A[11]&255)<<24,Ot=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,pt=$[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=A[12]&255|(A[13]&255)<<8|(A[14]&255)<<16|(A[15]&255)<<24,Qe=L,ut=Q,Xe=te,Ne=fe,qe=_e,Ge=je,pe=Ve,he=ct,Re=Ie,Oe=nt,Pe=bt,Be=Ot,vt=pt,jt=ht,Bt=xt,It=wt,J,Zt=0;Zt<20;Zt+=2)J=Qe+vt|0,qe^=J<<7|J>>>25,J=qe+Qe|0,Re^=J<<9|J>>>23,J=Re+qe|0,vt^=J<<13|J>>>19,J=vt+Re|0,Qe^=J<<18|J>>>14,J=Ge+ut|0,Oe^=J<<7|J>>>25,J=Oe+Ge|0,jt^=J<<9|J>>>23,J=jt+Oe|0,ut^=J<<13|J>>>19,J=ut+jt|0,Ge^=J<<18|J>>>14,J=Pe+pe|0,Bt^=J<<7|J>>>25,J=Bt+Pe|0,Xe^=J<<9|J>>>23,J=Xe+Bt|0,pe^=J<<13|J>>>19,J=pe+Xe|0,Pe^=J<<18|J>>>14,J=It+Be|0,Ne^=J<<7|J>>>25,J=Ne+It|0,he^=J<<9|J>>>23,J=he+Ne|0,Be^=J<<13|J>>>19,J=Be+he|0,It^=J<<18|J>>>14,J=Qe+Ne|0,ut^=J<<7|J>>>25,J=ut+Qe|0,Xe^=J<<9|J>>>23,J=Xe+ut|0,Ne^=J<<13|J>>>19,J=Ne+Xe|0,Qe^=J<<18|J>>>14,J=Ge+qe|0,pe^=J<<7|J>>>25,J=pe+Ge|0,he^=J<<9|J>>>23,J=he+pe|0,qe^=J<<13|J>>>19,J=qe+he|0,Ge^=J<<18|J>>>14,J=Pe+Oe|0,Be^=J<<7|J>>>25,J=Be+Pe|0,Re^=J<<9|J>>>23,J=Re+Be|0,Oe^=J<<13|J>>>19,J=Oe+Re|0,Pe^=J<<18|J>>>14,J=It+Bt|0,vt^=J<<7|J>>>25,J=vt+It|0,jt^=J<<9|J>>>23,J=jt+vt|0,Bt^=J<<13|J>>>19,J=Bt+jt|0,It^=J<<18|J>>>14;T[0]=Qe>>>0&255,T[1]=Qe>>>8&255,T[2]=Qe>>>16&255,T[3]=Qe>>>24&255,T[4]=Ge>>>0&255,T[5]=Ge>>>8&255,T[6]=Ge>>>16&255,T[7]=Ge>>>24&255,T[8]=Pe>>>0&255,T[9]=Pe>>>8&255,T[10]=Pe>>>16&255,T[11]=Pe>>>24&255,T[12]=It>>>0&255,T[13]=It>>>8&255,T[14]=It>>>16&255,T[15]=It>>>24&255,T[16]=pe>>>0&255,T[17]=pe>>>8&255,T[18]=pe>>>16&255,T[19]=pe>>>24&255,T[20]=he>>>0&255,T[21]=he>>>8&255,T[22]=he>>>16&255,T[23]=he>>>24&255,T[24]=Re>>>0&255,T[25]=Re>>>8&255,T[26]=Re>>>16&255,T[27]=Re>>>24&255,T[28]=Oe>>>0&255,T[29]=Oe>>>8&255,T[30]=Oe>>>16&255,T[31]=Oe>>>24&255}function O(T,D,$,A){x(T,D,$,A)}function E(T,D,$,A){S(T,D,$,A)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function P(T,D,$,A,L,Q,te){var fe=new Uint8Array(16),_e=new Uint8Array(64),je,Ve;for(Ve=0;Ve<16;Ve++)fe[Ve]=0;for(Ve=0;Ve<8;Ve++)fe[Ve]=Q[Ve];for(;L>=64;){for(O(_e,fe,te,C),Ve=0;Ve<64;Ve++)T[D+Ve]=$[A+Ve]^_e[Ve];for(je=1,Ve=8;Ve<16;Ve++)je=je+(fe[Ve]&255)|0,fe[Ve]=je&255,je>>>=8;L-=64,D+=64,A+=64}if(L>0)for(O(_e,fe,te,C),Ve=0;Ve=64;){for(O(te,Q,L,C),_e=0;_e<64;_e++)T[D+_e]=te[_e];for(fe=1,_e=8;_e<16;_e++)fe=fe+(Q[_e]&255)|0,Q[_e]=fe&255,fe>>>=8;$-=64,D+=64}if($>0)for(O(te,Q,L,C),_e=0;_e<$;_e++)T[D+_e]=te[_e];return 0}function N(T,D,$,A,L){var Q=new Uint8Array(32);E(Q,A,L,C);for(var te=new Uint8Array(8),fe=0;fe<8;fe++)te[fe]=A[fe+16];return M(T,D,$,te,Q)}function B(T,D,$,A,L,Q,te){var fe=new Uint8Array(32);E(fe,Q,te,C);for(var _e=new Uint8Array(8),je=0;je<8;je++)_e[je]=Q[je+16];return P(T,D,$,A,L,_e,fe)}var V=function(T){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,$,A,L,Q,te,fe,_e;D=T[0]&255|(T[1]&255)<<8,this.r[0]=D&8191,$=T[2]&255|(T[3]&255)<<8,this.r[1]=(D>>>13|$<<3)&8191,A=T[4]&255|(T[5]&255)<<8,this.r[2]=($>>>10|A<<6)&7939,L=T[6]&255|(T[7]&255)<<8,this.r[3]=(A>>>7|L<<9)&8191,Q=T[8]&255|(T[9]&255)<<8,this.r[4]=(L>>>4|Q<<12)&255,this.r[5]=Q>>>1&8190,te=T[10]&255|(T[11]&255)<<8,this.r[6]=(Q>>>14|te<<2)&8191,fe=T[12]&255|(T[13]&255)<<8,this.r[7]=(te>>>11|fe<<5)&8065,_e=T[14]&255|(T[15]&255)<<8,this.r[8]=(fe>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=T[16]&255|(T[17]&255)<<8,this.pad[1]=T[18]&255|(T[19]&255)<<8,this.pad[2]=T[20]&255|(T[21]&255)<<8,this.pad[3]=T[22]&255|(T[23]&255)<<8,this.pad[4]=T[24]&255|(T[25]&255)<<8,this.pad[5]=T[26]&255|(T[27]&255)<<8,this.pad[6]=T[28]&255|(T[29]&255)<<8,this.pad[7]=T[30]&255|(T[31]&255)<<8};V.prototype.blocks=function(T,D,$){for(var A=this.fin?0:2048,L,Q,te,fe,_e,je,Ve,ct,Ie,nt,bt,Ot,pt,ht,xt,wt,Qe,ut,Xe,Ne=this.h[0],qe=this.h[1],Ge=this.h[2],pe=this.h[3],he=this.h[4],Re=this.h[5],Oe=this.h[6],Pe=this.h[7],Be=this.h[8],vt=this.h[9],jt=this.r[0],Bt=this.r[1],It=this.r[2],J=this.r[3],Zt=this.r[4],sn=this.r[5],un=this.r[6],Ut=this.r[7],ln=this.r[8],rn=this.r[9];$>=16;)L=T[D+0]&255|(T[D+1]&255)<<8,Ne+=L&8191,Q=T[D+2]&255|(T[D+3]&255)<<8,qe+=(L>>>13|Q<<3)&8191,te=T[D+4]&255|(T[D+5]&255)<<8,Ge+=(Q>>>10|te<<6)&8191,fe=T[D+6]&255|(T[D+7]&255)<<8,pe+=(te>>>7|fe<<9)&8191,_e=T[D+8]&255|(T[D+9]&255)<<8,he+=(fe>>>4|_e<<12)&8191,Re+=_e>>>1&8191,je=T[D+10]&255|(T[D+11]&255)<<8,Oe+=(_e>>>14|je<<2)&8191,Ve=T[D+12]&255|(T[D+13]&255)<<8,Pe+=(je>>>11|Ve<<5)&8191,ct=T[D+14]&255|(T[D+15]&255)<<8,Be+=(Ve>>>8|ct<<8)&8191,vt+=ct>>>5|A,Ie=0,nt=Ie,nt+=Ne*jt,nt+=qe*(5*rn),nt+=Ge*(5*ln),nt+=pe*(5*Ut),nt+=he*(5*un),Ie=nt>>>13,nt&=8191,nt+=Re*(5*sn),nt+=Oe*(5*Zt),nt+=Pe*(5*J),nt+=Be*(5*It),nt+=vt*(5*Bt),Ie+=nt>>>13,nt&=8191,bt=Ie,bt+=Ne*Bt,bt+=qe*jt,bt+=Ge*(5*rn),bt+=pe*(5*ln),bt+=he*(5*Ut),Ie=bt>>>13,bt&=8191,bt+=Re*(5*un),bt+=Oe*(5*sn),bt+=Pe*(5*Zt),bt+=Be*(5*J),bt+=vt*(5*It),Ie+=bt>>>13,bt&=8191,Ot=Ie,Ot+=Ne*It,Ot+=qe*Bt,Ot+=Ge*jt,Ot+=pe*(5*rn),Ot+=he*(5*ln),Ie=Ot>>>13,Ot&=8191,Ot+=Re*(5*Ut),Ot+=Oe*(5*un),Ot+=Pe*(5*sn),Ot+=Be*(5*Zt),Ot+=vt*(5*J),Ie+=Ot>>>13,Ot&=8191,pt=Ie,pt+=Ne*J,pt+=qe*It,pt+=Ge*Bt,pt+=pe*jt,pt+=he*(5*rn),Ie=pt>>>13,pt&=8191,pt+=Re*(5*ln),pt+=Oe*(5*Ut),pt+=Pe*(5*un),pt+=Be*(5*sn),pt+=vt*(5*Zt),Ie+=pt>>>13,pt&=8191,ht=Ie,ht+=Ne*Zt,ht+=qe*J,ht+=Ge*It,ht+=pe*Bt,ht+=he*jt,Ie=ht>>>13,ht&=8191,ht+=Re*(5*rn),ht+=Oe*(5*ln),ht+=Pe*(5*Ut),ht+=Be*(5*un),ht+=vt*(5*sn),Ie+=ht>>>13,ht&=8191,xt=Ie,xt+=Ne*sn,xt+=qe*Zt,xt+=Ge*J,xt+=pe*It,xt+=he*Bt,Ie=xt>>>13,xt&=8191,xt+=Re*jt,xt+=Oe*(5*rn),xt+=Pe*(5*ln),xt+=Be*(5*Ut),xt+=vt*(5*un),Ie+=xt>>>13,xt&=8191,wt=Ie,wt+=Ne*un,wt+=qe*sn,wt+=Ge*Zt,wt+=pe*J,wt+=he*It,Ie=wt>>>13,wt&=8191,wt+=Re*Bt,wt+=Oe*jt,wt+=Pe*(5*rn),wt+=Be*(5*ln),wt+=vt*(5*Ut),Ie+=wt>>>13,wt&=8191,Qe=Ie,Qe+=Ne*Ut,Qe+=qe*un,Qe+=Ge*sn,Qe+=pe*Zt,Qe+=he*J,Ie=Qe>>>13,Qe&=8191,Qe+=Re*It,Qe+=Oe*Bt,Qe+=Pe*jt,Qe+=Be*(5*rn),Qe+=vt*(5*ln),Ie+=Qe>>>13,Qe&=8191,ut=Ie,ut+=Ne*ln,ut+=qe*Ut,ut+=Ge*un,ut+=pe*sn,ut+=he*Zt,Ie=ut>>>13,ut&=8191,ut+=Re*J,ut+=Oe*It,ut+=Pe*Bt,ut+=Be*jt,ut+=vt*(5*rn),Ie+=ut>>>13,ut&=8191,Xe=Ie,Xe+=Ne*rn,Xe+=qe*ln,Xe+=Ge*Ut,Xe+=pe*un,Xe+=he*sn,Ie=Xe>>>13,Xe&=8191,Xe+=Re*Zt,Xe+=Oe*J,Xe+=Pe*It,Xe+=Be*Bt,Xe+=vt*jt,Ie+=Xe>>>13,Xe&=8191,Ie=(Ie<<2)+Ie|0,Ie=Ie+nt|0,nt=Ie&8191,Ie=Ie>>>13,bt+=Ie,Ne=nt,qe=bt,Ge=Ot,pe=pt,he=ht,Re=xt,Oe=wt,Pe=Qe,Be=ut,vt=Xe,D+=16,$-=16;this.h[0]=Ne,this.h[1]=qe,this.h[2]=Ge,this.h[3]=pe,this.h[4]=he,this.h[5]=Re,this.h[6]=Oe,this.h[7]=Pe,this.h[8]=Be,this.h[9]=vt},V.prototype.finish=function(T,D){var $=new Uint16Array(10),A,L,Q,te;if(this.leftover){for(te=this.leftover,this.buffer[te++]=1;te<16;te++)this.buffer[te]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(A=this.h[1]>>>13,this.h[1]&=8191,te=2;te<10;te++)this.h[te]+=A,A=this.h[te]>>>13,this.h[te]&=8191;for(this.h[0]+=A*5,A=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=A,A=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=A,$[0]=this.h[0]+5,A=$[0]>>>13,$[0]&=8191,te=1;te<10;te++)$[te]=this.h[te]+A,A=$[te]>>>13,$[te]&=8191;for($[9]-=8192,L=(A^1)-1,te=0;te<10;te++)$[te]&=L;for(L=~L,te=0;te<10;te++)this.h[te]=this.h[te]&L|$[te];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,Q=this.h[0]+this.pad[0],this.h[0]=Q&65535,te=1;te<8;te++)Q=(this.h[te]+this.pad[te]|0)+(Q>>>16)|0,this.h[te]=Q&65535;T[D+0]=this.h[0]>>>0&255,T[D+1]=this.h[0]>>>8&255,T[D+2]=this.h[1]>>>0&255,T[D+3]=this.h[1]>>>8&255,T[D+4]=this.h[2]>>>0&255,T[D+5]=this.h[2]>>>8&255,T[D+6]=this.h[3]>>>0&255,T[D+7]=this.h[3]>>>8&255,T[D+8]=this.h[4]>>>0&255,T[D+9]=this.h[4]>>>8&255,T[D+10]=this.h[5]>>>0&255,T[D+11]=this.h[5]>>>8&255,T[D+12]=this.h[6]>>>0&255,T[D+13]=this.h[6]>>>8&255,T[D+14]=this.h[7]>>>0&255,T[D+15]=this.h[7]>>>8&255},V.prototype.update=function(T,D,$){var A,L;if(this.leftover){for(L=16-this.leftover,L>$&&(L=$),A=0;A=16&&(L=$-$%16,this.blocks(T,D,L),D+=L,$-=L),$){for(A=0;A<$;A++)this.buffer[this.leftover+A]=T[D+A];this.leftover+=$}};function W(T,D,$,A,L,Q){var te=new V(Q);return te.update($,A,L),te.finish(T,D),0}function ee(T,D,$,A,L,Q){var te=new Uint8Array(16);return W(te,0,$,A,L,Q),b(T,D,te,0)}function Z(T,D,$,A,L){var Q;if($<32)return-1;for(B(T,0,D,0,$,A,L),W(T,16,T,32,$-32,T),Q=0;Q<16;Q++)T[Q]=0;return 0}function q(T,D,$,A,L){var Q,te=new Uint8Array(32);if($<32||(N(te,0,32,A,L),ee(D,16,D,32,$-32,te)!==0))return-1;for(B(T,0,D,0,$,A,L),Q=0;Q<32;Q++)T[Q]=0;return 0}function G(T,D){var $;for($=0;$<16;$++)T[$]=D[$]|0}function H(T){var D,$,A=1;for(D=0;D<16;D++)$=T[D]+A+65535,A=Math.floor($/65536),T[D]=$-A*65536;T[0]+=A-1+37*(A-1)}function j(T,D,$){for(var A,L=~($-1),Q=0;Q<16;Q++)A=L&(T[Q]^D[Q]),T[Q]^=A,D[Q]^=A}function K(T,D){var $,A,L,Q=n(),te=n();for($=0;$<16;$++)te[$]=D[$];for(H(te),H(te),H(te),A=0;A<2;A++){for(Q[0]=te[0]-65517,$=1;$<15;$++)Q[$]=te[$]-65535-(Q[$-1]>>16&1),Q[$-1]&=65535;Q[15]=te[15]-32767-(Q[14]>>16&1),L=Q[15]>>16&1,Q[14]&=65535,j(te,Q,1-L)}for($=0;$<16;$++)T[2*$]=te[$]&255,T[2*$+1]=te[$]>>8}function Y(T,D){var $=new Uint8Array(32),A=new Uint8Array(32);return K($,T),K(A,D),w($,0,A,0)}function re(T){var D=new Uint8Array(32);return K(D,T),D[0]&1}function ie(T,D){var $;for($=0;$<16;$++)T[$]=D[2*$]+(D[2*$+1]<<8);T[15]&=32767}function se(T,D,$){for(var A=0;A<16;A++)T[A]=D[A]+$[A]}function ye(T,D,$){for(var A=0;A<16;A++)T[A]=D[A]-$[A]}function we(T,D,$){var A,L,Q=0,te=0,fe=0,_e=0,je=0,Ve=0,ct=0,Ie=0,nt=0,bt=0,Ot=0,pt=0,ht=0,xt=0,wt=0,Qe=0,ut=0,Xe=0,Ne=0,qe=0,Ge=0,pe=0,he=0,Re=0,Oe=0,Pe=0,Be=0,vt=0,jt=0,Bt=0,It=0,J=$[0],Zt=$[1],sn=$[2],un=$[3],Ut=$[4],ln=$[5],rn=$[6],Yn=$[7],mn=$[8],kn=$[9],Zn=$[10],Xn=$[11],wr=$[12],Ir=$[13],Nr=$[14],Lr=$[15];A=D[0],Q+=A*J,te+=A*Zt,fe+=A*sn,_e+=A*un,je+=A*Ut,Ve+=A*ln,ct+=A*rn,Ie+=A*Yn,nt+=A*mn,bt+=A*kn,Ot+=A*Zn,pt+=A*Xn,ht+=A*wr,xt+=A*Ir,wt+=A*Nr,Qe+=A*Lr,A=D[1],te+=A*J,fe+=A*Zt,_e+=A*sn,je+=A*un,Ve+=A*Ut,ct+=A*ln,Ie+=A*rn,nt+=A*Yn,bt+=A*mn,Ot+=A*kn,pt+=A*Zn,ht+=A*Xn,xt+=A*wr,wt+=A*Ir,Qe+=A*Nr,ut+=A*Lr,A=D[2],fe+=A*J,_e+=A*Zt,je+=A*sn,Ve+=A*un,ct+=A*Ut,Ie+=A*ln,nt+=A*rn,bt+=A*Yn,Ot+=A*mn,pt+=A*kn,ht+=A*Zn,xt+=A*Xn,wt+=A*wr,Qe+=A*Ir,ut+=A*Nr,Xe+=A*Lr,A=D[3],_e+=A*J,je+=A*Zt,Ve+=A*sn,ct+=A*un,Ie+=A*Ut,nt+=A*ln,bt+=A*rn,Ot+=A*Yn,pt+=A*mn,ht+=A*kn,xt+=A*Zn,wt+=A*Xn,Qe+=A*wr,ut+=A*Ir,Xe+=A*Nr,Ne+=A*Lr,A=D[4],je+=A*J,Ve+=A*Zt,ct+=A*sn,Ie+=A*un,nt+=A*Ut,bt+=A*ln,Ot+=A*rn,pt+=A*Yn,ht+=A*mn,xt+=A*kn,wt+=A*Zn,Qe+=A*Xn,ut+=A*wr,Xe+=A*Ir,Ne+=A*Nr,qe+=A*Lr,A=D[5],Ve+=A*J,ct+=A*Zt,Ie+=A*sn,nt+=A*un,bt+=A*Ut,Ot+=A*ln,pt+=A*rn,ht+=A*Yn,xt+=A*mn,wt+=A*kn,Qe+=A*Zn,ut+=A*Xn,Xe+=A*wr,Ne+=A*Ir,qe+=A*Nr,Ge+=A*Lr,A=D[6],ct+=A*J,Ie+=A*Zt,nt+=A*sn,bt+=A*un,Ot+=A*Ut,pt+=A*ln,ht+=A*rn,xt+=A*Yn,wt+=A*mn,Qe+=A*kn,ut+=A*Zn,Xe+=A*Xn,Ne+=A*wr,qe+=A*Ir,Ge+=A*Nr,pe+=A*Lr,A=D[7],Ie+=A*J,nt+=A*Zt,bt+=A*sn,Ot+=A*un,pt+=A*Ut,ht+=A*ln,xt+=A*rn,wt+=A*Yn,Qe+=A*mn,ut+=A*kn,Xe+=A*Zn,Ne+=A*Xn,qe+=A*wr,Ge+=A*Ir,pe+=A*Nr,he+=A*Lr,A=D[8],nt+=A*J,bt+=A*Zt,Ot+=A*sn,pt+=A*un,ht+=A*Ut,xt+=A*ln,wt+=A*rn,Qe+=A*Yn,ut+=A*mn,Xe+=A*kn,Ne+=A*Zn,qe+=A*Xn,Ge+=A*wr,pe+=A*Ir,he+=A*Nr,Re+=A*Lr,A=D[9],bt+=A*J,Ot+=A*Zt,pt+=A*sn,ht+=A*un,xt+=A*Ut,wt+=A*ln,Qe+=A*rn,ut+=A*Yn,Xe+=A*mn,Ne+=A*kn,qe+=A*Zn,Ge+=A*Xn,pe+=A*wr,he+=A*Ir,Re+=A*Nr,Oe+=A*Lr,A=D[10],Ot+=A*J,pt+=A*Zt,ht+=A*sn,xt+=A*un,wt+=A*Ut,Qe+=A*ln,ut+=A*rn,Xe+=A*Yn,Ne+=A*mn,qe+=A*kn,Ge+=A*Zn,pe+=A*Xn,he+=A*wr,Re+=A*Ir,Oe+=A*Nr,Pe+=A*Lr,A=D[11],pt+=A*J,ht+=A*Zt,xt+=A*sn,wt+=A*un,Qe+=A*Ut,ut+=A*ln,Xe+=A*rn,Ne+=A*Yn,qe+=A*mn,Ge+=A*kn,pe+=A*Zn,he+=A*Xn,Re+=A*wr,Oe+=A*Ir,Pe+=A*Nr,Be+=A*Lr,A=D[12],ht+=A*J,xt+=A*Zt,wt+=A*sn,Qe+=A*un,ut+=A*Ut,Xe+=A*ln,Ne+=A*rn,qe+=A*Yn,Ge+=A*mn,pe+=A*kn,he+=A*Zn,Re+=A*Xn,Oe+=A*wr,Pe+=A*Ir,Be+=A*Nr,vt+=A*Lr,A=D[13],xt+=A*J,wt+=A*Zt,Qe+=A*sn,ut+=A*un,Xe+=A*Ut,Ne+=A*ln,qe+=A*rn,Ge+=A*Yn,pe+=A*mn,he+=A*kn,Re+=A*Zn,Oe+=A*Xn,Pe+=A*wr,Be+=A*Ir,vt+=A*Nr,jt+=A*Lr,A=D[14],wt+=A*J,Qe+=A*Zt,ut+=A*sn,Xe+=A*un,Ne+=A*Ut,qe+=A*ln,Ge+=A*rn,pe+=A*Yn,he+=A*mn,Re+=A*kn,Oe+=A*Zn,Pe+=A*Xn,Be+=A*wr,vt+=A*Ir,jt+=A*Nr,Bt+=A*Lr,A=D[15],Qe+=A*J,ut+=A*Zt,Xe+=A*sn,Ne+=A*un,qe+=A*Ut,Ge+=A*ln,pe+=A*rn,he+=A*Yn,Re+=A*mn,Oe+=A*kn,Pe+=A*Zn,Be+=A*Xn,vt+=A*wr,jt+=A*Ir,Bt+=A*Nr,It+=A*Lr,Q+=38*ut,te+=38*Xe,fe+=38*Ne,_e+=38*qe,je+=38*Ge,Ve+=38*pe,ct+=38*he,Ie+=38*Re,nt+=38*Oe,bt+=38*Pe,Ot+=38*Be,pt+=38*vt,ht+=38*jt,xt+=38*Bt,wt+=38*It,L=1,A=Q+L+65535,L=Math.floor(A/65536),Q=A-L*65536,A=te+L+65535,L=Math.floor(A/65536),te=A-L*65536,A=fe+L+65535,L=Math.floor(A/65536),fe=A-L*65536,A=_e+L+65535,L=Math.floor(A/65536),_e=A-L*65536,A=je+L+65535,L=Math.floor(A/65536),je=A-L*65536,A=Ve+L+65535,L=Math.floor(A/65536),Ve=A-L*65536,A=ct+L+65535,L=Math.floor(A/65536),ct=A-L*65536,A=Ie+L+65535,L=Math.floor(A/65536),Ie=A-L*65536,A=nt+L+65535,L=Math.floor(A/65536),nt=A-L*65536,A=bt+L+65535,L=Math.floor(A/65536),bt=A-L*65536,A=Ot+L+65535,L=Math.floor(A/65536),Ot=A-L*65536,A=pt+L+65535,L=Math.floor(A/65536),pt=A-L*65536,A=ht+L+65535,L=Math.floor(A/65536),ht=A-L*65536,A=xt+L+65535,L=Math.floor(A/65536),xt=A-L*65536,A=wt+L+65535,L=Math.floor(A/65536),wt=A-L*65536,A=Qe+L+65535,L=Math.floor(A/65536),Qe=A-L*65536,Q+=L-1+37*(L-1),L=1,A=Q+L+65535,L=Math.floor(A/65536),Q=A-L*65536,A=te+L+65535,L=Math.floor(A/65536),te=A-L*65536,A=fe+L+65535,L=Math.floor(A/65536),fe=A-L*65536,A=_e+L+65535,L=Math.floor(A/65536),_e=A-L*65536,A=je+L+65535,L=Math.floor(A/65536),je=A-L*65536,A=Ve+L+65535,L=Math.floor(A/65536),Ve=A-L*65536,A=ct+L+65535,L=Math.floor(A/65536),ct=A-L*65536,A=Ie+L+65535,L=Math.floor(A/65536),Ie=A-L*65536,A=nt+L+65535,L=Math.floor(A/65536),nt=A-L*65536,A=bt+L+65535,L=Math.floor(A/65536),bt=A-L*65536,A=Ot+L+65535,L=Math.floor(A/65536),Ot=A-L*65536,A=pt+L+65535,L=Math.floor(A/65536),pt=A-L*65536,A=ht+L+65535,L=Math.floor(A/65536),ht=A-L*65536,A=xt+L+65535,L=Math.floor(A/65536),xt=A-L*65536,A=wt+L+65535,L=Math.floor(A/65536),wt=A-L*65536,A=Qe+L+65535,L=Math.floor(A/65536),Qe=A-L*65536,Q+=L-1+37*(L-1),T[0]=Q,T[1]=te,T[2]=fe,T[3]=_e,T[4]=je,T[5]=Ve,T[6]=ct,T[7]=Ie,T[8]=nt,T[9]=bt,T[10]=Ot,T[11]=pt,T[12]=ht,T[13]=xt,T[14]=wt,T[15]=Qe}function He(T,D){we(T,D,D)}function Ee(T,D){var $=n(),A;for(A=0;A<16;A++)$[A]=D[A];for(A=253;A>=0;A--)He($,$),A!==2&&A!==4&&we($,$,D);for(A=0;A<16;A++)T[A]=$[A]}function it(T,D){var $=n(),A;for(A=0;A<16;A++)$[A]=D[A];for(A=250;A>=0;A--)He($,$),A!==1&&we($,$,D);for(A=0;A<16;A++)T[A]=$[A]}function ke(T,D,$){var A=new Uint8Array(32),L=new Float64Array(80),Q,te,fe=n(),_e=n(),je=n(),Ve=n(),ct=n(),Ie=n();for(te=0;te<31;te++)A[te]=D[te];for(A[31]=D[31]&127|64,A[0]&=248,ie(L,$),te=0;te<16;te++)_e[te]=L[te],Ve[te]=fe[te]=je[te]=0;for(fe[0]=Ve[0]=1,te=254;te>=0;--te)Q=A[te>>>3]>>>(te&7)&1,j(fe,_e,Q),j(je,Ve,Q),se(ct,fe,je),ye(fe,fe,je),se(je,_e,Ve),ye(_e,_e,Ve),He(Ve,ct),He(Ie,fe),we(fe,je,fe),we(je,_e,ct),se(ct,fe,je),ye(fe,fe,je),He(_e,fe),ye(je,Ve,Ie),we(fe,je,u),se(fe,fe,Ve),we(je,je,fe),we(fe,Ve,Ie),we(Ve,_e,L),He(_e,ct),j(fe,_e,Q),j(je,Ve,Q);for(te=0;te<16;te++)L[te+16]=fe[te],L[te+32]=je[te],L[te+48]=_e[te],L[te+64]=Ve[te];var nt=L.subarray(32),bt=L.subarray(16);return Ee(nt,nt),we(bt,bt,nt),K(T,bt),0}function Le(T,D){return ke(T,D,o)}function De(T,D){return r(D,32),Le(T,D)}function me(T,D,$){var A=new Uint8Array(32);return ke(A,$,D),E(T,i,A,C)}var yt=Z,lt=q;function Ft(T,D,$,A,L,Q){var te=new Uint8Array(32);return me(te,L,Q),yt(T,D,$,A,te)}function yn(T,D,$,A,L,Q){var te=new Uint8Array(32);return me(te,L,Q),lt(T,D,$,A,te)}var nn=[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 ne(T,D,$,A){for(var L=new Int32Array(16),Q=new Int32Array(16),te,fe,_e,je,Ve,ct,Ie,nt,bt,Ot,pt,ht,xt,wt,Qe,ut,Xe,Ne,qe,Ge,pe,he,Re,Oe,Pe,Be,vt=T[0],jt=T[1],Bt=T[2],It=T[3],J=T[4],Zt=T[5],sn=T[6],un=T[7],Ut=D[0],ln=D[1],rn=D[2],Yn=D[3],mn=D[4],kn=D[5],Zn=D[6],Xn=D[7],wr=0;A>=128;){for(qe=0;qe<16;qe++)Ge=8*qe+wr,L[qe]=$[Ge+0]<<24|$[Ge+1]<<16|$[Ge+2]<<8|$[Ge+3],Q[qe]=$[Ge+4]<<24|$[Ge+5]<<16|$[Ge+6]<<8|$[Ge+7];for(qe=0;qe<80;qe++)if(te=vt,fe=jt,_e=Bt,je=It,Ve=J,ct=Zt,Ie=sn,nt=un,bt=Ut,Ot=ln,pt=rn,ht=Yn,xt=mn,wt=kn,Qe=Zn,ut=Xn,pe=un,he=Xn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=(J>>>14|mn<<18)^(J>>>18|mn<<14)^(mn>>>9|J<<23),he=(mn>>>14|J<<18)^(mn>>>18|J<<14)^(J>>>9|mn<<23),Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,pe=J&Zt^~J&sn,he=mn&kn^~mn&Zn,Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,pe=nn[qe*2],he=nn[qe*2+1],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,pe=L[qe%16],he=Q[qe%16],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,Xe=Pe&65535|Be<<16,Ne=Re&65535|Oe<<16,pe=Xe,he=Ne,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=(vt>>>28|Ut<<4)^(Ut>>>2|vt<<30)^(Ut>>>7|vt<<25),he=(Ut>>>28|vt<<4)^(vt>>>2|Ut<<30)^(vt>>>7|Ut<<25),Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,pe=vt&jt^vt&Bt^jt&Bt,he=Ut&ln^Ut&rn^ln&rn,Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,nt=Pe&65535|Be<<16,ut=Re&65535|Oe<<16,pe=je,he=ht,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=Xe,he=Ne,Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,je=Pe&65535|Be<<16,ht=Re&65535|Oe<<16,jt=te,Bt=fe,It=_e,J=je,Zt=Ve,sn=ct,un=Ie,vt=nt,ln=bt,rn=Ot,Yn=pt,mn=ht,kn=xt,Zn=wt,Xn=Qe,Ut=ut,qe%16===15)for(Ge=0;Ge<16;Ge++)pe=L[Ge],he=Q[Ge],Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=L[(Ge+9)%16],he=Q[(Ge+9)%16],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Xe=L[(Ge+1)%16],Ne=Q[(Ge+1)%16],pe=(Xe>>>1|Ne<<31)^(Xe>>>8|Ne<<24)^Xe>>>7,he=(Ne>>>1|Xe<<31)^(Ne>>>8|Xe<<24)^(Ne>>>7|Xe<<25),Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Xe=L[(Ge+14)%16],Ne=Q[(Ge+14)%16],pe=(Xe>>>19|Ne<<13)^(Ne>>>29|Xe<<3)^Xe>>>6,he=(Ne>>>19|Xe<<13)^(Xe>>>29|Ne<<3)^(Ne>>>6|Xe<<26),Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,L[Ge]=Pe&65535|Be<<16,Q[Ge]=Re&65535|Oe<<16;pe=vt,he=Ut,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[0],he=D[0],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[0]=vt=Pe&65535|Be<<16,D[0]=Ut=Re&65535|Oe<<16,pe=jt,he=ln,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[1],he=D[1],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[1]=jt=Pe&65535|Be<<16,D[1]=ln=Re&65535|Oe<<16,pe=Bt,he=rn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[2],he=D[2],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[2]=Bt=Pe&65535|Be<<16,D[2]=rn=Re&65535|Oe<<16,pe=It,he=Yn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[3],he=D[3],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[3]=It=Pe&65535|Be<<16,D[3]=Yn=Re&65535|Oe<<16,pe=J,he=mn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[4],he=D[4],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[4]=J=Pe&65535|Be<<16,D[4]=mn=Re&65535|Oe<<16,pe=Zt,he=kn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[5],he=D[5],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[5]=Zt=Pe&65535|Be<<16,D[5]=kn=Re&65535|Oe<<16,pe=sn,he=Zn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[6],he=D[6],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[6]=sn=Pe&65535|Be<<16,D[6]=Zn=Re&65535|Oe<<16,pe=un,he=Xn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[7],he=D[7],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[7]=un=Pe&65535|Be<<16,D[7]=Xn=Re&65535|Oe<<16,wr+=128,A-=128}return A}function de(T,D,$){var A=new Int32Array(8),L=new Int32Array(8),Q=new Uint8Array(256),te,fe=$;for(A[0]=1779033703,A[1]=3144134277,A[2]=1013904242,A[3]=2773480762,A[4]=1359893119,A[5]=2600822924,A[6]=528734635,A[7]=1541459225,L[0]=4089235720,L[1]=2227873595,L[2]=4271175723,L[3]=1595750129,L[4]=2917565137,L[5]=725511199,L[6]=4215389547,L[7]=327033209,ne(A,L,D,$),$%=128,te=0;te<$;te++)Q[te]=D[fe-$+te];for(Q[$]=128,$=256-128*($<112?1:0),Q[$-9]=0,m(Q,$-8,fe/536870912|0,fe<<3),ne(A,L,Q,$),te=0;te<8;te++)m(T,8*te,A[te],L[te]);return 0}function ge(T,D){var $=n(),A=n(),L=n(),Q=n(),te=n(),fe=n(),_e=n(),je=n(),Ve=n();ye($,T[1],T[0]),ye(Ve,D[1],D[0]),we($,$,Ve),se(A,T[0],T[1]),se(Ve,D[0],D[1]),we(A,A,Ve),we(L,T[3],D[3]),we(L,L,c),we(Q,T[2],D[2]),se(Q,Q,Q),ye(te,A,$),ye(fe,Q,L),se(_e,Q,L),se(je,A,$),we(T[0],te,fe),we(T[1],je,_e),we(T[2],_e,fe),we(T[3],te,je)}function Ue(T,D,$){var A;for(A=0;A<4;A++)j(T[A],D[A],$)}function Fe(T,D){var $=n(),A=n(),L=n();Ee(L,D[2]),we($,D[0],L),we(A,D[1],L),K(T,A),T[31]^=re($)<<7}function Ae(T,D,$){var A,L;for(G(T[0],a),G(T[1],s),G(T[2],s),G(T[3],a),L=255;L>=0;--L)A=$[L/8|0]>>(L&7)&1,Ue(T,D,A),ge(D,T),ge(T,T),Ue(T,D,A)}function tt(T,D){var $=[n(),n(),n(),n()];G($[0],f),G($[1],h),G($[2],s),we($[3],f,h),Ae(T,$,D)}function mt(T,D,$){var A=new Uint8Array(64),L=[n(),n(),n(),n()],Q;for($||r(D,32),de(A,D,32),A[0]&=248,A[31]&=127,A[31]|=64,tt(L,A),Fe(T,L),Q=0;Q<32;Q++)D[Q+32]=T[Q];return 0}var wn=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 Kt(T,D){var $,A,L,Q;for(A=63;A>=32;--A){for($=0,L=A-32,Q=A-12;L>4)*wn[L],$=D[L]>>8,D[L]&=255;for(L=0;L<32;L++)D[L]-=$*wn[L];for(A=0;A<32;A++)D[A+1]+=D[A]>>8,T[A]=D[A]&255}function _n(T){var D=new Float64Array(64),$;for($=0;$<64;$++)D[$]=T[$];for($=0;$<64;$++)T[$]=0;Kt(T,D)}function $i(T,D,$,A){var L=new Uint8Array(64),Q=new Uint8Array(64),te=new Uint8Array(64),fe,_e,je=new Float64Array(64),Ve=[n(),n(),n(),n()];de(L,A,32),L[0]&=248,L[31]&=127,L[31]|=64;var ct=$+64;for(fe=0;fe<$;fe++)T[64+fe]=D[fe];for(fe=0;fe<32;fe++)T[32+fe]=L[32+fe];for(de(te,T.subarray(32),$+32),_n(te),tt(Ve,te),Fe(T,Ve),fe=32;fe<64;fe++)T[fe]=A[fe];for(de(Q,T,$+64),_n(Q),fe=0;fe<64;fe++)je[fe]=0;for(fe=0;fe<32;fe++)je[fe]=te[fe];for(fe=0;fe<32;fe++)for(_e=0;_e<32;_e++)je[fe+_e]+=Q[fe]*L[_e];return Kt(T.subarray(32),je),ct}function xr(T,D){var $=n(),A=n(),L=n(),Q=n(),te=n(),fe=n(),_e=n();return G(T[2],s),ie(T[1],D),He(L,T[1]),we(Q,L,l),ye(L,L,T[2]),se(Q,T[2],Q),He(te,Q),He(fe,te),we(_e,fe,te),we($,_e,L),we($,$,Q),it($,$),we($,$,L),we($,$,Q),we($,$,Q),we(T[0],$,Q),He(A,T[0]),we(A,A,Q),Y(A,L)&&we(T[0],T[0],p),He(A,T[0]),we(A,A,Q),Y(A,L)?-1:(re(T[0])===D[31]>>7&&ye(T[0],a,T[0]),we(T[3],T[0],T[1]),0)}function mi(T,D,$,A){var L,Q=new Uint8Array(32),te=new Uint8Array(64),fe=[n(),n(),n(),n()],_e=[n(),n(),n(),n()];if($<64||xr(_e,A))return-1;for(L=0;L<$;L++)T[L]=D[L];for(L=0;L<32;L++)T[L+32]=A[L];if(de(te,T,$),_n(te),Ae(fe,_e,te),tt(_e,D.subarray(32)),ge(fe,_e),Fe(Q,fe),$-=64,w(D,0,Q,0)){for(L=0;L<$;L++)T[L]=0;return-1}for(L=0;L<$;L++)T[L]=D[L+64];return $}var ur=32,ai=24,vi=32,Dr=16,Zi=32,vo=32,yi=32,$r=32,_a=32,_t=ai,hn=vi,Sn=Dr,Gn=64,lr=32,Xr=64,yo=32,Xl=64;t.lowlevel={crypto_core_hsalsa20:E,crypto_stream_xor:B,crypto_stream:N,crypto_stream_salsa20_xor:P,crypto_stream_salsa20:M,crypto_onetimeauth:W,crypto_onetimeauth_verify:ee,crypto_verify_16:b,crypto_verify_32:w,crypto_secretbox:Z,crypto_secretbox_open:q,crypto_scalarmult:ke,crypto_scalarmult_base:Le,crypto_box_beforenm:me,crypto_box_afternm:yt,crypto_box:Ft,crypto_box_open:yn,crypto_box_keypair:De,crypto_hash:de,crypto_sign:$i,crypto_sign_keypair:mt,crypto_sign_open:mi,crypto_secretbox_KEYBYTES:ur,crypto_secretbox_NONCEBYTES:ai,crypto_secretbox_ZEROBYTES:vi,crypto_secretbox_BOXZEROBYTES:Dr,crypto_scalarmult_BYTES:Zi,crypto_scalarmult_SCALARBYTES:vo,crypto_box_PUBLICKEYBYTES:yi,crypto_box_SECRETKEYBYTES:$r,crypto_box_BEFORENMBYTES:_a,crypto_box_NONCEBYTES:_t,crypto_box_ZEROBYTES:hn,crypto_box_BOXZEROBYTES:Sn,crypto_sign_BYTES:Gn,crypto_sign_PUBLICKEYBYTES:lr,crypto_sign_SECRETKEYBYTES:Xr,crypto_sign_SEEDBYTES:yo,crypto_hash_BYTES:Xl,gf:n,D:l,L:wn,pack25519:K,unpack25519:ie,M:we,A:se,S:He,Z:ye,pow2523:it,add:ge,set25519:G,modL:Kt,scalarmult:Ae,scalarbase:tt};function Cf(T,D){if(T.length!==ur)throw new Error("bad key size");if(D.length!==ai)throw new Error("bad nonce size")}function oe(T,D){if(T.length!==yi)throw new Error("bad public key size");if(D.length!==$r)throw new Error("bad secret key size")}function ue(){for(var T=0;T=0},t.sign.keyPair=function(){var T=new Uint8Array(lr),D=new Uint8Array(Xr);return mt(T,D),{publicKey:T,secretKey:D}},t.sign.keyPair.fromSecretKey=function(T){if(ue(T),T.length!==Xr)throw new Error("bad secret key size");for(var D=new Uint8Array(lr),$=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{let n=!1;const r=e.map(i=>{const o=GN(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{scope:h,children:p,...m}=f,y=h?.[e]?.[u]||s,b=v.useMemo(()=>m,Object.values(m));return I.jsx(y.Provider,{value:b,children:p})};l.displayName=o+"Provider";function c(f,h){const p=h?.[e]?.[u]||s,m=v.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[l,c]}const i=()=>{const o=n.map(a=>v.createContext(a));return function(s){const u=s?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...s,[e]:u}}),[s,u])}};return i.scopeName=e,[r,tXe(i,...t)]}function tXe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=r.reduce((s,{useScope:u,scopeName:l})=>{const f=u(o)[`__scope${l}`];return{...s,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function YN(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}var nXe=globalThis?.document?v.useLayoutEffect:()=>{},rXe=zx[" useInsertionEffect ".trim().toString()]||nXe;function iXe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,a]=oXe({defaultProp:t,onChange:n}),s=e!==void 0,u=s?e:i;{const c=v.useRef(e!==void 0);v.useEffect(()=>{const f=c.current;f!==s&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,r])}const l=v.useCallback(c=>{if(s){const f=aXe(c)?c(e):c;f!==e&&a.current?.(f)}else o(c)},[s,e,o,a]);return[u,l]}function oXe({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),i=v.useRef(n),o=v.useRef(t);return rXe(()=>{o.current=t},[t]),v.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function aXe(e){return typeof e=="function"}function sXe(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var uXe=globalThis?.document?v.useLayoutEffect:()=>{};function lXe(e){const[t,n]=v.useState(void 0);return uXe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,s;if("borderBoxSize"in o){const u=o.borderBoxSize,l=Array.isArray(u)?u[0]:u;a=l.inlineSize,s=l.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function ZN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function cXe(...e){return t=>{let n=!1;const r=e.map(i=>{const o=ZN(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{};function dXe(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var nX=e=>{const{present:t,children:n}=e,r=hXe(t),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=fXe(r.ref,pXe(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:o}):null};nX.displayName="Presence";function hXe(e){const[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),o=v.useRef("none"),a=e?"mounted":"unmounted",[s,u]=dXe(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const l=Xy(r.current);o.current=s==="mounted"?l:"none"},[s]),XN(()=>{const l=r.current,c=i.current;if(c!==e){const h=o.current,p=Xy(l);e?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),XN(()=>{if(t){let l;const c=t.ownerDocument.defaultView??window,f=p=>{const y=Xy(r.current).includes(p.animationName);if(p.target===t&&y&&(u("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",l=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(o.current=Xy(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{c.clearTimeout(l),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:v.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function Xy(e){return e?.animationName||"none"}function pXe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function gXe(e){const t=mXe(e),n=v.forwardRef((r,i)=>{const{children:o,...a}=r,s=v.Children.toArray(o),u=s.find(yXe);if(u){const l=u.props.children,c=s.map(f=>f===u?v.Children.count(l)>1?v.Children.only(null):v.isValidElement(l)?l.props.children:null:f);return I.jsx(t,{...a,ref:i,children:v.isValidElement(l)?v.cloneElement(l,void 0,c):null})}return I.jsx(t,{...a,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function mXe(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const a=xXe(i),s=bXe(o,i.props);return i.type!==v.Fragment&&(s.ref=r?eX(r,a):a),v.cloneElement(i,s)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vXe=Symbol("radix.slottable");function yXe(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vXe}function bXe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...s)=>{const u=o(...s);return i(...s),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function xXe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wXe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],e8=wXe.reduce((e,t)=>{const n=gXe(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:a,...s}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),I.jsx(u,{...s,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),W2="Checkbox",[_Xe,ztt]=eXe(W2),[SXe,t8]=_Xe(W2);function CXe(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:a,name:s,onCheckedChange:u,required:l,value:c="on",internal_do_not_use_render:f}=e,[h,p]=iXe({prop:n,defaultProp:i??!1,onChange:u,caller:W2}),[m,y]=v.useState(null),[b,w]=v.useState(null),x=v.useRef(!1),S=m?!!a||!!m.closest("form"):!0,O={checked:h,disabled:o,setChecked:p,control:m,setControl:y,name:s,form:a,value:c,hasConsumerStoppedPropagationRef:x,required:l,defaultChecked:Cl(i)?!1:i,isFormControl:S,bubbleInput:b,setBubbleInput:w};return I.jsx(SXe,{scope:t,...O,children:AXe(f)?f(O):r})}var rX="CheckboxTrigger",iX=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:o,value:a,disabled:s,checked:u,required:l,setControl:c,setChecked:f,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:m}=t8(rX,e),y=tX(i,c),b=v.useRef(u);return v.useEffect(()=>{const w=o?.form;if(w){const x=()=>f(b.current);return w.addEventListener("reset",x),()=>w.removeEventListener("reset",x)}},[o,f]),I.jsx(e8.button,{type:"button",role:"checkbox","aria-checked":Cl(u)?"mixed":u,"aria-required":l,"data-state":uX(u),"data-disabled":s?"":void 0,disabled:s,value:a,...r,ref:y,onKeyDown:YN(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:YN(n,w=>{f(x=>Cl(x)?!0:!x),m&&p&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})})});iX.displayName=rX;var EXe=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:a,disabled:s,value:u,onCheckedChange:l,form:c,...f}=e;return I.jsx(CXe,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:s,required:a,onCheckedChange:l,name:r,form:c,value:u,internal_do_not_use_render:({isFormControl:h})=>I.jsxs(I.Fragment,{children:[I.jsx(iX,{...f,ref:t,__scopeCheckbox:n}),h&&I.jsx(sX,{__scopeCheckbox:n})]})})});EXe.displayName=W2;var oX="CheckboxIndicator",OXe=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=t8(oX,n);return I.jsx(nX,{present:r||Cl(o.checked)||o.checked===!0,children:I.jsx(e8.span,{"data-state":uX(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});OXe.displayName=oX;var aX="CheckboxBubbleInput",sX=v.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:a,required:s,disabled:u,name:l,value:c,form:f,bubbleInput:h,setBubbleInput:p}=t8(aX,e),m=tX(n,p),y=sXe(o),b=lXe(r);v.useEffect(()=>{const x=h;if(!x)return;const S=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(S,"checked").set,C=!i.current;if(y!==o&&E){const P=new Event("click",{bubbles:C});x.indeterminate=Cl(o),E.call(x,Cl(o)?!1:o),x.dispatchEvent(P)}},[h,y,o,i]);const w=v.useRef(Cl(o)?!1:o);return I.jsx(e8.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??w.current,required:s,disabled:u,name:l,value:c,form:f,...t,tabIndex:-1,ref:m,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});sX.displayName=aX;function AXe(e){return typeof e=="function"}function Cl(e){return e==="indeterminate"}function uX(e){return Cl(e)?"indeterminate":e?"checked":"unchecked"}export{Sve as $,UQe as A,Gi as B,bQe as C,tme as D,SQe as E,yQe as F,pT as G,F as H,eQe as I,DQe as J,MXe as K,PQe as L,FQe as M,QXe as N,kXe as O,$Xe as P,MQe as Q,vQe as R,Pl as S,kQe as T,XXe as U,IXe as V,yve as W,wve as X,_ve as Y,Cz as Z,QQe as _,LXe as a,Vet as a$,Cve as a0,bve as a1,xve as a2,OJe as a3,YQe as a4,AJe as a5,vJe as a6,yJe as a7,wJe as a8,_Je as a9,YXe as aA,oQe as aB,KXe as aC,JXe as aD,uQe as aE,sQe as aF,tQe as aG,aQe as aH,WXe as aI,UXe as aJ,ZXe as aK,gQe as aL,pQe as aM,dQe as aN,mQe as aO,rQe as aP,HXe as aQ,$et as aR,iJe as aS,wet as aT,iQe as aU,cQe as aV,Net as aW,Let as aX,Fet as aY,NXe as aZ,zet as a_,CJe as aa,HQe as ab,SJe as ac,eJe as ad,xJe as ae,EJe as af,gJe as ag,mJe as ah,bJe as ai,fJe as aj,cJe as ak,dJe as al,qXe as am,kJe as an,obe as ao,abe as ap,MJe as aq,IJe as ar,RJe as as,DJe as at,RXe as au,VXe as av,GXe as aw,lQe as ax,jXe as ay,get as az,Use as b,qJe as b$,Wet as b0,Het as b1,KQe as b2,ett as b3,ZQe as b4,ttt as b5,qet as b6,Ket as b7,Get as b8,Zet as b9,zJe as bA,Met as bB,Tet as bC,net as bD,Pet as bE,dtt as bF,htt as bG,ptt as bH,dHe as bI,yHe as bJ,pet as bK,NJe as bL,BJe as bM,FJe as bN,rtt as bO,Ui as bP,mtt as bQ,vtt as bR,det as bS,Oet as bT,xet as bU,tet as bV,oet as bW,aet as bX,fet as bY,ket as bZ,QJe as b_,Xet as ba,Jet as bb,Qet as bc,ntt as bd,Yet as be,ott as bf,GQe as bg,ltt as bh,ctt as bi,stt as bj,utt as bk,I3 as bl,Sf as bm,WJe as bn,jet as bo,Bet as bp,s5 as bq,u5 as br,mje as bs,Js as bt,wf as bu,rp as bv,itt as bw,LJe as bx,UJe as by,het as bz,dn as c,qQe as c$,KJe as c0,YJe as c1,GJe as c2,zXe as c3,hQe as c4,nQe as c5,BXe as c6,fQe as c7,btt as c8,xtt as c9,Mce as cA,vet as cB,Cet as cC,yet as cD,cet as cE,Ret as cF,Ja as cG,br as cH,uet as cI,_tt as cJ,Stt as cK,sJe as cL,ef as cM,$Je as cN,Btt as cO,Utt as cP,_et as cQ,JJe as cR,ret as cS,met as cT,eet as cU,Eet as cV,set as cW,EXe as cX,OXe as cY,XQe as cZ,lJe as c_,bet as ca,tJe as cb,nJe as cc,Att as cd,ktt as ce,ZJe as cf,jJe as cg,$tt as ch,Itt as ci,Ftt as cj,jtt as ck,Ntt as cl,Ltt as cm,Mtt as cn,Rtt as co,Dtt as cp,rJe as cq,aJe as cr,Aet as cs,Ptt as ct,wtt as cu,Ctt as cv,Ett as cw,Ott as cx,Nce as cy,zce as cz,wm as d,JQe as d0,uJe as d1,iet as d2,DXe as d3,HJe as d4,iHe as d5,oJe as d6,XJe as d7,VJe as d8,EQe as e,eA as f,TQe as g,AQe as h,NQe as i,I as j,Gr as k,LQe as l,CQe as m,xQe as n,wQe as o,$Qe as p,IQe as q,v as r,jQe as s,FXe as t,Sj as u,BQe as v,TXe as w,zQe as x,WQe as y,_Qe as z}; +`,o.map=[t,e.line],!0}function PYe(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 s=i;i=e.skipChars(i,a);let u=i-s;if(u<3)return!1;const l=e.src.slice(s,i),c=e.src.slice(i,o);if(a===96&&c.indexOf(String.fromCharCode(a))>=0)return!1;if(r)return!0;let f=t,h=!1;for(;f++,!(f>=n||(i=s=e.bMarks[f]+e.tShift[f],o=e.eMarks[f],i=4)&&(i=e.skipChars(i,a),!(i-s=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;const s=[],u=[],l=[],c=[],f=e.md.block.ruler.getRules("blockquote"),h=e.parentType;e.parentType="blockquote";let p=!1,m;for(m=t;m=o)break;if(e.src.charCodeAt(i++)===62&&!S){let E=e.sCount[m]+1,C,P;e.src.charCodeAt(i)===32?(i++,E++,P=!1,C=!0):e.src.charCodeAt(i)===9?(C=!0,(e.bsCount[m]+E)%4===3?(i++,E++,P=!1):P=!0):C=!1;let M=E;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i=o,u.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+(C?1:0),l.push(e.sCount[m]),e.sCount[m]=M-E,c.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let O=!1;for(let E=0,C=f.length;E";const w=[t,0];b.map=w,e.md.block.tokenize(e,t,m);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 s=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[u]-e.listIndent>=4&&e.sCount[u]=e.blkIndent&&(c=!0);let f,h,p;if((p=UN(e,u))>=0){if(f=!0,a=e.bMarks[u]+e.tShift[u],h=Number(e.src.slice(a,p-1)),c&&h!==1)return!1}else if((p=BN(e,u))>=0)f=!1;else return!1;if(c&&e.skipSpaces(p)>=e.eMarks[u])return!1;if(r)return!0;const m=e.src.charCodeAt(p-1),y=e.tokens.length;f?(s=e.push("ordered_list_open","ol",1),h!==1&&(s.attrs=[["start",h]])):s=e.push("bullet_list_open","ul",1);const b=[u,0];s.map=b,s.markup=String.fromCharCode(m);let w=!1;const x=e.md.block.ruler.getRules("list"),S=e.parentType;for(e.parentType="list";u=i?P=1:P=E-O,P>4&&(P=1);const M=O+P;s=e.push("list_item_open","li",1),s.markup=String.fromCharCode(m);const N=[u,0];s.map=N,f&&(s.info=e.src.slice(a,p-1));const B=e.tight,V=e.tShift[u],W=e.sCount[u],ee=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=M,e.tight=!0,e.tShift[u]=C-e.bMarks[u],e.sCount[u]=E,C>=i&&e.isEmpty(u+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,u,n,!0),(!e.tight||w)&&(l=!1),w=e.line-u>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=ee,e.tShift[u]=V,e.sCount[u]=W,e.tight=B,s=e.push("list_item_close","li",-1),s.markup=String.fromCharCode(m),u=e.line,N[1]=u,u>=n||e.sCount[u]=4)break;let Z=!1;for(let q=0,G=x.length;q=4||e.src.charCodeAt(i)!==91)return!1;function s(x){const S=e.lineMax;if(x>=S||e.isEmpty(x))return null;let O=!1;if(e.sCount[x]-e.blkIndent>3&&(O=!0),e.sCount[x]<0&&(O=!0),!O){const P=e.md.block.ruler.getRules("reference"),M=e.parentType;e.parentType="reference";let N=!1;for(let B=0,V=P.length;B"u"&&(e.env.references={}),typeof e.env.references[w]>"u"&&(e.env.references[w]={title:b,href:f}),e.line=a),!0):!1}const $Ye=["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"],IYe="[a-zA-Z_:][a-zA-Z0-9:._-]*",NYe="[^\"'=<>`\\x00-\\x20]+",LYe="'[^']*'",FYe='"[^"]*"',jYe="(?:"+NYe+"|"+LYe+"|"+FYe+")",BYe="(?:\\s+"+IYe+"(?:\\s*=\\s*"+jYe+")?)",LZ="<[A-Za-z][A-Za-z0-9\\-]*"+BYe+"*\\s*\\/?>",FZ="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",UYe="",zYe="<[?][\\s\\S]*?[?]>",WYe="]*>",VYe="",HYe=new RegExp("^(?:"+LZ+"|"+FZ+"|"+UYe+"|"+zYe+"|"+WYe+"|"+VYe+")"),qYe=new RegExp("^(?:"+LZ+"|"+FZ+")"),ed=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(qYe.source+"\\s*$"),/^$/,!1]];function KYe(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),s=0;for(;s=4)return!1;let a=e.src.charCodeAt(i);if(a!==35||i>=o)return!1;let s=1;for(a=e.src.charCodeAt(++i);a===35&&i6||ii&&qn(e.src.charCodeAt(u-1))&&(o=u),e.line=t+1;const l=e.push("heading_open","h"+String(s),1);l.markup="########".slice(0,s),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 f=e.push("heading_close","h"+String(s),-1);return f.markup="########".slice(0,s),!0}function YYe(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,s=t+1;for(;s3)continue;if(e.sCount[s]>=e.blkIndent){let p=e.bMarks[s]+e.tShift[s];const m=e.eMarks[s];if(p=m))){o=a===61?1:2;break}}if(e.sCount[s]<0)continue;let h=!1;for(let p=0,m=r.length;p3||e.sCount[o]<0)continue;let l=!1;for(let c=0,f=r.length;c=n||e.sCount[a]=o){e.line=n;break}const u=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=!s,e.isEmpty(e.line-1)&&(s=!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};nv.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(JYe);if(!i)return!1;const o=i[1],a=e.md.linkify.matchAtStart(e.src.slice(n-o.length));if(!a)return!1;let s=a.url;if(s.length<=o.length)return!1;s=s.replace(/\*+$/,"");const u=e.md.normalizeLink(s);if(!e.md.validateLink(u))return!1;if(!t){e.pending=e.pending.slice(0,-o.length);const l=e.push("link_open","a",1);l.attrs=[["href",u]],l.markup="linkify",l.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(s);const f=e.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return e.pos+=s.length-o.length,!0}function tZe(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){Q5[e.charCodeAt(0)]=1});function nZe(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&&s<=57343&&(o+=e.src[n+1],n++)}const a="\\"+o;if(!t){const s=e.push("text_special","",0);i<256&&Q5[i]!==0?s.content=o:s.content=a,s.markup=a,s.info="escape"}return e.pos=n+1,!0}function rZe(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,s=String.fromCharCode(i.marker),u=e.tokens[i.token];u.type=a?"strong_open":"em_open",u.tag=a?"strong":"em",u.nesting=1,u.markup=a?s+s:s,u.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?s+s:s,l.content="",a&&(e.tokens[t[r-1].token].content="",e.tokens[t[i.end+1].token].content="",r--)}}function sZe(e){const t=e.tokens_meta,n=e.tokens_meta.length;WN(e,e.delimiters);for(let r=0;r=f)return!1;if(u=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(a=e.md.normalizeLink(i.str),e.md.validateLink(a)?m=i.pos:a="",u=m;m=f||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(typeof e.env.references>"u")return!1;if(m=0?r=e.src.slice(u,m++):m=p+1):m=p+1,r||(r=e.src.slice(h,p)),o=e.env.references[B2(r)],!o)return e.pos=c,!1;a=o.href,s=o.title}if(!t){e.pos=h,e.posMax=p;const y=e.push("link_open","a",1),b=[["href",a]];y.attrs=b,s&&b.push(["title",s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=m,e.posMax=f,!0}function lZe(e,t){let n,r,i,o,a,s,u,l,c="";const f=e.pos,h=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(o=m+1,o=h)return!1;for(l=o,s=e.md.helpers.parseLinkDestination(e.src,o,e.posMax),s.ok&&(c=e.md.normalizeLink(s.str),e.md.validateLink(c)?o=s.pos:c=""),l=o;o=h||e.src.charCodeAt(o)!==41)return e.pos=f,!1;o++}else{if(typeof e.env.references>"u")return!1;if(o=0?i=e.src.slice(l,o++):o=m+1):o=m+1,i||(i=e.src.slice(p,m)),a=e.env.references[B2(i)],!a)return e.pos=f,!1;c=a.href,u=a.title}if(!t){r=e.src.slice(p,m);const y=[];e.md.inline.parse(r,e.md,e.env,y);const b=e.push("image","img",0),w=[["src",c],["alt",""]];b.attrs=w,b.children=y,b.content=r,u&&w.push(["title",u])}return e.pos=o,e.posMax=h,!0}const cZe=/^([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])?)*)$/,fZe=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function dZe(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(fZe.test(o)){const a=e.md.normalizeLink(o);if(!e.md.validateLink(a))return!1;if(!t){const s=e.push("link_open","a",1);s.attrs=[["href",a]],s.markup="autolink",s.info="auto";const u=e.push("text","",0);u.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(cZe.test(o)){const a=e.md.normalizeLink("mailto:"+o);if(!e.md.validateLink(a))return!1;if(!t){const s=e.push("link_open","a",1);s.attrs=[["href",a]],s.markup="autolink",s.info="auto";const u=e.push("text","",0);u.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 hZe(e){return/^\s]/i.test(e)}function pZe(e){return/^<\/a\s*>/i.test(e)}function gZe(e){const t=e|32;return t>=97&&t<=122}function mZe(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&&!gZe(i))return!1;const o=e.src.slice(r).match(HYe);if(!o)return!1;if(!t){const a=e.push("html_inline","",0);a.content=o[0],hZe(a.content)&&e.linkLevel++,pZe(a.content)&&e.linkLevel--}return e.pos+=o[0].length,!0}const vZe=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,yZe=/^&([a-z][a-z0-9]{1,31});/i;function bZe(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(vZe);if(o){if(!t){const a=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),s=e.push("text_special","",0);s.content=Z5(a)?jx(a):jx(65533),s.markup=o[0],s.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(yZe);if(o){const a=RZ(o[0]);if(a!==o[0]){if(!t){const s=e.push("text_special","",0);s.content=a,s.markup=o[0],s.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function VN(e){const t={},n=e.length;if(!n)return;let r=0,i=-2;const o=[];for(let a=0;au;l-=o[l]+1){const f=e[l];if(f.marker===s.marker&&f.open&&f.end<0){let h=!1;if((f.close||s.open)&&(f.length+s.length)%3===0&&(f.length%3!==0||s.length%3!==0)&&(h=!0),!h){const p=l>0&&!e[l-1].open?o[l-1]+1:0;o[a]=a-l+p,o[l]=p,s.open=!1,f.end=a,f.close=!1,c=-1,i=-2;break}}}c!==-1&&(t[s.marker][(s.open?3:0)+(s.length||0)%3]=c)}}function xZe(e){const t=e.tokens_meta,n=e.tokens_meta.length;VN(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};rv.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()};rv.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 s=0;s|$))",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 K4(e){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){e[r]=n[r]})}),e}function z2(e){return Object.prototype.toString.call(e)}function SZe(e){return z2(e)==="[object String]"}function CZe(e){return z2(e)==="[object Object]"}function EZe(e){return z2(e)==="[object RegExp]"}function HN(e){return z2(e)==="[object Function]"}function OZe(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const UZ={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function AZe(e){return Object.keys(e||{}).reduce(function(t,n){return t||UZ.hasOwnProperty(n)},!1)}const PZe={"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}}},kZe="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]",TZe="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function MZe(e){e.__index__=-1,e.__text_cache__=""}function RZe(e){return function(t,n){const r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function qN(){return function(e,t){t.normalize(e)}}function Bx(e){const t=e.re=_Ze(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(kZe),n.push(t.src_xn),t.src_tlds=n.join("|");function r(s){return s.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(s,u){throw new Error('(LinkifyIt) Invalid schema "'+s+'": '+u)}Object.keys(e.__schemas__).forEach(function(s){const u=e.__schemas__[s];if(u===null)return;const l={validate:null,link:null};if(e.__compiled__[s]=l,CZe(u)){EZe(u.validate)?l.validate=RZe(u.validate):HN(u.validate)?l.validate=u.validate:o(s,u),HN(u.normalize)?l.normalize=u.normalize:u.normalize?o(s,u):l.normalize=qN();return}if(SZe(u)){i.push(s);return}o(s,u)}),i.forEach(function(s){e.__compiled__[e.__schemas__[s]]&&(e.__compiled__[s].validate=e.__compiled__[e.__schemas__[s]].validate,e.__compiled__[s].normalize=e.__compiled__[e.__schemas__[s]].normalize)}),e.__compiled__[""]={validate:null,normalize:qN()};const a=Object.keys(e.__compiled__).filter(function(s){return s.length>0&&e.__compiled__[s]}).map(OZe).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"),MZe(e)}function DZe(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 G4(e,t){const n=new DZe(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function Vo(e,t){if(!(this instanceof Vo))return new Vo(e,t);t||AZe(e)&&(t=e,e={}),this.__opts__=K4({},UZ,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=K4({},PZe,e),this.__compiled__={},this.__tlds__=TZe,this.__tlds_replaced__=!1,this.re={},Bx(this)}Vo.prototype.add=function(t,n){return this.__schemas__[t]=n,Bx(this),this};Vo.prototype.set=function(t){return this.__opts__=K4(this.__opts__,t),this};Vo.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let n,r,i,o,a,s,u,l,c;if(this.re.schema_test.test(t)){for(u=this.re.schema_search,u.lastIndex=0;(n=u.exec(t))!==null;)if(o=this.testSchemaAt(t,n[2],u.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,s=i.index+i[0].length,(this.__index__<0||athis.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=s))),this.__index__>=0};Vo.prototype.pretest=function(t){return this.re.pretest.test(t)};Vo.prototype.testSchemaAt=function(t,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(t,r,this):0};Vo.prototype.match=function(t){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===t&&(n.push(G4(this,r)),r=this.__last_index__);let i=r?t.slice(r):t;for(;this.test(i);)n.push(G4(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};Vo.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,G4(this,0)):null};Vo.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(),Bx(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,Bx(this),this)};Vo.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};Vo.prototype.onCompile=function(){};const Bd=2147483647,xs=36,J5=1,pm=26,$Ze=38,IZe=700,zZ=72,WZ=128,VZ="-",NZe=/^xn--/,LZe=/[^\0-\x7F]/,FZe=/[\x2E\u3002\uFF0E\uFF61]/g,jZe={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},oC=xs-J5,ws=Math.floor,aC=String.fromCharCode;function Ju(e){throw new RangeError(jZe[e])}function BZe(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function HZ(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(FZe,".");const i=e.split("."),o=BZe(i,t).join(".");return r+o}function qZ(e){const t=[];let n=0;const r=e.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...e),zZe=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:xs},KN=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},KZ=function(e,t,n){let r=0;for(e=n?ws(e/IZe):e>>1,e+=ws(e/t);e>oC*pm>>1;r+=xs)e=ws(e/oC);return ws(r+(oC+1)*e/(e+$Ze))},GZ=function(e){const t=[],n=e.length;let r=0,i=WZ,o=zZ,a=e.lastIndexOf(VZ);a<0&&(a=0);for(let s=0;s=128&&Ju("not-basic"),t.push(e.charCodeAt(s));for(let s=a>0?a+1:0;s=n&&Ju("invalid-input");const h=zZe(e.charCodeAt(s++));h>=xs&&Ju("invalid-input"),h>ws((Bd-r)/c)&&Ju("overflow"),r+=h*c;const p=f<=o?J5:f>=o+pm?pm:f-o;if(hws(Bd/m)&&Ju("overflow"),c*=m}const l=t.length+1;o=KZ(r-u,l,u==0),ws(r/l)>Bd-i&&Ju("overflow"),i+=ws(r/l),r%=l,t.splice(r++,0,i)}return String.fromCodePoint(...t)},YZ=function(e){const t=[];e=qZ(e);const n=e.length;let r=WZ,i=0,o=zZ;for(const u of e)u<128&&t.push(aC(u));const a=t.length;let s=a;for(a&&t.push(VZ);s=r&&cws((Bd-i)/l)&&Ju("overflow"),i+=(u-r)*l,r=u;for(const c of e)if(cBd&&Ju("overflow"),c===r){let f=i;for(let h=xs;;h+=xs){const p=h<=o?J5:h>=o+pm?pm:h-o;if(f=0))try{t.hostname=ZZ.toASCII(t.hostname)}catch{}return tv(q5(t))}function JZe(e){const t=K5(e,!0);if(t.hostname&&(!t.protocol||XZ.indexOf(t.protocol)>=0))try{t.hostname=ZZ.toUnicode(t.hostname)}catch{}return Ph(q5(t),Ph.defaultChars+"%")}function Ja(e,t){if(!(this instanceof Ja))return new Ja(e,t);t||Y5(e)||(t=e||{},e="default"),this.inline=new rv,this.block=new U2,this.core=new X5,this.renderer=new ap,this.linkify=new Vo,this.validateLink=XZe,this.normalizeLink=QZe,this.normalizeLinkText=JZe,this.utils=tYe,this.helpers=j2({},oYe),this.options={},this.configure(e),t&&this.set(t)}Ja.prototype.set=function(e){return j2(this.options,e),this};Ja.prototype.configure=function(e){const t=this;if(Y5(e)){const n=e;if(e=GZe[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};Ja.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};Ja.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};Ja.prototype.use=function(e){const t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this};Ja.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};Ja.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)};Ja.prototype.parseInline=function(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens};Ja.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var QZ={exports:{}};(function(e){(function(t){var n=function(T){var D,$=new Float64Array(16);if(T)for(D=0;D>24&255,T[D+1]=$>>16&255,T[D+2]=$>>8&255,T[D+3]=$&255,T[D+4]=A>>24&255,T[D+5]=A>>16&255,T[D+6]=A>>8&255,T[D+7]=A&255}function y(T,D,$,A,L){var Q,te=0;for(Q=0;Q>>8)-1}function b(T,D,$,A){return y(T,D,$,A,16)}function w(T,D,$,A){return y(T,D,$,A,32)}function x(T,D,$,A){for(var L=A[0]&255|(A[1]&255)<<8|(A[2]&255)<<16|(A[3]&255)<<24,Q=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,te=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,fe=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,_e=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,je=A[4]&255|(A[5]&255)<<8|(A[6]&255)<<16|(A[7]&255)<<24,Ve=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,Ie=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,nt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=A[8]&255|(A[9]&255)<<8|(A[10]&255)<<16|(A[11]&255)<<24,Ot=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,pt=$[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=A[12]&255|(A[13]&255)<<8|(A[14]&255)<<16|(A[15]&255)<<24,Qe=L,ut=Q,Xe=te,Ne=fe,qe=_e,Ge=je,pe=Ve,he=ct,Re=Ie,Oe=nt,Pe=bt,Be=Ot,vt=pt,jt=ht,Bt=xt,It=wt,J,Zt=0;Zt<20;Zt+=2)J=Qe+vt|0,qe^=J<<7|J>>>25,J=qe+Qe|0,Re^=J<<9|J>>>23,J=Re+qe|0,vt^=J<<13|J>>>19,J=vt+Re|0,Qe^=J<<18|J>>>14,J=Ge+ut|0,Oe^=J<<7|J>>>25,J=Oe+Ge|0,jt^=J<<9|J>>>23,J=jt+Oe|0,ut^=J<<13|J>>>19,J=ut+jt|0,Ge^=J<<18|J>>>14,J=Pe+pe|0,Bt^=J<<7|J>>>25,J=Bt+Pe|0,Xe^=J<<9|J>>>23,J=Xe+Bt|0,pe^=J<<13|J>>>19,J=pe+Xe|0,Pe^=J<<18|J>>>14,J=It+Be|0,Ne^=J<<7|J>>>25,J=Ne+It|0,he^=J<<9|J>>>23,J=he+Ne|0,Be^=J<<13|J>>>19,J=Be+he|0,It^=J<<18|J>>>14,J=Qe+Ne|0,ut^=J<<7|J>>>25,J=ut+Qe|0,Xe^=J<<9|J>>>23,J=Xe+ut|0,Ne^=J<<13|J>>>19,J=Ne+Xe|0,Qe^=J<<18|J>>>14,J=Ge+qe|0,pe^=J<<7|J>>>25,J=pe+Ge|0,he^=J<<9|J>>>23,J=he+pe|0,qe^=J<<13|J>>>19,J=qe+he|0,Ge^=J<<18|J>>>14,J=Pe+Oe|0,Be^=J<<7|J>>>25,J=Be+Pe|0,Re^=J<<9|J>>>23,J=Re+Be|0,Oe^=J<<13|J>>>19,J=Oe+Re|0,Pe^=J<<18|J>>>14,J=It+Bt|0,vt^=J<<7|J>>>25,J=vt+It|0,jt^=J<<9|J>>>23,J=jt+vt|0,Bt^=J<<13|J>>>19,J=Bt+jt|0,It^=J<<18|J>>>14;Qe=Qe+L|0,ut=ut+Q|0,Xe=Xe+te|0,Ne=Ne+fe|0,qe=qe+_e|0,Ge=Ge+je|0,pe=pe+Ve|0,he=he+ct|0,Re=Re+Ie|0,Oe=Oe+nt|0,Pe=Pe+bt|0,Be=Be+Ot|0,vt=vt+pt|0,jt=jt+ht|0,Bt=Bt+xt|0,It=It+wt|0,T[0]=Qe>>>0&255,T[1]=Qe>>>8&255,T[2]=Qe>>>16&255,T[3]=Qe>>>24&255,T[4]=ut>>>0&255,T[5]=ut>>>8&255,T[6]=ut>>>16&255,T[7]=ut>>>24&255,T[8]=Xe>>>0&255,T[9]=Xe>>>8&255,T[10]=Xe>>>16&255,T[11]=Xe>>>24&255,T[12]=Ne>>>0&255,T[13]=Ne>>>8&255,T[14]=Ne>>>16&255,T[15]=Ne>>>24&255,T[16]=qe>>>0&255,T[17]=qe>>>8&255,T[18]=qe>>>16&255,T[19]=qe>>>24&255,T[20]=Ge>>>0&255,T[21]=Ge>>>8&255,T[22]=Ge>>>16&255,T[23]=Ge>>>24&255,T[24]=pe>>>0&255,T[25]=pe>>>8&255,T[26]=pe>>>16&255,T[27]=pe>>>24&255,T[28]=he>>>0&255,T[29]=he>>>8&255,T[30]=he>>>16&255,T[31]=he>>>24&255,T[32]=Re>>>0&255,T[33]=Re>>>8&255,T[34]=Re>>>16&255,T[35]=Re>>>24&255,T[36]=Oe>>>0&255,T[37]=Oe>>>8&255,T[38]=Oe>>>16&255,T[39]=Oe>>>24&255,T[40]=Pe>>>0&255,T[41]=Pe>>>8&255,T[42]=Pe>>>16&255,T[43]=Pe>>>24&255,T[44]=Be>>>0&255,T[45]=Be>>>8&255,T[46]=Be>>>16&255,T[47]=Be>>>24&255,T[48]=vt>>>0&255,T[49]=vt>>>8&255,T[50]=vt>>>16&255,T[51]=vt>>>24&255,T[52]=jt>>>0&255,T[53]=jt>>>8&255,T[54]=jt>>>16&255,T[55]=jt>>>24&255,T[56]=Bt>>>0&255,T[57]=Bt>>>8&255,T[58]=Bt>>>16&255,T[59]=Bt>>>24&255,T[60]=It>>>0&255,T[61]=It>>>8&255,T[62]=It>>>16&255,T[63]=It>>>24&255}function S(T,D,$,A){for(var L=A[0]&255|(A[1]&255)<<8|(A[2]&255)<<16|(A[3]&255)<<24,Q=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,te=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,fe=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,_e=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,je=A[4]&255|(A[5]&255)<<8|(A[6]&255)<<16|(A[7]&255)<<24,Ve=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,Ie=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,nt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=A[8]&255|(A[9]&255)<<8|(A[10]&255)<<16|(A[11]&255)<<24,Ot=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,pt=$[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=A[12]&255|(A[13]&255)<<8|(A[14]&255)<<16|(A[15]&255)<<24,Qe=L,ut=Q,Xe=te,Ne=fe,qe=_e,Ge=je,pe=Ve,he=ct,Re=Ie,Oe=nt,Pe=bt,Be=Ot,vt=pt,jt=ht,Bt=xt,It=wt,J,Zt=0;Zt<20;Zt+=2)J=Qe+vt|0,qe^=J<<7|J>>>25,J=qe+Qe|0,Re^=J<<9|J>>>23,J=Re+qe|0,vt^=J<<13|J>>>19,J=vt+Re|0,Qe^=J<<18|J>>>14,J=Ge+ut|0,Oe^=J<<7|J>>>25,J=Oe+Ge|0,jt^=J<<9|J>>>23,J=jt+Oe|0,ut^=J<<13|J>>>19,J=ut+jt|0,Ge^=J<<18|J>>>14,J=Pe+pe|0,Bt^=J<<7|J>>>25,J=Bt+Pe|0,Xe^=J<<9|J>>>23,J=Xe+Bt|0,pe^=J<<13|J>>>19,J=pe+Xe|0,Pe^=J<<18|J>>>14,J=It+Be|0,Ne^=J<<7|J>>>25,J=Ne+It|0,he^=J<<9|J>>>23,J=he+Ne|0,Be^=J<<13|J>>>19,J=Be+he|0,It^=J<<18|J>>>14,J=Qe+Ne|0,ut^=J<<7|J>>>25,J=ut+Qe|0,Xe^=J<<9|J>>>23,J=Xe+ut|0,Ne^=J<<13|J>>>19,J=Ne+Xe|0,Qe^=J<<18|J>>>14,J=Ge+qe|0,pe^=J<<7|J>>>25,J=pe+Ge|0,he^=J<<9|J>>>23,J=he+pe|0,qe^=J<<13|J>>>19,J=qe+he|0,Ge^=J<<18|J>>>14,J=Pe+Oe|0,Be^=J<<7|J>>>25,J=Be+Pe|0,Re^=J<<9|J>>>23,J=Re+Be|0,Oe^=J<<13|J>>>19,J=Oe+Re|0,Pe^=J<<18|J>>>14,J=It+Bt|0,vt^=J<<7|J>>>25,J=vt+It|0,jt^=J<<9|J>>>23,J=jt+vt|0,Bt^=J<<13|J>>>19,J=Bt+jt|0,It^=J<<18|J>>>14;T[0]=Qe>>>0&255,T[1]=Qe>>>8&255,T[2]=Qe>>>16&255,T[3]=Qe>>>24&255,T[4]=Ge>>>0&255,T[5]=Ge>>>8&255,T[6]=Ge>>>16&255,T[7]=Ge>>>24&255,T[8]=Pe>>>0&255,T[9]=Pe>>>8&255,T[10]=Pe>>>16&255,T[11]=Pe>>>24&255,T[12]=It>>>0&255,T[13]=It>>>8&255,T[14]=It>>>16&255,T[15]=It>>>24&255,T[16]=pe>>>0&255,T[17]=pe>>>8&255,T[18]=pe>>>16&255,T[19]=pe>>>24&255,T[20]=he>>>0&255,T[21]=he>>>8&255,T[22]=he>>>16&255,T[23]=he>>>24&255,T[24]=Re>>>0&255,T[25]=Re>>>8&255,T[26]=Re>>>16&255,T[27]=Re>>>24&255,T[28]=Oe>>>0&255,T[29]=Oe>>>8&255,T[30]=Oe>>>16&255,T[31]=Oe>>>24&255}function O(T,D,$,A){x(T,D,$,A)}function E(T,D,$,A){S(T,D,$,A)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function P(T,D,$,A,L,Q,te){var fe=new Uint8Array(16),_e=new Uint8Array(64),je,Ve;for(Ve=0;Ve<16;Ve++)fe[Ve]=0;for(Ve=0;Ve<8;Ve++)fe[Ve]=Q[Ve];for(;L>=64;){for(O(_e,fe,te,C),Ve=0;Ve<64;Ve++)T[D+Ve]=$[A+Ve]^_e[Ve];for(je=1,Ve=8;Ve<16;Ve++)je=je+(fe[Ve]&255)|0,fe[Ve]=je&255,je>>>=8;L-=64,D+=64,A+=64}if(L>0)for(O(_e,fe,te,C),Ve=0;Ve=64;){for(O(te,Q,L,C),_e=0;_e<64;_e++)T[D+_e]=te[_e];for(fe=1,_e=8;_e<16;_e++)fe=fe+(Q[_e]&255)|0,Q[_e]=fe&255,fe>>>=8;$-=64,D+=64}if($>0)for(O(te,Q,L,C),_e=0;_e<$;_e++)T[D+_e]=te[_e];return 0}function N(T,D,$,A,L){var Q=new Uint8Array(32);E(Q,A,L,C);for(var te=new Uint8Array(8),fe=0;fe<8;fe++)te[fe]=A[fe+16];return M(T,D,$,te,Q)}function B(T,D,$,A,L,Q,te){var fe=new Uint8Array(32);E(fe,Q,te,C);for(var _e=new Uint8Array(8),je=0;je<8;je++)_e[je]=Q[je+16];return P(T,D,$,A,L,_e,fe)}var V=function(T){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,$,A,L,Q,te,fe,_e;D=T[0]&255|(T[1]&255)<<8,this.r[0]=D&8191,$=T[2]&255|(T[3]&255)<<8,this.r[1]=(D>>>13|$<<3)&8191,A=T[4]&255|(T[5]&255)<<8,this.r[2]=($>>>10|A<<6)&7939,L=T[6]&255|(T[7]&255)<<8,this.r[3]=(A>>>7|L<<9)&8191,Q=T[8]&255|(T[9]&255)<<8,this.r[4]=(L>>>4|Q<<12)&255,this.r[5]=Q>>>1&8190,te=T[10]&255|(T[11]&255)<<8,this.r[6]=(Q>>>14|te<<2)&8191,fe=T[12]&255|(T[13]&255)<<8,this.r[7]=(te>>>11|fe<<5)&8065,_e=T[14]&255|(T[15]&255)<<8,this.r[8]=(fe>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=T[16]&255|(T[17]&255)<<8,this.pad[1]=T[18]&255|(T[19]&255)<<8,this.pad[2]=T[20]&255|(T[21]&255)<<8,this.pad[3]=T[22]&255|(T[23]&255)<<8,this.pad[4]=T[24]&255|(T[25]&255)<<8,this.pad[5]=T[26]&255|(T[27]&255)<<8,this.pad[6]=T[28]&255|(T[29]&255)<<8,this.pad[7]=T[30]&255|(T[31]&255)<<8};V.prototype.blocks=function(T,D,$){for(var A=this.fin?0:2048,L,Q,te,fe,_e,je,Ve,ct,Ie,nt,bt,Ot,pt,ht,xt,wt,Qe,ut,Xe,Ne=this.h[0],qe=this.h[1],Ge=this.h[2],pe=this.h[3],he=this.h[4],Re=this.h[5],Oe=this.h[6],Pe=this.h[7],Be=this.h[8],vt=this.h[9],jt=this.r[0],Bt=this.r[1],It=this.r[2],J=this.r[3],Zt=this.r[4],sn=this.r[5],un=this.r[6],Ut=this.r[7],ln=this.r[8],rn=this.r[9];$>=16;)L=T[D+0]&255|(T[D+1]&255)<<8,Ne+=L&8191,Q=T[D+2]&255|(T[D+3]&255)<<8,qe+=(L>>>13|Q<<3)&8191,te=T[D+4]&255|(T[D+5]&255)<<8,Ge+=(Q>>>10|te<<6)&8191,fe=T[D+6]&255|(T[D+7]&255)<<8,pe+=(te>>>7|fe<<9)&8191,_e=T[D+8]&255|(T[D+9]&255)<<8,he+=(fe>>>4|_e<<12)&8191,Re+=_e>>>1&8191,je=T[D+10]&255|(T[D+11]&255)<<8,Oe+=(_e>>>14|je<<2)&8191,Ve=T[D+12]&255|(T[D+13]&255)<<8,Pe+=(je>>>11|Ve<<5)&8191,ct=T[D+14]&255|(T[D+15]&255)<<8,Be+=(Ve>>>8|ct<<8)&8191,vt+=ct>>>5|A,Ie=0,nt=Ie,nt+=Ne*jt,nt+=qe*(5*rn),nt+=Ge*(5*ln),nt+=pe*(5*Ut),nt+=he*(5*un),Ie=nt>>>13,nt&=8191,nt+=Re*(5*sn),nt+=Oe*(5*Zt),nt+=Pe*(5*J),nt+=Be*(5*It),nt+=vt*(5*Bt),Ie+=nt>>>13,nt&=8191,bt=Ie,bt+=Ne*Bt,bt+=qe*jt,bt+=Ge*(5*rn),bt+=pe*(5*ln),bt+=he*(5*Ut),Ie=bt>>>13,bt&=8191,bt+=Re*(5*un),bt+=Oe*(5*sn),bt+=Pe*(5*Zt),bt+=Be*(5*J),bt+=vt*(5*It),Ie+=bt>>>13,bt&=8191,Ot=Ie,Ot+=Ne*It,Ot+=qe*Bt,Ot+=Ge*jt,Ot+=pe*(5*rn),Ot+=he*(5*ln),Ie=Ot>>>13,Ot&=8191,Ot+=Re*(5*Ut),Ot+=Oe*(5*un),Ot+=Pe*(5*sn),Ot+=Be*(5*Zt),Ot+=vt*(5*J),Ie+=Ot>>>13,Ot&=8191,pt=Ie,pt+=Ne*J,pt+=qe*It,pt+=Ge*Bt,pt+=pe*jt,pt+=he*(5*rn),Ie=pt>>>13,pt&=8191,pt+=Re*(5*ln),pt+=Oe*(5*Ut),pt+=Pe*(5*un),pt+=Be*(5*sn),pt+=vt*(5*Zt),Ie+=pt>>>13,pt&=8191,ht=Ie,ht+=Ne*Zt,ht+=qe*J,ht+=Ge*It,ht+=pe*Bt,ht+=he*jt,Ie=ht>>>13,ht&=8191,ht+=Re*(5*rn),ht+=Oe*(5*ln),ht+=Pe*(5*Ut),ht+=Be*(5*un),ht+=vt*(5*sn),Ie+=ht>>>13,ht&=8191,xt=Ie,xt+=Ne*sn,xt+=qe*Zt,xt+=Ge*J,xt+=pe*It,xt+=he*Bt,Ie=xt>>>13,xt&=8191,xt+=Re*jt,xt+=Oe*(5*rn),xt+=Pe*(5*ln),xt+=Be*(5*Ut),xt+=vt*(5*un),Ie+=xt>>>13,xt&=8191,wt=Ie,wt+=Ne*un,wt+=qe*sn,wt+=Ge*Zt,wt+=pe*J,wt+=he*It,Ie=wt>>>13,wt&=8191,wt+=Re*Bt,wt+=Oe*jt,wt+=Pe*(5*rn),wt+=Be*(5*ln),wt+=vt*(5*Ut),Ie+=wt>>>13,wt&=8191,Qe=Ie,Qe+=Ne*Ut,Qe+=qe*un,Qe+=Ge*sn,Qe+=pe*Zt,Qe+=he*J,Ie=Qe>>>13,Qe&=8191,Qe+=Re*It,Qe+=Oe*Bt,Qe+=Pe*jt,Qe+=Be*(5*rn),Qe+=vt*(5*ln),Ie+=Qe>>>13,Qe&=8191,ut=Ie,ut+=Ne*ln,ut+=qe*Ut,ut+=Ge*un,ut+=pe*sn,ut+=he*Zt,Ie=ut>>>13,ut&=8191,ut+=Re*J,ut+=Oe*It,ut+=Pe*Bt,ut+=Be*jt,ut+=vt*(5*rn),Ie+=ut>>>13,ut&=8191,Xe=Ie,Xe+=Ne*rn,Xe+=qe*ln,Xe+=Ge*Ut,Xe+=pe*un,Xe+=he*sn,Ie=Xe>>>13,Xe&=8191,Xe+=Re*Zt,Xe+=Oe*J,Xe+=Pe*It,Xe+=Be*Bt,Xe+=vt*jt,Ie+=Xe>>>13,Xe&=8191,Ie=(Ie<<2)+Ie|0,Ie=Ie+nt|0,nt=Ie&8191,Ie=Ie>>>13,bt+=Ie,Ne=nt,qe=bt,Ge=Ot,pe=pt,he=ht,Re=xt,Oe=wt,Pe=Qe,Be=ut,vt=Xe,D+=16,$-=16;this.h[0]=Ne,this.h[1]=qe,this.h[2]=Ge,this.h[3]=pe,this.h[4]=he,this.h[5]=Re,this.h[6]=Oe,this.h[7]=Pe,this.h[8]=Be,this.h[9]=vt},V.prototype.finish=function(T,D){var $=new Uint16Array(10),A,L,Q,te;if(this.leftover){for(te=this.leftover,this.buffer[te++]=1;te<16;te++)this.buffer[te]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(A=this.h[1]>>>13,this.h[1]&=8191,te=2;te<10;te++)this.h[te]+=A,A=this.h[te]>>>13,this.h[te]&=8191;for(this.h[0]+=A*5,A=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=A,A=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=A,$[0]=this.h[0]+5,A=$[0]>>>13,$[0]&=8191,te=1;te<10;te++)$[te]=this.h[te]+A,A=$[te]>>>13,$[te]&=8191;for($[9]-=8192,L=(A^1)-1,te=0;te<10;te++)$[te]&=L;for(L=~L,te=0;te<10;te++)this.h[te]=this.h[te]&L|$[te];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,Q=this.h[0]+this.pad[0],this.h[0]=Q&65535,te=1;te<8;te++)Q=(this.h[te]+this.pad[te]|0)+(Q>>>16)|0,this.h[te]=Q&65535;T[D+0]=this.h[0]>>>0&255,T[D+1]=this.h[0]>>>8&255,T[D+2]=this.h[1]>>>0&255,T[D+3]=this.h[1]>>>8&255,T[D+4]=this.h[2]>>>0&255,T[D+5]=this.h[2]>>>8&255,T[D+6]=this.h[3]>>>0&255,T[D+7]=this.h[3]>>>8&255,T[D+8]=this.h[4]>>>0&255,T[D+9]=this.h[4]>>>8&255,T[D+10]=this.h[5]>>>0&255,T[D+11]=this.h[5]>>>8&255,T[D+12]=this.h[6]>>>0&255,T[D+13]=this.h[6]>>>8&255,T[D+14]=this.h[7]>>>0&255,T[D+15]=this.h[7]>>>8&255},V.prototype.update=function(T,D,$){var A,L;if(this.leftover){for(L=16-this.leftover,L>$&&(L=$),A=0;A=16&&(L=$-$%16,this.blocks(T,D,L),D+=L,$-=L),$){for(A=0;A<$;A++)this.buffer[this.leftover+A]=T[D+A];this.leftover+=$}};function W(T,D,$,A,L,Q){var te=new V(Q);return te.update($,A,L),te.finish(T,D),0}function ee(T,D,$,A,L,Q){var te=new Uint8Array(16);return W(te,0,$,A,L,Q),b(T,D,te,0)}function Z(T,D,$,A,L){var Q;if($<32)return-1;for(B(T,0,D,0,$,A,L),W(T,16,T,32,$-32,T),Q=0;Q<16;Q++)T[Q]=0;return 0}function q(T,D,$,A,L){var Q,te=new Uint8Array(32);if($<32||(N(te,0,32,A,L),ee(D,16,D,32,$-32,te)!==0))return-1;for(B(T,0,D,0,$,A,L),Q=0;Q<32;Q++)T[Q]=0;return 0}function G(T,D){var $;for($=0;$<16;$++)T[$]=D[$]|0}function H(T){var D,$,A=1;for(D=0;D<16;D++)$=T[D]+A+65535,A=Math.floor($/65536),T[D]=$-A*65536;T[0]+=A-1+37*(A-1)}function j(T,D,$){for(var A,L=~($-1),Q=0;Q<16;Q++)A=L&(T[Q]^D[Q]),T[Q]^=A,D[Q]^=A}function K(T,D){var $,A,L,Q=n(),te=n();for($=0;$<16;$++)te[$]=D[$];for(H(te),H(te),H(te),A=0;A<2;A++){for(Q[0]=te[0]-65517,$=1;$<15;$++)Q[$]=te[$]-65535-(Q[$-1]>>16&1),Q[$-1]&=65535;Q[15]=te[15]-32767-(Q[14]>>16&1),L=Q[15]>>16&1,Q[14]&=65535,j(te,Q,1-L)}for($=0;$<16;$++)T[2*$]=te[$]&255,T[2*$+1]=te[$]>>8}function Y(T,D){var $=new Uint8Array(32),A=new Uint8Array(32);return K($,T),K(A,D),w($,0,A,0)}function re(T){var D=new Uint8Array(32);return K(D,T),D[0]&1}function ie(T,D){var $;for($=0;$<16;$++)T[$]=D[2*$]+(D[2*$+1]<<8);T[15]&=32767}function se(T,D,$){for(var A=0;A<16;A++)T[A]=D[A]+$[A]}function ye(T,D,$){for(var A=0;A<16;A++)T[A]=D[A]-$[A]}function we(T,D,$){var A,L,Q=0,te=0,fe=0,_e=0,je=0,Ve=0,ct=0,Ie=0,nt=0,bt=0,Ot=0,pt=0,ht=0,xt=0,wt=0,Qe=0,ut=0,Xe=0,Ne=0,qe=0,Ge=0,pe=0,he=0,Re=0,Oe=0,Pe=0,Be=0,vt=0,jt=0,Bt=0,It=0,J=$[0],Zt=$[1],sn=$[2],un=$[3],Ut=$[4],ln=$[5],rn=$[6],Yn=$[7],mn=$[8],kn=$[9],Zn=$[10],Xn=$[11],wr=$[12],Ir=$[13],Nr=$[14],Lr=$[15];A=D[0],Q+=A*J,te+=A*Zt,fe+=A*sn,_e+=A*un,je+=A*Ut,Ve+=A*ln,ct+=A*rn,Ie+=A*Yn,nt+=A*mn,bt+=A*kn,Ot+=A*Zn,pt+=A*Xn,ht+=A*wr,xt+=A*Ir,wt+=A*Nr,Qe+=A*Lr,A=D[1],te+=A*J,fe+=A*Zt,_e+=A*sn,je+=A*un,Ve+=A*Ut,ct+=A*ln,Ie+=A*rn,nt+=A*Yn,bt+=A*mn,Ot+=A*kn,pt+=A*Zn,ht+=A*Xn,xt+=A*wr,wt+=A*Ir,Qe+=A*Nr,ut+=A*Lr,A=D[2],fe+=A*J,_e+=A*Zt,je+=A*sn,Ve+=A*un,ct+=A*Ut,Ie+=A*ln,nt+=A*rn,bt+=A*Yn,Ot+=A*mn,pt+=A*kn,ht+=A*Zn,xt+=A*Xn,wt+=A*wr,Qe+=A*Ir,ut+=A*Nr,Xe+=A*Lr,A=D[3],_e+=A*J,je+=A*Zt,Ve+=A*sn,ct+=A*un,Ie+=A*Ut,nt+=A*ln,bt+=A*rn,Ot+=A*Yn,pt+=A*mn,ht+=A*kn,xt+=A*Zn,wt+=A*Xn,Qe+=A*wr,ut+=A*Ir,Xe+=A*Nr,Ne+=A*Lr,A=D[4],je+=A*J,Ve+=A*Zt,ct+=A*sn,Ie+=A*un,nt+=A*Ut,bt+=A*ln,Ot+=A*rn,pt+=A*Yn,ht+=A*mn,xt+=A*kn,wt+=A*Zn,Qe+=A*Xn,ut+=A*wr,Xe+=A*Ir,Ne+=A*Nr,qe+=A*Lr,A=D[5],Ve+=A*J,ct+=A*Zt,Ie+=A*sn,nt+=A*un,bt+=A*Ut,Ot+=A*ln,pt+=A*rn,ht+=A*Yn,xt+=A*mn,wt+=A*kn,Qe+=A*Zn,ut+=A*Xn,Xe+=A*wr,Ne+=A*Ir,qe+=A*Nr,Ge+=A*Lr,A=D[6],ct+=A*J,Ie+=A*Zt,nt+=A*sn,bt+=A*un,Ot+=A*Ut,pt+=A*ln,ht+=A*rn,xt+=A*Yn,wt+=A*mn,Qe+=A*kn,ut+=A*Zn,Xe+=A*Xn,Ne+=A*wr,qe+=A*Ir,Ge+=A*Nr,pe+=A*Lr,A=D[7],Ie+=A*J,nt+=A*Zt,bt+=A*sn,Ot+=A*un,pt+=A*Ut,ht+=A*ln,xt+=A*rn,wt+=A*Yn,Qe+=A*mn,ut+=A*kn,Xe+=A*Zn,Ne+=A*Xn,qe+=A*wr,Ge+=A*Ir,pe+=A*Nr,he+=A*Lr,A=D[8],nt+=A*J,bt+=A*Zt,Ot+=A*sn,pt+=A*un,ht+=A*Ut,xt+=A*ln,wt+=A*rn,Qe+=A*Yn,ut+=A*mn,Xe+=A*kn,Ne+=A*Zn,qe+=A*Xn,Ge+=A*wr,pe+=A*Ir,he+=A*Nr,Re+=A*Lr,A=D[9],bt+=A*J,Ot+=A*Zt,pt+=A*sn,ht+=A*un,xt+=A*Ut,wt+=A*ln,Qe+=A*rn,ut+=A*Yn,Xe+=A*mn,Ne+=A*kn,qe+=A*Zn,Ge+=A*Xn,pe+=A*wr,he+=A*Ir,Re+=A*Nr,Oe+=A*Lr,A=D[10],Ot+=A*J,pt+=A*Zt,ht+=A*sn,xt+=A*un,wt+=A*Ut,Qe+=A*ln,ut+=A*rn,Xe+=A*Yn,Ne+=A*mn,qe+=A*kn,Ge+=A*Zn,pe+=A*Xn,he+=A*wr,Re+=A*Ir,Oe+=A*Nr,Pe+=A*Lr,A=D[11],pt+=A*J,ht+=A*Zt,xt+=A*sn,wt+=A*un,Qe+=A*Ut,ut+=A*ln,Xe+=A*rn,Ne+=A*Yn,qe+=A*mn,Ge+=A*kn,pe+=A*Zn,he+=A*Xn,Re+=A*wr,Oe+=A*Ir,Pe+=A*Nr,Be+=A*Lr,A=D[12],ht+=A*J,xt+=A*Zt,wt+=A*sn,Qe+=A*un,ut+=A*Ut,Xe+=A*ln,Ne+=A*rn,qe+=A*Yn,Ge+=A*mn,pe+=A*kn,he+=A*Zn,Re+=A*Xn,Oe+=A*wr,Pe+=A*Ir,Be+=A*Nr,vt+=A*Lr,A=D[13],xt+=A*J,wt+=A*Zt,Qe+=A*sn,ut+=A*un,Xe+=A*Ut,Ne+=A*ln,qe+=A*rn,Ge+=A*Yn,pe+=A*mn,he+=A*kn,Re+=A*Zn,Oe+=A*Xn,Pe+=A*wr,Be+=A*Ir,vt+=A*Nr,jt+=A*Lr,A=D[14],wt+=A*J,Qe+=A*Zt,ut+=A*sn,Xe+=A*un,Ne+=A*Ut,qe+=A*ln,Ge+=A*rn,pe+=A*Yn,he+=A*mn,Re+=A*kn,Oe+=A*Zn,Pe+=A*Xn,Be+=A*wr,vt+=A*Ir,jt+=A*Nr,Bt+=A*Lr,A=D[15],Qe+=A*J,ut+=A*Zt,Xe+=A*sn,Ne+=A*un,qe+=A*Ut,Ge+=A*ln,pe+=A*rn,he+=A*Yn,Re+=A*mn,Oe+=A*kn,Pe+=A*Zn,Be+=A*Xn,vt+=A*wr,jt+=A*Ir,Bt+=A*Nr,It+=A*Lr,Q+=38*ut,te+=38*Xe,fe+=38*Ne,_e+=38*qe,je+=38*Ge,Ve+=38*pe,ct+=38*he,Ie+=38*Re,nt+=38*Oe,bt+=38*Pe,Ot+=38*Be,pt+=38*vt,ht+=38*jt,xt+=38*Bt,wt+=38*It,L=1,A=Q+L+65535,L=Math.floor(A/65536),Q=A-L*65536,A=te+L+65535,L=Math.floor(A/65536),te=A-L*65536,A=fe+L+65535,L=Math.floor(A/65536),fe=A-L*65536,A=_e+L+65535,L=Math.floor(A/65536),_e=A-L*65536,A=je+L+65535,L=Math.floor(A/65536),je=A-L*65536,A=Ve+L+65535,L=Math.floor(A/65536),Ve=A-L*65536,A=ct+L+65535,L=Math.floor(A/65536),ct=A-L*65536,A=Ie+L+65535,L=Math.floor(A/65536),Ie=A-L*65536,A=nt+L+65535,L=Math.floor(A/65536),nt=A-L*65536,A=bt+L+65535,L=Math.floor(A/65536),bt=A-L*65536,A=Ot+L+65535,L=Math.floor(A/65536),Ot=A-L*65536,A=pt+L+65535,L=Math.floor(A/65536),pt=A-L*65536,A=ht+L+65535,L=Math.floor(A/65536),ht=A-L*65536,A=xt+L+65535,L=Math.floor(A/65536),xt=A-L*65536,A=wt+L+65535,L=Math.floor(A/65536),wt=A-L*65536,A=Qe+L+65535,L=Math.floor(A/65536),Qe=A-L*65536,Q+=L-1+37*(L-1),L=1,A=Q+L+65535,L=Math.floor(A/65536),Q=A-L*65536,A=te+L+65535,L=Math.floor(A/65536),te=A-L*65536,A=fe+L+65535,L=Math.floor(A/65536),fe=A-L*65536,A=_e+L+65535,L=Math.floor(A/65536),_e=A-L*65536,A=je+L+65535,L=Math.floor(A/65536),je=A-L*65536,A=Ve+L+65535,L=Math.floor(A/65536),Ve=A-L*65536,A=ct+L+65535,L=Math.floor(A/65536),ct=A-L*65536,A=Ie+L+65535,L=Math.floor(A/65536),Ie=A-L*65536,A=nt+L+65535,L=Math.floor(A/65536),nt=A-L*65536,A=bt+L+65535,L=Math.floor(A/65536),bt=A-L*65536,A=Ot+L+65535,L=Math.floor(A/65536),Ot=A-L*65536,A=pt+L+65535,L=Math.floor(A/65536),pt=A-L*65536,A=ht+L+65535,L=Math.floor(A/65536),ht=A-L*65536,A=xt+L+65535,L=Math.floor(A/65536),xt=A-L*65536,A=wt+L+65535,L=Math.floor(A/65536),wt=A-L*65536,A=Qe+L+65535,L=Math.floor(A/65536),Qe=A-L*65536,Q+=L-1+37*(L-1),T[0]=Q,T[1]=te,T[2]=fe,T[3]=_e,T[4]=je,T[5]=Ve,T[6]=ct,T[7]=Ie,T[8]=nt,T[9]=bt,T[10]=Ot,T[11]=pt,T[12]=ht,T[13]=xt,T[14]=wt,T[15]=Qe}function He(T,D){we(T,D,D)}function Ee(T,D){var $=n(),A;for(A=0;A<16;A++)$[A]=D[A];for(A=253;A>=0;A--)He($,$),A!==2&&A!==4&&we($,$,D);for(A=0;A<16;A++)T[A]=$[A]}function it(T,D){var $=n(),A;for(A=0;A<16;A++)$[A]=D[A];for(A=250;A>=0;A--)He($,$),A!==1&&we($,$,D);for(A=0;A<16;A++)T[A]=$[A]}function ke(T,D,$){var A=new Uint8Array(32),L=new Float64Array(80),Q,te,fe=n(),_e=n(),je=n(),Ve=n(),ct=n(),Ie=n();for(te=0;te<31;te++)A[te]=D[te];for(A[31]=D[31]&127|64,A[0]&=248,ie(L,$),te=0;te<16;te++)_e[te]=L[te],Ve[te]=fe[te]=je[te]=0;for(fe[0]=Ve[0]=1,te=254;te>=0;--te)Q=A[te>>>3]>>>(te&7)&1,j(fe,_e,Q),j(je,Ve,Q),se(ct,fe,je),ye(fe,fe,je),se(je,_e,Ve),ye(_e,_e,Ve),He(Ve,ct),He(Ie,fe),we(fe,je,fe),we(je,_e,ct),se(ct,fe,je),ye(fe,fe,je),He(_e,fe),ye(je,Ve,Ie),we(fe,je,u),se(fe,fe,Ve),we(je,je,fe),we(fe,Ve,Ie),we(Ve,_e,L),He(_e,ct),j(fe,_e,Q),j(je,Ve,Q);for(te=0;te<16;te++)L[te+16]=fe[te],L[te+32]=je[te],L[te+48]=_e[te],L[te+64]=Ve[te];var nt=L.subarray(32),bt=L.subarray(16);return Ee(nt,nt),we(bt,bt,nt),K(T,bt),0}function Le(T,D){return ke(T,D,o)}function De(T,D){return r(D,32),Le(T,D)}function me(T,D,$){var A=new Uint8Array(32);return ke(A,$,D),E(T,i,A,C)}var yt=Z,lt=q;function Ft(T,D,$,A,L,Q){var te=new Uint8Array(32);return me(te,L,Q),yt(T,D,$,A,te)}function yn(T,D,$,A,L,Q){var te=new Uint8Array(32);return me(te,L,Q),lt(T,D,$,A,te)}var nn=[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 ne(T,D,$,A){for(var L=new Int32Array(16),Q=new Int32Array(16),te,fe,_e,je,Ve,ct,Ie,nt,bt,Ot,pt,ht,xt,wt,Qe,ut,Xe,Ne,qe,Ge,pe,he,Re,Oe,Pe,Be,vt=T[0],jt=T[1],Bt=T[2],It=T[3],J=T[4],Zt=T[5],sn=T[6],un=T[7],Ut=D[0],ln=D[1],rn=D[2],Yn=D[3],mn=D[4],kn=D[5],Zn=D[6],Xn=D[7],wr=0;A>=128;){for(qe=0;qe<16;qe++)Ge=8*qe+wr,L[qe]=$[Ge+0]<<24|$[Ge+1]<<16|$[Ge+2]<<8|$[Ge+3],Q[qe]=$[Ge+4]<<24|$[Ge+5]<<16|$[Ge+6]<<8|$[Ge+7];for(qe=0;qe<80;qe++)if(te=vt,fe=jt,_e=Bt,je=It,Ve=J,ct=Zt,Ie=sn,nt=un,bt=Ut,Ot=ln,pt=rn,ht=Yn,xt=mn,wt=kn,Qe=Zn,ut=Xn,pe=un,he=Xn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=(J>>>14|mn<<18)^(J>>>18|mn<<14)^(mn>>>9|J<<23),he=(mn>>>14|J<<18)^(mn>>>18|J<<14)^(J>>>9|mn<<23),Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,pe=J&Zt^~J&sn,he=mn&kn^~mn&Zn,Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,pe=nn[qe*2],he=nn[qe*2+1],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,pe=L[qe%16],he=Q[qe%16],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,Xe=Pe&65535|Be<<16,Ne=Re&65535|Oe<<16,pe=Xe,he=Ne,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=(vt>>>28|Ut<<4)^(Ut>>>2|vt<<30)^(Ut>>>7|vt<<25),he=(Ut>>>28|vt<<4)^(vt>>>2|Ut<<30)^(vt>>>7|Ut<<25),Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,pe=vt&jt^vt&Bt^jt&Bt,he=Ut&ln^Ut&rn^ln&rn,Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,nt=Pe&65535|Be<<16,ut=Re&65535|Oe<<16,pe=je,he=ht,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=Xe,he=Ne,Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,je=Pe&65535|Be<<16,ht=Re&65535|Oe<<16,jt=te,Bt=fe,It=_e,J=je,Zt=Ve,sn=ct,un=Ie,vt=nt,ln=bt,rn=Ot,Yn=pt,mn=ht,kn=xt,Zn=wt,Xn=Qe,Ut=ut,qe%16===15)for(Ge=0;Ge<16;Ge++)pe=L[Ge],he=Q[Ge],Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=L[(Ge+9)%16],he=Q[(Ge+9)%16],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Xe=L[(Ge+1)%16],Ne=Q[(Ge+1)%16],pe=(Xe>>>1|Ne<<31)^(Xe>>>8|Ne<<24)^Xe>>>7,he=(Ne>>>1|Xe<<31)^(Ne>>>8|Xe<<24)^(Ne>>>7|Xe<<25),Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Xe=L[(Ge+14)%16],Ne=Q[(Ge+14)%16],pe=(Xe>>>19|Ne<<13)^(Ne>>>29|Xe<<3)^Xe>>>6,he=(Ne>>>19|Xe<<13)^(Xe>>>29|Ne<<3)^(Ne>>>6|Xe<<26),Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,L[Ge]=Pe&65535|Be<<16,Q[Ge]=Re&65535|Oe<<16;pe=vt,he=Ut,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[0],he=D[0],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[0]=vt=Pe&65535|Be<<16,D[0]=Ut=Re&65535|Oe<<16,pe=jt,he=ln,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[1],he=D[1],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[1]=jt=Pe&65535|Be<<16,D[1]=ln=Re&65535|Oe<<16,pe=Bt,he=rn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[2],he=D[2],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[2]=Bt=Pe&65535|Be<<16,D[2]=rn=Re&65535|Oe<<16,pe=It,he=Yn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[3],he=D[3],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[3]=It=Pe&65535|Be<<16,D[3]=Yn=Re&65535|Oe<<16,pe=J,he=mn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[4],he=D[4],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[4]=J=Pe&65535|Be<<16,D[4]=mn=Re&65535|Oe<<16,pe=Zt,he=kn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[5],he=D[5],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[5]=Zt=Pe&65535|Be<<16,D[5]=kn=Re&65535|Oe<<16,pe=sn,he=Zn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[6],he=D[6],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[6]=sn=Pe&65535|Be<<16,D[6]=Zn=Re&65535|Oe<<16,pe=un,he=Xn,Re=he&65535,Oe=he>>>16,Pe=pe&65535,Be=pe>>>16,pe=T[7],he=D[7],Re+=he&65535,Oe+=he>>>16,Pe+=pe&65535,Be+=pe>>>16,Oe+=Re>>>16,Pe+=Oe>>>16,Be+=Pe>>>16,T[7]=un=Pe&65535|Be<<16,D[7]=Xn=Re&65535|Oe<<16,wr+=128,A-=128}return A}function de(T,D,$){var A=new Int32Array(8),L=new Int32Array(8),Q=new Uint8Array(256),te,fe=$;for(A[0]=1779033703,A[1]=3144134277,A[2]=1013904242,A[3]=2773480762,A[4]=1359893119,A[5]=2600822924,A[6]=528734635,A[7]=1541459225,L[0]=4089235720,L[1]=2227873595,L[2]=4271175723,L[3]=1595750129,L[4]=2917565137,L[5]=725511199,L[6]=4215389547,L[7]=327033209,ne(A,L,D,$),$%=128,te=0;te<$;te++)Q[te]=D[fe-$+te];for(Q[$]=128,$=256-128*($<112?1:0),Q[$-9]=0,m(Q,$-8,fe/536870912|0,fe<<3),ne(A,L,Q,$),te=0;te<8;te++)m(T,8*te,A[te],L[te]);return 0}function ge(T,D){var $=n(),A=n(),L=n(),Q=n(),te=n(),fe=n(),_e=n(),je=n(),Ve=n();ye($,T[1],T[0]),ye(Ve,D[1],D[0]),we($,$,Ve),se(A,T[0],T[1]),se(Ve,D[0],D[1]),we(A,A,Ve),we(L,T[3],D[3]),we(L,L,c),we(Q,T[2],D[2]),se(Q,Q,Q),ye(te,A,$),ye(fe,Q,L),se(_e,Q,L),se(je,A,$),we(T[0],te,fe),we(T[1],je,_e),we(T[2],_e,fe),we(T[3],te,je)}function Ue(T,D,$){var A;for(A=0;A<4;A++)j(T[A],D[A],$)}function Fe(T,D){var $=n(),A=n(),L=n();Ee(L,D[2]),we($,D[0],L),we(A,D[1],L),K(T,A),T[31]^=re($)<<7}function Ae(T,D,$){var A,L;for(G(T[0],a),G(T[1],s),G(T[2],s),G(T[3],a),L=255;L>=0;--L)A=$[L/8|0]>>(L&7)&1,Ue(T,D,A),ge(D,T),ge(T,T),Ue(T,D,A)}function tt(T,D){var $=[n(),n(),n(),n()];G($[0],f),G($[1],h),G($[2],s),we($[3],f,h),Ae(T,$,D)}function mt(T,D,$){var A=new Uint8Array(64),L=[n(),n(),n(),n()],Q;for($||r(D,32),de(A,D,32),A[0]&=248,A[31]&=127,A[31]|=64,tt(L,A),Fe(T,L),Q=0;Q<32;Q++)D[Q+32]=T[Q];return 0}var wn=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 Kt(T,D){var $,A,L,Q;for(A=63;A>=32;--A){for($=0,L=A-32,Q=A-12;L>4)*wn[L],$=D[L]>>8,D[L]&=255;for(L=0;L<32;L++)D[L]-=$*wn[L];for(A=0;A<32;A++)D[A+1]+=D[A]>>8,T[A]=D[A]&255}function _n(T){var D=new Float64Array(64),$;for($=0;$<64;$++)D[$]=T[$];for($=0;$<64;$++)T[$]=0;Kt(T,D)}function $i(T,D,$,A){var L=new Uint8Array(64),Q=new Uint8Array(64),te=new Uint8Array(64),fe,_e,je=new Float64Array(64),Ve=[n(),n(),n(),n()];de(L,A,32),L[0]&=248,L[31]&=127,L[31]|=64;var ct=$+64;for(fe=0;fe<$;fe++)T[64+fe]=D[fe];for(fe=0;fe<32;fe++)T[32+fe]=L[32+fe];for(de(te,T.subarray(32),$+32),_n(te),tt(Ve,te),Fe(T,Ve),fe=32;fe<64;fe++)T[fe]=A[fe];for(de(Q,T,$+64),_n(Q),fe=0;fe<64;fe++)je[fe]=0;for(fe=0;fe<32;fe++)je[fe]=te[fe];for(fe=0;fe<32;fe++)for(_e=0;_e<32;_e++)je[fe+_e]+=Q[fe]*L[_e];return Kt(T.subarray(32),je),ct}function xr(T,D){var $=n(),A=n(),L=n(),Q=n(),te=n(),fe=n(),_e=n();return G(T[2],s),ie(T[1],D),He(L,T[1]),we(Q,L,l),ye(L,L,T[2]),se(Q,T[2],Q),He(te,Q),He(fe,te),we(_e,fe,te),we($,_e,L),we($,$,Q),it($,$),we($,$,L),we($,$,Q),we($,$,Q),we(T[0],$,Q),He(A,T[0]),we(A,A,Q),Y(A,L)&&we(T[0],T[0],p),He(A,T[0]),we(A,A,Q),Y(A,L)?-1:(re(T[0])===D[31]>>7&&ye(T[0],a,T[0]),we(T[3],T[0],T[1]),0)}function mi(T,D,$,A){var L,Q=new Uint8Array(32),te=new Uint8Array(64),fe=[n(),n(),n(),n()],_e=[n(),n(),n(),n()];if($<64||xr(_e,A))return-1;for(L=0;L<$;L++)T[L]=D[L];for(L=0;L<32;L++)T[L+32]=A[L];if(de(te,T,$),_n(te),Ae(fe,_e,te),tt(_e,D.subarray(32)),ge(fe,_e),Fe(Q,fe),$-=64,w(D,0,Q,0)){for(L=0;L<$;L++)T[L]=0;return-1}for(L=0;L<$;L++)T[L]=D[L+64];return $}var ur=32,ai=24,vi=32,Dr=16,Zi=32,vo=32,yi=32,$r=32,_a=32,_t=ai,hn=vi,Sn=Dr,Gn=64,lr=32,Xr=64,yo=32,Xl=64;t.lowlevel={crypto_core_hsalsa20:E,crypto_stream_xor:B,crypto_stream:N,crypto_stream_salsa20_xor:P,crypto_stream_salsa20:M,crypto_onetimeauth:W,crypto_onetimeauth_verify:ee,crypto_verify_16:b,crypto_verify_32:w,crypto_secretbox:Z,crypto_secretbox_open:q,crypto_scalarmult:ke,crypto_scalarmult_base:Le,crypto_box_beforenm:me,crypto_box_afternm:yt,crypto_box:Ft,crypto_box_open:yn,crypto_box_keypair:De,crypto_hash:de,crypto_sign:$i,crypto_sign_keypair:mt,crypto_sign_open:mi,crypto_secretbox_KEYBYTES:ur,crypto_secretbox_NONCEBYTES:ai,crypto_secretbox_ZEROBYTES:vi,crypto_secretbox_BOXZEROBYTES:Dr,crypto_scalarmult_BYTES:Zi,crypto_scalarmult_SCALARBYTES:vo,crypto_box_PUBLICKEYBYTES:yi,crypto_box_SECRETKEYBYTES:$r,crypto_box_BEFORENMBYTES:_a,crypto_box_NONCEBYTES:_t,crypto_box_ZEROBYTES:hn,crypto_box_BOXZEROBYTES:Sn,crypto_sign_BYTES:Gn,crypto_sign_PUBLICKEYBYTES:lr,crypto_sign_SECRETKEYBYTES:Xr,crypto_sign_SEEDBYTES:yo,crypto_hash_BYTES:Xl,gf:n,D:l,L:wn,pack25519:K,unpack25519:ie,M:we,A:se,S:He,Z:ye,pow2523:it,add:ge,set25519:G,modL:Kt,scalarmult:Ae,scalarbase:tt};function Cf(T,D){if(T.length!==ur)throw new Error("bad key size");if(D.length!==ai)throw new Error("bad nonce size")}function oe(T,D){if(T.length!==yi)throw new Error("bad public key size");if(D.length!==$r)throw new Error("bad secret key size")}function ue(){for(var T=0;T=0},t.sign.keyPair=function(){var T=new Uint8Array(lr),D=new Uint8Array(Xr);return mt(T,D),{publicKey:T,secretKey:D}},t.sign.keyPair.fromSecretKey=function(T){if(ue(T),T.length!==Xr)throw new Error("bad secret key size");for(var D=new Uint8Array(lr),$=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{let n=!1;const r=e.map(i=>{const o=GN(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{scope:h,children:p,...m}=f,y=h?.[e]?.[u]||s,b=v.useMemo(()=>m,Object.values(m));return I.jsx(y.Provider,{value:b,children:p})};l.displayName=o+"Provider";function c(f,h){const p=h?.[e]?.[u]||s,m=v.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[l,c]}const i=()=>{const o=n.map(a=>v.createContext(a));return function(s){const u=s?.[e]||o;return v.useMemo(()=>({[`__scope${e}`]:{...s,[e]:u}}),[s,u])}};return i.scopeName=e,[r,tXe(i,...t)]}function tXe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=r.reduce((s,{useScope:u,scopeName:l})=>{const f=u(o)[`__scope${l}`];return{...s,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function YN(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}var nXe=globalThis?.document?v.useLayoutEffect:()=>{},rXe=zx[" useInsertionEffect ".trim().toString()]||nXe;function iXe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,a]=oXe({defaultProp:t,onChange:n}),s=e!==void 0,u=s?e:i;{const c=v.useRef(e!==void 0);v.useEffect(()=>{const f=c.current;f!==s&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,r])}const l=v.useCallback(c=>{if(s){const f=aXe(c)?c(e):c;f!==e&&a.current?.(f)}else o(c)},[s,e,o,a]);return[u,l]}function oXe({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),i=v.useRef(n),o=v.useRef(t);return rXe(()=>{o.current=t},[t]),v.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function aXe(e){return typeof e=="function"}function sXe(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var uXe=globalThis?.document?v.useLayoutEffect:()=>{};function lXe(e){const[t,n]=v.useState(void 0);return uXe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,s;if("borderBoxSize"in o){const u=o.borderBoxSize,l=Array.isArray(u)?u[0]:u;a=l.inlineSize,s=l.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function ZN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function cXe(...e){return t=>{let n=!1;const r=e.map(i=>{const o=ZN(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{};function dXe(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var nX=e=>{const{present:t,children:n}=e,r=hXe(t),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=fXe(r.ref,pXe(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:o}):null};nX.displayName="Presence";function hXe(e){const[t,n]=v.useState(),r=v.useRef(null),i=v.useRef(e),o=v.useRef("none"),a=e?"mounted":"unmounted",[s,u]=dXe(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const l=Xy(r.current);o.current=s==="mounted"?l:"none"},[s]),XN(()=>{const l=r.current,c=i.current;if(c!==e){const h=o.current,p=Xy(l);e?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),XN(()=>{if(t){let l;const c=t.ownerDocument.defaultView??window,f=p=>{const y=Xy(r.current).includes(p.animationName);if(p.target===t&&y&&(u("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",l=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(o.current=Xy(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{c.clearTimeout(l),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:v.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function Xy(e){return e?.animationName||"none"}function pXe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function gXe(e){const t=mXe(e),n=v.forwardRef((r,i)=>{const{children:o,...a}=r,s=v.Children.toArray(o),u=s.find(yXe);if(u){const l=u.props.children,c=s.map(f=>f===u?v.Children.count(l)>1?v.Children.only(null):v.isValidElement(l)?l.props.children:null:f);return I.jsx(t,{...a,ref:i,children:v.isValidElement(l)?v.cloneElement(l,void 0,c):null})}return I.jsx(t,{...a,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function mXe(e){const t=v.forwardRef((n,r)=>{const{children:i,...o}=n;if(v.isValidElement(i)){const a=xXe(i),s=bXe(o,i.props);return i.type!==v.Fragment&&(s.ref=r?eX(r,a):a),v.cloneElement(i,s)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vXe=Symbol("radix.slottable");function yXe(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vXe}function bXe(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...s)=>{const u=o(...s);return i(...s),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function xXe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wXe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],e8=wXe.reduce((e,t)=>{const n=gXe(`Primitive.${t}`),r=v.forwardRef((i,o)=>{const{asChild:a,...s}=i,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),I.jsx(u,{...s,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),W2="Checkbox",[_Xe,Wtt]=eXe(W2),[SXe,t8]=_Xe(W2);function CXe(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:o,form:a,name:s,onCheckedChange:u,required:l,value:c="on",internal_do_not_use_render:f}=e,[h,p]=iXe({prop:n,defaultProp:i??!1,onChange:u,caller:W2}),[m,y]=v.useState(null),[b,w]=v.useState(null),x=v.useRef(!1),S=m?!!a||!!m.closest("form"):!0,O={checked:h,disabled:o,setChecked:p,control:m,setControl:y,name:s,form:a,value:c,hasConsumerStoppedPropagationRef:x,required:l,defaultChecked:Cl(i)?!1:i,isFormControl:S,bubbleInput:b,setBubbleInput:w};return I.jsx(SXe,{scope:t,...O,children:AXe(f)?f(O):r})}var rX="CheckboxTrigger",iX=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:o,value:a,disabled:s,checked:u,required:l,setControl:c,setChecked:f,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:m}=t8(rX,e),y=tX(i,c),b=v.useRef(u);return v.useEffect(()=>{const w=o?.form;if(w){const x=()=>f(b.current);return w.addEventListener("reset",x),()=>w.removeEventListener("reset",x)}},[o,f]),I.jsx(e8.button,{type:"button",role:"checkbox","aria-checked":Cl(u)?"mixed":u,"aria-required":l,"data-state":uX(u),"data-disabled":s?"":void 0,disabled:s,value:a,...r,ref:y,onKeyDown:YN(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:YN(n,w=>{f(x=>Cl(x)?!0:!x),m&&p&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})})});iX.displayName=rX;var EXe=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:a,disabled:s,value:u,onCheckedChange:l,form:c,...f}=e;return I.jsx(CXe,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:s,required:a,onCheckedChange:l,name:r,form:c,value:u,internal_do_not_use_render:({isFormControl:h})=>I.jsxs(I.Fragment,{children:[I.jsx(iX,{...f,ref:t,__scopeCheckbox:n}),h&&I.jsx(sX,{__scopeCheckbox:n})]})})});EXe.displayName=W2;var oX="CheckboxIndicator",OXe=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=t8(oX,n);return I.jsx(nX,{present:r||Cl(o.checked)||o.checked===!0,children:I.jsx(e8.span,{"data-state":uX(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});OXe.displayName=oX;var aX="CheckboxBubbleInput",sX=v.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:a,required:s,disabled:u,name:l,value:c,form:f,bubbleInput:h,setBubbleInput:p}=t8(aX,e),m=tX(n,p),y=sXe(o),b=lXe(r);v.useEffect(()=>{const x=h;if(!x)return;const S=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(S,"checked").set,C=!i.current;if(y!==o&&E){const P=new Event("click",{bubbles:C});x.indeterminate=Cl(o),E.call(x,Cl(o)?!1:o),x.dispatchEvent(P)}},[h,y,o,i]);const w=v.useRef(Cl(o)?!1:o);return I.jsx(e8.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??w.current,required:s,disabled:u,name:l,value:c,form:f,...t,tabIndex:-1,ref:m,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});sX.displayName=aX;function AXe(e){return typeof e=="function"}function Cl(e){return e==="indeterminate"}function uX(e){return Cl(e)?"indeterminate":e?"checked":"unchecked"}export{Sve as $,UQe as A,Gi as B,bQe as C,tme as D,SQe as E,yQe as F,pT as G,F as H,eQe as I,DQe as J,MXe as K,PQe as L,FQe as M,QXe as N,kXe as O,$Xe as P,MQe as Q,vQe as R,Pl as S,kQe as T,XXe as U,IXe as V,yve as W,wve as X,_ve as Y,Cz as Z,QQe as _,LXe as a,Vet as a$,Cve as a0,bve as a1,xve as a2,OJe as a3,YQe as a4,AJe as a5,vJe as a6,yJe as a7,wJe as a8,_Je as a9,YXe as aA,oQe as aB,KXe as aC,JXe as aD,uQe as aE,sQe as aF,tQe as aG,aQe as aH,WXe as aI,UXe as aJ,ZXe as aK,gQe as aL,pQe as aM,dQe as aN,mQe as aO,rQe as aP,HXe as aQ,$et as aR,iJe as aS,wet as aT,iQe as aU,cQe as aV,Net as aW,Let as aX,Fet as aY,NXe as aZ,zet as a_,CJe as aa,HQe as ab,SJe as ac,eJe as ad,xJe as ae,EJe as af,gJe as ag,mJe as ah,bJe as ai,fJe as aj,cJe as ak,dJe as al,qXe as am,kJe as an,obe as ao,abe as ap,MJe as aq,IJe as ar,RJe as as,DJe as at,RXe as au,VXe as av,GXe as aw,lQe as ax,jXe as ay,get as az,Use as b,aet as b$,Wet as b0,Het as b1,KQe as b2,ett as b3,ZQe as b4,ttt as b5,qet as b6,Ket as b7,Get as b8,Zet as b9,zJe as bA,Met as bB,Tet as bC,net as bD,Pet as bE,dtt as bF,htt as bG,ptt as bH,dHe as bI,yHe as bJ,pet as bK,NJe as bL,BJe as bM,FJe as bN,rtt as bO,Ui as bP,mtt as bQ,vtt as bR,tJe as bS,nJe as bT,Ett as bU,oet as bV,Ott as bW,det as bX,Oet as bY,xet as bZ,tet as b_,Xet as ba,Jet as bb,Qet as bc,ntt as bd,Yet as be,ott as bf,GQe as bg,ltt as bh,ctt as bi,stt as bj,utt as bk,I3 as bl,Sf as bm,WJe as bn,jet as bo,Bet as bp,s5 as bq,u5 as br,mje as bs,Js as bt,wf as bu,rp as bv,itt as bw,LJe as bx,UJe as by,het as bz,dn as c,lJe as c$,fet as c0,ket as c1,QJe as c2,ytt as c3,btt as c4,Stt as c5,YJe as c6,GJe as c7,zXe as c8,hQe as c9,vet as cA,Cet as cB,yet as cC,cet as cD,qJe as cE,KJe as cF,Ret as cG,Ja as cH,br as cI,uet as cJ,xtt as cK,wtt as cL,sJe as cM,ef as cN,$Je as cO,Utt as cP,ztt as cQ,_et as cR,JJe as cS,ret as cT,met as cU,eet as cV,Eet as cW,set as cX,EXe as cY,OXe as cZ,XQe as c_,nQe as ca,BXe as cb,fQe as cc,Ptt as cd,ktt as ce,bet as cf,Ttt as cg,ZJe as ch,jJe as ci,Itt as cj,Ntt as ck,jtt as cl,Btt as cm,Ltt as cn,Ftt as co,Rtt as cp,Dtt as cq,$tt as cr,rJe as cs,aJe as ct,Aet as cu,_tt as cv,Ctt as cw,Nce as cx,zce as cy,Mce as cz,wm as d,qQe as d0,JQe as d1,uJe as d2,iet as d3,DXe as d4,HJe as d5,iHe as d6,oJe as d7,XJe as d8,VJe as d9,EQe as e,eA as f,TQe as g,AQe as h,NQe as i,I as j,Gr as k,LQe as l,CQe as m,xQe as n,wQe as o,$Qe as p,IQe as q,v as r,jQe as s,FXe as t,Sj as u,BQe as v,TXe as w,zQe as x,WQe as y,_Qe as z}; diff --git a/public/assets/admin/locales/en-US.js b/public/assets/admin/locales/en-US.js index 7f96daf..e3dcb83 100644 --- a/public/assets/admin/locales/en-US.js +++ b/public/assets/admin/locales/en-US.js @@ -866,6 +866,7 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "save": "Save", "cancel": "Cancel", "confirm": "Confirm", + "close": "Close", "delete": { "success": "Deleted successfully", "failed": "Failed to delete" @@ -1061,14 +1062,36 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "level": "Level", "time": "Time", "message": "Message", + "logTitle": "Title", + "method": "Method", "action": "Action", "context": "Context", "search": "Search logs...", "noLogs": "No logs available", + "noInfoLogs": "No info logs available", + "noWarningLogs": "No warning logs available", + "noErrorLogs": "No error logs available", "noSearchResults": "No matching logs found", "detailTitle": "Log Details", "viewDetail": "View Details", - "totalLogs": "Total logs: {{count}}" + "host": "Host", + "ip": "IP Address", + "uri": "URI", + "requestData": "Request Data", + "exception": "Exception", + "totalLogs": "Total logs: {{count}}", + "tabs": { + "all": "All", + "info": "Info", + "warning": "Warning", + "error": "Error" + }, + "filter": { + "searchAndLevel": "Filter results: {{count}} logs containing \\\"{{keyword}}\\\" with level \\\"{{level}}\\\"", + "searchOnly": "Search results: {{count}} logs containing \\\"{{keyword}}\\\"", + "levelOnly": "Filter results: {{count}} logs with level \\\"{{level}}\\\"", + "reset": "Reset Filters" + } }, "common": { "refresh": "Refresh", @@ -1547,6 +1570,17 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "tooltip": "Groups that can subscribe to this node", "empty": "--" }, + "loadStatus": { + "title": "Load Status", + "tooltip": "Server resource usage", + "noData": "No Data", + "details": "System Load Details", + "cpu": "CPU Usage", + "memory": "Memory Usage", + "swap": "Swap Usage", + "disk": "Disk Usage", + "lastUpdate": "Last Updated" + }, "type": "Type", "actions": "Actions", "copyAddress": "Copy Connection Address", diff --git a/public/assets/admin/locales/ko-KR.js b/public/assets/admin/locales/ko-KR.js index ebebfdf..b5489f8 100644 --- a/public/assets/admin/locales/ko-KR.js +++ b/public/assets/admin/locales/ko-KR.js @@ -864,6 +864,7 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "save": "저장", "cancel": "취소", "confirm": "확인", + "close": "닫기", "delete": { "success": "삭제되었습니다", "failed": "삭제에 실패했습니다" @@ -1070,6 +1071,49 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "action": "작업" } }, + "systemLog": { + "title": "시스템 로그", + "description": "시스템 운영 로그 조회", + "viewAll": "모두 보기", + "level": "레벨", + "time": "시간", + "message": "메시지", + "logTitle": "제목", + "method": "요청 방법", + "action": "작업", + "context": "컨텍스트", + "search": "로그 검색...", + "noLogs": "로그 없음", + "noInfoLogs": "정보 로그 없음", + "noWarningLogs": "경고 로그 없음", + "noErrorLogs": "오류 로그 없음", + "noSearchResults": "일치하는 로그가 없습니다", + "detailTitle": "로그 세부 정보", + "viewDetail": "세부 정보 보기", + "host": "호스트", + "ip": "IP 주소", + "uri": "URI", + "requestData": "요청 데이터", + "exception": "예외", + "totalLogs": "총 로그 수: {{count}}", + "tabs": { + "all": "전체", + "info": "정보", + "warning": "경고", + "error": "오류" + }, + "filter": { + "searchAndLevel": "필터 결과: \\\"{{keyword}}\\\"를 포함하고 레벨이 \\\"{{level}}\\\"인 로그 {{count}}개", + "searchOnly": "검색 결과: \\\"{{keyword}}\\\"를 포함하는 로그 {{count}}개", + "levelOnly": "필터 결과: 레벨이 \\\"{{level}}\\\"인 로그 {{count}}개", + "reset": "필터 초기화" + } + }, + "common": { + "refresh": "새로고침", + "close": "닫기", + "pagination": "{{current}}/{{total}} 페이지, 총 {{count}}개 항목" + }, "search": { "placeholder": "메뉴 및 기능 검색...", "title": "메뉴 네비게이션", @@ -1542,6 +1586,17 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "tooltip": "이 노드를 구독할 수 있는 그룹", "empty": "--" }, + "loadStatus": { + "title": "부하 상태", + "tooltip": "서버 리소스 사용량", + "noData": "데이터 없음", + "details": "시스템 부하 세부정보", + "cpu": "CPU 사용률", + "memory": "메모리 사용량", + "swap": "스왑 사용량", + "disk": "디스크 사용량", + "lastUpdate": "마지막 업데이트" + }, "type": "유형", "actions": "작업", "copyAddress": "연결 주소 복사", diff --git a/public/assets/admin/locales/zh-CN.js b/public/assets/admin/locales/zh-CN.js index 4fea21f..80c6081 100644 --- a/public/assets/admin/locales/zh-CN.js +++ b/public/assets/admin/locales/zh-CN.js @@ -871,6 +871,7 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "save": "保存", "cancel": "取消", "confirm": "确认", + "close": "关闭", "delete": { "success": "删除成功", "failed": "删除失败" @@ -1059,14 +1060,36 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "level": "级别", "time": "时间", "message": "消息", + "logTitle": "标题", + "method": "请求方法", "action": "操作", "context": "上下文", "search": "搜索日志内容...", "noLogs": "暂无日志记录", + "noInfoLogs": "暂无信息日志记录", + "noWarningLogs": "暂无警告日志记录", + "noErrorLogs": "暂无错误日志记录", "noSearchResults": "没有匹配的日志记录", "detailTitle": "日志详情", "viewDetail": "查看详情", - "totalLogs": "总日志数:{{count}}" + "host": "主机", + "ip": "IP地址", + "uri": "URI", + "requestData": "请求数据", + "exception": "异常信息", + "totalLogs": "总日志数:{{count}}", + "tabs": { + "all": "全部", + "info": "信息", + "warning": "警告", + "error": "错误" + }, + "filter": { + "searchAndLevel": "筛选结果: 包含\"{{keyword}}\"且级别为\"{{level}}\"的日志共 {{count}} 条", + "searchOnly": "搜索结果: 包含\"{{keyword}}\"的日志共 {{count}} 条", + "levelOnly": "筛选结果: 级别为\"{{level}}\"的日志共 {{count}} 条", + "reset": "重置筛选" + } }, "common": { "refresh": "刷新", @@ -1514,6 +1537,17 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "tooltip": "可订阅到该节点的权限组", "empty": "--" }, + "loadStatus": { + "title": "负载状态", + "tooltip": "服务器资源使用情况", + "noData": "暂无数据", + "details": "系统负载详情", + "cpu": "CPU 使用率", + "memory": "内存使用", + "swap": "交换区", + "disk": "磁盘使用", + "lastUpdate": "最后更新" + }, "type": "类型", "actions": "操作", "copyAddress": "复制连接地址",