From 1b728fffc7b5b051ca76f6a2f73a75fb0f192f33 Mon Sep 17 00:00:00 2001 From: xboard Date: Sun, 9 Feb 2025 11:06:08 +0800 Subject: [PATCH] feat: enhance user management and system optimization New Features: - Add bulk ban and email notification in user management - Add CSV export for batch coupon generation - Optimize subscription description template Bug Fixes: - Fix knowledge base pagination issue - Fix permission group filtering in node management - Fix unauthorized order placement for free subscription periods --- .../Controllers/V2/Admin/UserController.php | 18 +++--- app/Http/Resources/PlanResource.php | 55 +++++++++++++++++-- app/Http/Routes/V2/AdminRoute.php | 2 +- app/Services/PlanService.php | 11 ++-- public/assets/admin/assets/index.css | 2 +- public/assets/admin/assets/index.js | 14 ++--- public/assets/admin/locales/en-US.js | 41 +++++++++++++- public/assets/admin/locales/ko-KR.js | 41 +++++++++++++- public/assets/admin/locales/zh-CN.js | 41 +++++++++++++- resources/lang/en-US.json | 8 ++- resources/lang/zh-CN.json | 8 ++- resources/lang/zh-TW.json | 8 ++- theme/Xboard/config.json | 2 +- 13 files changed, 218 insertions(+), 33 deletions(-) diff --git a/app/Http/Controllers/V2/Admin/UserController.php b/app/Http/Controllers/V2/Admin/UserController.php index 9a919e3..222af9b 100644 --- a/app/Http/Controllers/V2/Admin/UserController.php +++ b/app/Http/Controllers/V2/Admin/UserController.php @@ -15,6 +15,7 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; class UserController extends Controller { @@ -243,7 +244,7 @@ class UserController extends Controller try { $user->update($params); } catch (\Exception $e) { - \Log::error($e); + Log::error($e); return $this->fail([500, '保存失败']); } return $this->success(true); @@ -251,8 +252,9 @@ class UserController extends Controller public function dumpCSV(Request $request) { + ini_set('memory_limit', -1); $userModel = User::orderBy('id', 'asc'); - $this->filter($request, $userModel); + $this->applyFiltersAndSorts($request, $userModel); $res = $userModel->get(); $plan = Plan::get(); for ($i = 0; $i < count($res); $i++) { @@ -341,7 +343,7 @@ class UserController extends Controller DB::commit(); } catch (\Exception $e) { DB::rollBack(); - \Log::error($e); + Log::error($e); return $this->fail([500, '生成失败']); } $data = "账号,密码,过期时间,UUID,创建时间,订阅地址\r\n"; @@ -357,11 +359,13 @@ class UserController extends Controller public function sendMail(UserSendMail $request) { + ini_set('memory_limit', '-1'); $sortType = in_array($request->input('sort_type'), ['ASC', 'DESC']) ? $request->input('sort_type') : 'DESC'; $sort = $request->input('sort') ? $request->input('sort') : 'created_at'; $builder = User::orderBy($sort, $sortType); - $this->filter($request, $builder); + $this->applyFilters($request, $builder); $users = $builder->get(); + return $this->success($users->count()); foreach ($users as $user) { SendEmailJob::dispatch( [ @@ -386,13 +390,13 @@ class UserController extends Controller $sortType = in_array($request->input('sort_type'), ['ASC', 'DESC']) ? $request->input('sort_type') : 'DESC'; $sort = $request->input('sort') ? $request->input('sort') : 'created_at'; $builder = User::orderBy($sort, $sortType); - $this->filter($request, $builder); + $this->applyFilters($request, $builder); try { $builder->update([ 'banned' => 1 ]); } catch (\Exception $e) { - \Log::error($e); + Log::error($e); return $this->fail([500, '处理失败']); } @@ -425,7 +429,7 @@ class UserController extends Controller return $this->success(true); } catch (\Exception $e) { DB::rollBack(); - \Log::error($e); + Log::error($e); return $this->fail([500, '删除失败']); } } diff --git a/app/Http/Resources/PlanResource.php b/app/Http/Resources/PlanResource.php index 079d96e..1f9a57c 100644 --- a/app/Http/Resources/PlanResource.php +++ b/app/Http/Resources/PlanResource.php @@ -11,7 +11,7 @@ use Illuminate\Http\Resources\Json\JsonResource; class PlanResource extends JsonResource { private const PRICE_MULTIPLIER = 100; - + /** * Transform the resource into an array. * @@ -23,7 +23,7 @@ class PlanResource extends JsonResource 'id' => $this->resource['id'], 'group_id' => $this->resource['group_id'], 'name' => $this->resource['name'], - 'content' => $this->resource['content'], + 'content' => $this->formatContent(), ...$this->getPeriodPrices(), 'capacity_limit' => $this->getFormattedCapacityLimit(), 'transfer_enable' => $this->resource['transfer_enable'], @@ -49,8 +49,8 @@ class PlanResource extends JsonResource ->mapWithKeys(function (string $newPeriod, string $legacyPeriod): array { $price = $this->resource['prices'][$newPeriod] ?? null; return [ - $legacyPeriod => $price !== null - ? (float) $price * self::PRICE_MULTIPLIER + $legacyPeriod => $price !== null + ? (float) $price * self::PRICE_MULTIPLIER : null ]; }) @@ -72,4 +72,49 @@ class PlanResource extends JsonResource default => (int) $limit, }; } -} \ No newline at end of file + + /** + * Format content with template variables + * + * @return string + */ + protected function formatContent(): string + { + $content = $this->resource['content']; + + $replacements = [ + '{{transfer}}' => $this->resource['transfer_enable'], + '{{speed}}' => $this->resource['speed_limit'] === NULL ? __('No Limit') : $this->resource['speed_limit'], + '{{devices}}' => $this->resource['device_limit'] === NULL ? __('No Limit') : $this->resource['device_limit'], + '{{reset_method}}' => $this->getResetMethodText(), + ]; + + return str_replace( + array_keys($replacements), + array_values($replacements), + $content + ); + } + + /** + * Get reset method text + * + * @return string + */ + protected function getResetMethodText(): string + { + $method = $this->resource['reset_traffic_method']; + + if ($method === Plan::RESET_TRAFFIC_FOLLOW_SYSTEM) { + $method = admin_setting('reset_traffic_method', Plan::RESET_TRAFFIC_MONTHLY); + } + return match ($method) { + Plan::RESET_TRAFFIC_FIRST_DAY_MONTH => __('First Day of Month'), + Plan::RESET_TRAFFIC_MONTHLY => __('Monthly'), + Plan::RESET_TRAFFIC_NEVER => __('Never'), + Plan::RESET_TRAFFIC_FIRST_DAY_YEAR => __('First Day of Year'), + Plan::RESET_TRAFFIC_YEARLY => __('Yearly'), + default => __('Monthly') + }; + } +} \ No newline at end of file diff --git a/app/Http/Routes/V2/AdminRoute.php b/app/Http/Routes/V2/AdminRoute.php index c1c97b7..ed0e772 100644 --- a/app/Http/Routes/V2/AdminRoute.php +++ b/app/Http/Routes/V2/AdminRoute.php @@ -104,7 +104,7 @@ class AdminRoute $router->get('/getUserInfoById', [UserController::class, 'getUserInfoById']); $router->post('/generate', [UserController::class, 'generate']); $router->post('/dumpCSV', [UserController::class, 'dumpCSV']); - $router->post('/user/sendMail', [UserController::class, 'sendMail']); + $router->post('/sendMail', [UserController::class, 'sendMail']); $router->post('/ban', [UserController::class, 'ban']); $router->post('/resetSecret', [UserController::class, 'resetSecret']); $router->post('/setInviteUser', [UserController::class, 'setInviteUser']); diff --git a/app/Services/PlanService.php b/app/Services/PlanService.php index 30b73b8..52549cf 100644 --- a/app/Services/PlanService.php +++ b/app/Services/PlanService.php @@ -75,16 +75,17 @@ class PlanService // 转换周期格式为新版格式 $periodKey = self::getPeriodKey($period); + + // 检查价格时使用新版格式 + if (!isset($this->plan->prices[$periodKey]) || $this->plan->prices[$periodKey] === NULL) { + throw new ApiException(__('This payment period cannot be purchased, please choose another period')); + } + if ($periodKey === Plan::PERIOD_RESET_TRAFFIC) { $this->validateResetTrafficPurchase($user); return; } - // 检查价格时使用新版格式 - if (!isset($this->plan->prices[$periodKey])) { - throw new ApiException(__('This payment period cannot be purchased, please choose another period')); - } - if ($user->plan_id !== $this->plan->id && !$this->hasCapacity($this->plan)) { throw new ApiException(__('Current product is sold out')); } diff --git a/public/assets/admin/assets/index.css b/public/assets/admin/assets/index.css index abab3ee..717ef0d 100644 --- a/public/assets/admin/assets/index.css +++ b/public/assets/admin/assets/index.css @@ -1 +1 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--header-height: 4rem;--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%}.collapsibleDropdown{overflow:hidden}.collapsibleDropdown[data-state=open]{animation:slideDown .2s ease-out}.collapsibleDropdown[data-state=closed]{animation:slideUp .2s ease-out}@keyframes slideDown{0%{height:0}to{height:var(--radix-collapsible-content-height)}}@keyframes slideUp{0%{height:var(--radix-collapsible-content-height)}to{height:0}}*{border-color:hsl(var(--border))}body{min-height:100svh;width:100%;background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-left-1{left:-.25rem}.-right-1{right:-.25rem}.-right-5{right:-1.25rem}.-top-1\/2{top:-50%}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-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}.-m-0\.5{margin:-.125rem}.m-1{margin:.25rem}.m-auto{margin:auto}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.-ml-3{margin-left:-.75rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-8{margin-left:2rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\!table{display:table!important}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-\[16\/9\]{aspect-ratio:16/9}.aspect-square{aspect-ratio:1 / 1}.size-10{width:2.5rem;height:2.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[180px\]{height:180px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[90vh\]{height:90vh}.h-\[calc\(100\%-var\(--header-height\)\)\]{height:calc(100% - var(--header-height))}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-12{max-height:3rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95\%\]{max-height:95%}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-\[120px\]{min-height:120px}.min-h-\[200px\]{min-height:200px}.min-h-\[60px\]{min-height:60px}.w-0{width:0px}.w-1\.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-\[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-\[300px\]{min-width:300px}.min-w-\[40px\]{min-width:40px}.min-w-\[4rem\]{min-width:4rem}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-32{max-width:8rem}.max-w-4xl{max-width:56rem}.max-w-52{max-width:13rem}.max-w-6xl{max-width:72rem}.max-w-80{max-width:20rem}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[500px\]{max-width:500px}.max-w-\[60\%\]{max-width:60%}.max-w-\[600px\]{max-width:600px}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-none{max-width:none}.max-w-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-\[100px_1fr\]{grid-template-columns:100px 1fr}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-2{row-gap:.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-wrap{text-wrap:wrap}.text-nowrap{text-wrap:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-lg{border-top-left-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-lg{border-top-right-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-bl-none{border-bottom-left-radius:0}.rounded-br-none{border-bottom-right-radius:0}.rounded-tl-lg{border-top-left-radius:var(--radius)}.rounded-tl-none{border-top-left-radius:0}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-lg{border-top-right-radius:var(--radius)}.rounded-tr-none{border-top-right-radius:0}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-x-0{border-left-width:0px;border-right-width:0px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-0{border-left-width:0px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-r-0{border-right-width:0px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.border-blue-500\/50{border-color:#3b82f680}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-foreground\/10{border-color:hsl(var(--foreground) / .1)}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-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-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-green-500\/70{background-color:#22c55eb3}.bg-inherit{background-color:inherit}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground{background-color:hsl(var(--primary-foreground))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/50{background-color:hsl(var(--secondary) / .5)}.bg-slate-100\/80{background-color:#f1f5f9cc}.bg-transparent{background-color:transparent}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/80{background-color:#eab308cc}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-background\/95{--tw-gradient-from: hsl(var(--background) / .95) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background\/80{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .8) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-background\/60{--tw-gradient-to: hsl(var(--background) / .6) var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-primary{fill:hsl(var(--primary))}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-0{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{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-0\.5{padding-bottom:.125rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.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-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-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / 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-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-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-destructive\/50{--tw-shadow-color: hsl(var(--destructive) / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/50{--tw-shadow-color: rgb(16 185 129 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-yellow-500\/50{--tw-shadow-color: rgb(234 179 8 / .5);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-gray-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(229 231 235 / var(--tw-ring-opacity, 1))}.ring-gray-300\/20{--tw-ring-color: rgb(209 213 219 / .2)}.ring-green-500\/20{--tw-ring-color: rgb(34 197 94 / .2)}.ring-primary\/20{--tw-ring-color: hsl(var(--primary) / .2)}.ring-offset-2{--tw-ring-offset-width: 2px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.ring-offset-white{--tw-ring-offset-color: #fff}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[1px\]{--tw-backdrop-blur: blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[max-height\,padding\]{transition-property:max-height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[opacity\]{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-100{transition-delay:.1s}.delay-150{transition-delay:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-150{animation-duration:.15s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-700{animation-duration:.7s}.delay-100{animation-delay:.1s}.delay-150{animation-delay:.15s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.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-secondary-foreground\/10:hover{background-color:hsl(var(--secondary-foreground) / .1)}.hover\:bg-secondary\/70:hover{background-color:hsl(var(--secondary) / .7)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-200\/80:hover{background-color:#e2e8f0cc}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-yellow-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-80:hover{--tw-bg-opacity: .8}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-foreground\/70:hover{color:hsl(var(--foreground) / .7)}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-black\/30:hover{--tw-shadow-color: rgb(0 0 0 / .3);--tw-shadow: var(--tw-shadow-colored)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:z-10:focus{z-index:10}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-primary:focus{background-color:hsl(var(--primary))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-destructive:focus{color:hsl(var(--destructive))}.focus\:text-primary-foreground:focus{color:hsl(var(--primary-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-primary:focus-visible{--tw-ring-color: hsl(var(--primary))}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-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-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / 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-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-yellow-500\/10:is(.dark *){background-color:#eab3081a}.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-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:ring-gray-700:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity, 1))}.dark\:ring-gray-800:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(31 41 55 / var(--tw-ring-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-blue-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-\[480px\]{width:480px}.sm\:w-\[540px\]{width:540px}.sm\:w-\[90vw\]{width:90vw}.sm\:w-full{width:100%}.sm\:max-w-72{max-width:18rem}.sm\:max-w-\[1025px\]{max-width:1025px}.sm\:max-w-\[425px\]{max-width:425px}.sm\:max-w-\[700px\]{max-width:700px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:max-w-xl{max-width:36rem}.sm\:translate-y-5{--tw-translate-y: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\: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-svh{height:100svh}.md\:max-h-screen{max-height:100vh}.md\:w-14{width:3.5rem}.md\:w-32{width:8rem}.md\:w-64{width:16rem}.md\:w-80{width:20rem}.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}.after\:md\:block:after{content:var(--tw-content);display:block}}@media (min-width: 1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-1\/5{width:20%}.lg\:w-\[250px\]{width:250px}.lg\:max-w-none{max-width:none}.lg\:max-w-xl{max-width:36rem}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:flex-col{flex-direction:column}.lg\:gap-8{gap:2rem}.lg\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(0px * var(--tw-space-x-reverse));margin-left:calc(0px * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-12>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(3rem * var(--tw-space-x-reverse));margin-left:calc(3rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-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\/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-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\!table{display:table!important}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-\[16\/9\]{aspect-ratio:16/9}.aspect-square{aspect-ratio:1 / 1}.size-10{width:2.5rem;height:2.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[180px\]{height:180px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[90vh\]{height:90vh}.h-\[calc\(100\%-var\(--header-height\)\)\]{height:calc(100% - var(--header-height))}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-12{max-height:3rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95\%\]{max-height:95%}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-\[120px\]{min-height:120px}.min-h-\[200px\]{min-height:200px}.min-h-\[60px\]{min-height:60px}.w-0{width:0px}.w-1\.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-\[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-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[500px\]{max-width:500px}.max-w-\[60\%\]{max-width:60%}.max-w-\[600px\]{max-width:600px}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-none{max-width:none}.max-w-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-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-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-wrap{text-wrap:wrap}.text-nowrap{text-wrap:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-lg{border-top-left-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-lg{border-top-right-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-bl-none{border-bottom-left-radius:0}.rounded-br-none{border-bottom-right-radius:0}.rounded-tl-lg{border-top-left-radius:var(--radius)}.rounded-tl-none{border-top-left-radius:0}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-lg{border-top-right-radius:var(--radius)}.rounded-tr-none{border-top-right-radius:0}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-x-0{border-left-width:0px;border-right-width:0px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-0{border-left-width:0px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-r-0{border-right-width:0px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.border-blue-500\/50{border-color:#3b82f680}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-foreground\/10{border-color:hsl(var(--foreground) / .1)}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-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-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-green-500\/70{background-color:#22c55eb3}.bg-inherit{background-color:inherit}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.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-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{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-0\.5{padding-bottom:.125rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.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-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-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / 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-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-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-destructive\/50{--tw-shadow-color: hsl(var(--destructive) / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/50{--tw-shadow-color: rgb(16 185 129 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-yellow-500\/50{--tw-shadow-color: rgb(234 179 8 / .5);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-gray-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(229 231 235 / var(--tw-ring-opacity, 1))}.ring-gray-300\/20{--tw-ring-color: rgb(209 213 219 / .2)}.ring-green-500\/20{--tw-ring-color: rgb(34 197 94 / .2)}.ring-primary\/20{--tw-ring-color: hsl(var(--primary) / .2)}.ring-offset-2{--tw-ring-offset-width: 2px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.ring-offset-white{--tw-ring-offset-color: #fff}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[1px\]{--tw-backdrop-blur: blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[max-height\,padding\]{transition-property:max-height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[opacity\]{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-100{transition-delay:.1s}.delay-150{transition-delay:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-150{animation-duration:.15s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-700{animation-duration:.7s}.delay-100{animation-delay:.1s}.delay-150{animation-delay:.15s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.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-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / 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-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-yellow-500\/10:is(.dark *){background-color:#eab3081a}.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-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:ring-gray-700:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity, 1))}.dark\:ring-gray-800:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(31 41 55 / var(--tw-ring-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-blue-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-\[480px\]{width:480px}.sm\:w-\[540px\]{width:540px}.sm\:w-\[90vw\]{width:90vw}.sm\:w-full{width:100%}.sm\:max-w-72{max-width:18rem}.sm\:max-w-\[1025px\]{max-width:1025px}.sm\:max-w-\[425px\]{max-width:425px}.sm\:max-w-\[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-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\: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-svh{height:100svh}.md\:max-h-screen{max-height:100vh}.md\:w-14{width:3.5rem}.md\:w-32{width:8rem}.md\:w-64{width:16rem}.md\:w-80{width:20rem}.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}.after\:md\:block:after{content:var(--tw-content);display:block}}@media (min-width: 1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-1\/5{width:20%}.lg\:w-\[250px\]{width:250px}.lg\:max-w-none{max-width:none}.lg\:max-w-xl{max-width:36rem}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:flex-col{flex-direction:column}.lg\:gap-8{gap:2rem}.lg\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(0px * var(--tw-space-x-reverse));margin-left:calc(0px * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-12>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(3rem * var(--tw-space-x-reverse));margin-left:calc(3rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-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 5bb01c0..b421375 100644 --- a/public/assets/admin/assets/index.js +++ b/public/assets/admin/assets/index.js @@ -1,9 +1,9 @@ -import{r as u,j as e,t as gl,c as jl,I as Oa,a as Os,S as ia,u as js,b as ca,d as vl,O as da,e as bl,f as A,g as yl,h as Nl,i as _l,k as wl,B as Cl,l as Sl,Q as kl,m as Tl,R as Pl,n as Dl,P as El,o as Rl,p as Il,q as ln,F as Vl,C as Fl,s as Ml,v as Ol,w as zl,x as Ll,y as on,z as F,A as h,D as he,E as ge,G as cn,H as Vt,J as Ft,K as ma,L as Be,T as Mt,M as Ot,N as dn,U as mn,V as un,W as ua,X as xn,Y as Al,Z as hn,_ as fn,$ as pn,a0 as gn,a1 as zs,a2 as jn,a3 as $l,a4 as vn,a5 as bn,a6 as ql,a7 as Hl,a8 as Kl,a9 as Ul,aa as Bl,ab as Gl,ac as Wl,ad as Yl,ae as Ql,af as Jl,ag as Zl,ah as yn,ai as Xl,aj as eo,ak as Ls,al as Nn,am as so,an as to,ao as _n,ap as xa,aq as ao,ar as no,as as za,at as ro,au as wn,av as lo,aw as Cn,ax as oo,ay as io,az as co,aA as mo,aB as uo,aC as xo,aD as Sn,aE as ho,aF as fo,aG as po,aH as Ve,aI as go,aJ as kn,aK as jo,aL as vo,aM as Tn,aN as Pn,aO as Dn,aP as bo,aQ as yo,aR as En,aS as Rn,aT as In,aU as No,aV as _o,aW as Vn,aX as wo,aY as ha,aZ as Fn,a_ as Co,a$ as Mn,b0 as So,b1 as On,b2 as ko,b3 as zn,b4 as Ln,b5 as To,b6 as Po,b7 as An,b8 as Do,b9 as Eo,ba as $n,bb as Ro,bc as qn,bd as Io,be as Vo,bf as es,bg as ne,bh as Xe,bi as ft,bj as Fo,bk as Mo,bl as Oo,bm as zo,bn as Lo,bo as Ao,bp as La,bq as Aa,br as $o,bs as qo,bt as Ho,bu as Ko,bv as Uo,bw as ea,bx as dt,by as Bo,bz as Go,bA as Hn,bB as Wo,bC as Yo,bD as Kn,bE as Qo,bF as _e,bG as Jo,bH as $a,bI as sa,bJ as ta,bK as Zo,bL as Xo,bM as Un,bN as ei,bO as fa,bP as si,bQ as ti,bR as ai,bS as Bn,bT as Gn,bU as Wn,bV as ni,bW as ri,bX as li,bY as oi,bZ as Yn,b_ as ii,b$ as ds,c0 as ci,c1 as di,c2 as mi,c3 as Tt,c4 as Pe,c5 as qa,c6 as ui,c7 as Qn,c8 as Jn,c9 as Zn,ca as Xn,cb as er,cc as sr,cd as xi,ce as hi,cf as fi,cg as zt,ch as As,ci as ts,cj as Ye,ck as Qe,cl as as,cm as ns,cn as rs,co as pi,cp as gi,cq as ji,cr as vi,cs as bi,ct as yi,cu as Ni,cv as _i,cw as wi,cx as aa,cy as pa,cz as ga,cA as Ci,cB as vs,cC as bs,cD as pt,cE as Si,cF as Pt,cG as ki,cH as Ha,cI as tr,cJ as Ka,cK as Dt,cL as Ti,cM as Pi,cN as Di,cO as Ei,cP as ar,cQ as Ri,cR as Ii,cS as nr,cT as na,cU as rr,cV as Vi,cW as lr,cX as or,cY as Fi,cZ as Mi,c_ as Oi,c$ as zi,d0 as Li}from"./vendor.js";import"./index.js";var Lh=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 Ai(s){if(s.__esModule)return s;var n=s.default;if(typeof n=="function"){var a=function l(){return this instanceof l?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};a.prototype=n.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(s).forEach(function(l){var r=Object.getOwnPropertyDescriptor(s,l);Object.defineProperty(a,l,r.get?r:{enumerable:!0,get:function(){return s[l]}})}),a}const $i={theme:"system",setTheme:()=>null},ir=u.createContext($i);function qi({children:s,defaultTheme:n="system",storageKey:a="vite-ui-theme",...l}){const[r,c]=u.useState(()=>localStorage.getItem(a)||n);u.useEffect(()=>{const m=window.document.documentElement;if(m.classList.remove("light","dark"),r==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";m.classList.add(x);return}m.classList.add(r)},[r]);const i={theme:r,setTheme:m=>{localStorage.setItem(a,m),c(m)}};return e.jsx(ir.Provider,{...l,value:i,children:s})}const Hi=()=>{const s=u.useContext(ir);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Ki=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),Ui=function(s,n){return new URL(s,n).href},Ua={},ce=function(n,a,l){let r=Promise.resolve();if(a&&a.length>0){const i=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),x=m?.nonce||m?.getAttribute("nonce");r=Promise.allSettled(a.map(o=>{if(o=Ui(o,l),o in Ua)return;Ua[o]=!0;const d=o.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(!!l)for(let f=i.length-1;f>=0;f--){const j=i[f];if(j.href===o&&(!d||j.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${p}`))return;const I=document.createElement("link");if(I.rel=d?"stylesheet":Ki,d||(I.as="script"),I.crossOrigin="",I.href=o,x&&I.setAttribute("nonce",x),document.head.appendChild(I),d)return new Promise((f,j)=>{I.addEventListener("load",f),I.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${o}`)))})}))}function c(i){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=i,window.dispatchEvent(m),!m.defaultPrevented)throw i}return r.then(i=>{for(const m of i||[])m.status==="rejected"&&c(m.reason);return n().catch(c)})};function N(...s){return gl(jl(s))}const Xs=Os("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"}}),R=u.forwardRef(({className:s,variant:n,size:a,asChild:l=!1,children:r,disabled:c,loading:i=!1,leftSection:m,rightSection:x,...o},d)=>{const p=l?ia:"button";return e.jsxs(p,{className:N(Xs({variant:n,size:a,className:s})),disabled:i||c,ref:d,...o,children:[(m&&i||!m&&!x&&i)&&e.jsx(Oa,{className:"mr-2 h-4 w-4 animate-spin"}),!i&&m&&e.jsx("div",{className:"mr-2",children:m}),r,!i&&x&&e.jsx("div",{className:"ml-2",children:x}),x&&i&&e.jsx(Oa,{className:"ml-2 h-4 w-4 animate-spin"})]})});R.displayName="Button";function Us({className:s,minimal:n=!1}){const a=js();return e.jsx("div",{className:N("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",{})," Please try again later."]}),!n&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(R,{variant:"outline",onClick:()=>a(-1),children:"Go Back"}),e.jsx(R,{onClick:()=>a("/"),children:"Back to Home"})]})]})})}function Ba(){const s=js();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(R,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(R,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function Bi(){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(R,{variant:"outline",children:"Learn more"})})]})})}function Gi(s){return typeof s>"u"}function Wi(s){return s===null}function Yi(s){return Wi(s)||Gi(s)}class Qi{storage;prefixKey;constructor(n){this.storage=n.storage,this.prefixKey=n.prefixKey}getKey(n){return`${this.prefixKey}${n}`.toUpperCase()}set(n,a,l=null){const r=JSON.stringify({value:a,time:Date.now(),expire:l!==null?new Date().getTime()+l*1e3:null});this.storage.setItem(this.getKey(n),r)}get(n,a=null){const l=this.storage.getItem(this.getKey(n));if(!l)return{value:a,time:0};try{const r=JSON.parse(l),{value:c,time:i,expire:m}=r;return Yi(m)||m>new Date().getTime()?{value:c,time:i}:(this.remove(n),{value:a,time:0})}catch{return this.remove(n),{value:a,time:0}}}remove(n){this.storage.removeItem(this.getKey(n))}clear(){this.storage.clear()}}function cr({prefixKey:s="",storage:n=sessionStorage}){return new Qi({prefixKey:s,storage:n})}const dr="Xboard_",Ji=function(s={}){return cr({prefixKey:s.prefixKey||"",storage:localStorage})},Zi=function(s={}){return cr({prefixKey:s.prefixKey||"",storage:sessionStorage})},Lt=Ji({prefixKey:dr});Zi({prefixKey:dr});const mr="access_token";function mt(){return Lt.get(mr)}function ur(){Lt.remove(mr)}const Ga=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Xi({children:s}){const n=js(),a=ca(),l=mt();return u.useEffect(()=>{if(!l.value&&!Ga.includes(a.pathname)){const r=encodeURIComponent(a.pathname+a.search);n(`/sign-in?redirect=${r}`)}},[l.value,a.pathname,a.search,n]),Ga.includes(a.pathname)||l.value?e.jsx(e.Fragment,{children:s}):null}const ec=()=>e.jsx(Xi,{children:e.jsx(da,{})}),sc=vl([{path:"/sign-in",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Sc);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(ec,{}),children:[{path:"/",lazy:async()=>({Component:(await ce(()=>Promise.resolve().then(()=>Fc),void 0,import.meta.url)).default}),errorElement:e.jsx(Us,{}),children:[{index:!0,lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>rm);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Us,{}),children:[{path:"system",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>cm);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>xm);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>jm);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>_m);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Tm);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Im);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>zm);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Hm);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Wm);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Xm);return{default:s}},void 0,import.meta.url)).default})}]},{path:"payment",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>cu);return{default:s}},void 0,import.meta.url)).default})},{path:"plugin",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>uu);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>pu);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>_u);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Eu);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Us,{}),children:[{path:"manage",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>tx);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>ox);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>xx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Us,{}),children:[{path:"plan",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Nx);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Mx);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Ux);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Us,{}),children:[{path:"manage",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>ph);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await ce(async()=>{const{default:s}=await Promise.resolve().then(()=>Mh);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Us},{path:"/404",Component:Ba},{path:"/503",Component:Bi},{path:"*",Component:Ba}]),tc="locale";function ac(){return Lt.get(tc)}function xr(){ur();const s=window.location.pathname,n=s&&!["/404","/sign-in"].includes(s),a=new URL(window.location.href),r=`${a.pathname.split("/")[1]?`/${a.pathname.split("/")[1]}`:""}#/sign-in`;window.location.href=r+(n?`?redirect=${s}`:"")}const nc=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function rc(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const V=bl.create({baseURL:rc(),timeout:12e3,headers:{"Content-Type":"application/json"}});V.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const n=mt();if(!nc.includes(s.url?.split("?")[0]||"")){if(!n.value)return xr(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=n.value}return s.headers["Content-Language"]=ac().value||"zh-CN",s},s=>Promise.reject(s));V.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const n=s.response?.status,a=s.response?.data?.message;return(n===401||n===403)&&xr(),A.error(a||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[n]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});function lc(){return V.get("/user/info")}const Ut={token:mt()?.value||"",userInfo:null,isLoggedIn:!!mt()?.value,loading:!1,error:null},it=yl("user/fetchUserInfo",async()=>(await lc()).data,{condition:(s,{getState:n})=>{const{user:a}=n();return!!a.token&&!a.loading}}),hr=Nl({name:"user",initialState:Ut,reducers:{setToken(s,n){s.token=n.payload,s.isLoggedIn=!!n.payload},resetUserState:()=>Ut},extraReducers:s=>{s.addCase(it.pending,n=>{n.loading=!0,n.error=null}).addCase(it.fulfilled,(n,a)=>{n.loading=!1,n.userInfo=a.payload,n.error=null}).addCase(it.rejected,(n,a)=>{if(n.loading=!1,n.error=a.error.message||"Failed to fetch user info",!n.token)return Ut})}}),{setToken:oc,resetUserState:ic}=hr.actions,cc=s=>s.user.userInfo,dc=hr.reducer,fr=_l({reducer:{user:dc}});mt()?.value&&fr.dispatch(it());wl.use(Cl).use(Sl).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 mc=new kl;Tl.createRoot(document.getElementById("root")).render(e.jsx(Pl.StrictMode,{children:e.jsx(Dl,{client:mc,children:e.jsx(El,{store:fr,children:e.jsxs(qi,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(Rl,{router:sc}),e.jsx(Il,{richColors:!0,position:"top-right"})]})})})}));const Ae=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("rounded-xl border bg-card text-card-foreground shadow",s),...n}));Ae.displayName="Card";const Ge=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("flex flex-col space-y-1.5 p-6",s),...n}));Ge.displayName="CardHeader";const ps=u.forwardRef(({className:s,...n},a)=>e.jsx("h3",{ref:a,className:N("font-semibold leading-none tracking-tight",s),...n}));ps.displayName="CardTitle";const Qs=u.forwardRef(({className:s,...n},a)=>e.jsx("p",{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Qs.displayName="CardDescription";const We=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("p-6 pt-0",s),...n}));We.displayName="CardContent";const uc=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("flex items-center p-6 pt-0",s),...n}));uc.displayName="CardFooter";const xc=Os("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Et=u.forwardRef(({className:s,...n},a)=>e.jsx(ln,{ref:a,className:N(xc(),s),...n}));Et.displayName=ln.displayName;const je=Vl,pr=u.createContext({}),b=({...s})=>e.jsx(pr.Provider,{value:{name:s.name},children:e.jsx(Fl,{...s})}),At=()=>{const s=u.useContext(pr),n=u.useContext(gr),{getFieldState:a,formState:l}=Ml(),r=a(s.name,l);if(!s)throw new Error("useFormField should be used within ");const{id:c}=n;return{id:c,name:s.name,formItemId:`${c}-form-item`,formDescriptionId:`${c}-form-item-description`,formMessageId:`${c}-form-item-message`,...r}},gr=u.createContext({}),v=u.forwardRef(({className:s,...n},a)=>{const l=u.useId();return e.jsx(gr.Provider,{value:{id:l},children:e.jsx("div",{ref:a,className:N("space-y-2",s),...n})})});v.displayName="FormItem";const y=u.forwardRef(({className:s,...n},a)=>{const{error:l,formItemId:r}=At();return e.jsx(Et,{ref:a,className:N(l&&"text-destructive",s),htmlFor:r,...n})});y.displayName="FormLabel";const _=u.forwardRef(({...s},n)=>{const{error:a,formItemId:l,formDescriptionId:r,formMessageId:c}=At();return e.jsx(ia,{ref:n,id:l,"aria-describedby":a?`${r} ${c}`:`${r}`,"aria-invalid":!!a,...s})});_.displayName="FormControl";const M=u.forwardRef(({className:s,...n},a)=>{const{formDescriptionId:l}=At();return e.jsx("p",{ref:a,id:l,className:N("text-[0.8rem] text-muted-foreground",s),...n})});M.displayName="FormDescription";const E=u.forwardRef(({className:s,children:n,...a},l)=>{const{error:r,formMessageId:c}=At(),i=r?String(r?.message):n;return i?e.jsx("p",{ref:l,id:c,className:N("text-[0.8rem] font-medium text-destructive",s),...a,children:i}):null});E.displayName="FormMessage";const D=u.forwardRef(({className:s,type:n,...a},l)=>e.jsx("input",{type:n,className:N("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,...a}));D.displayName="Input";const jr=u.forwardRef(({className:s,...n},a)=>{const[l,r]=u.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:l?"text":"password",className:N("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...n}),e.jsx(R,{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:()=>r(c=>!c),children:l?e.jsx(Ol,{size:18}):e.jsx(zl,{size:18})})]})});jr.displayName="PasswordInput";const hc=s=>V({url:"/passport/auth/login",method:"post",data:s});function fe(s=void 0,n="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),Ll(s).format(n))}function fc(s=void 0,n="YYYY-MM-DD"){return fe(s,n)}function Ws(s){const n=typeof s=="string"?parseFloat(s):s;return isNaN(n)?"0.00":n.toFixed(2)}function Fs(s,n=!0){if(s==null)return n?"¥0.00":"0.00";const a=typeof s=="string"?parseFloat(s):s;if(isNaN(a))return n?"¥0.00":"0.00";const r=(a/100).toFixed(2).replace(/\.?0+$/,c=>c.includes(".")?".00":c);return n?`¥${r}`:r}function Rt(s){return new Promise(n=>{(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 r=document.execCommand("copy");if(document.body.removeChild(l),!r)throw new Error("execCommand failed")}n(!0)}catch(l){console.error(l),n(!1)}})()})}function cs(s){const n=s/1024,a=n/1024,l=a/1024,r=l/1024;return r>=1?Ws(r)+" TB":l>=1?Ws(l)+" GB":a>=1?Ws(a)+" MB":Ws(n)+" KB"}const pc="access_token";function gc(s){Lt.set(pc,s)}function jc({className:s,onForgotPassword:n,...a}){const l=js(),r=on(),{t:c}=F("auth"),i=h.object({email:h.string().min(1,{message:c("signIn.validation.emailRequired")}),password:h.string().min(1,{message:c("signIn.validation.passwordRequired")}).min(7,{message:c("signIn.validation.passwordLength")})}),m=he({resolver:ge(i),defaultValues:{email:"",password:""}});async function x(o){try{const{data:d}=await hc(o);gc(d.auth_data),r(oc(d.auth_data)),await r(it()).unwrap(),l("/")}catch(d){console.error("Login failed:",d),d.response?.data?.message&&m.setError("root",{message:d.response.data.message})}}return e.jsx("div",{className:N("grid gap-6",s),...a,children:e.jsx(je,{...m,children:e.jsx("form",{onSubmit:m.handleSubmit(x),className:"space-y-4",children:e.jsxs("div",{className:"space-y-4",children:[m.formState.errors.root&&e.jsx("div",{className:"text-sm text-destructive",children:m.formState.errors.root.message}),e.jsx(b,{control:m.control,name:"email",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:c("signIn.email")}),e.jsx(_,{children:e.jsx(D,{placeholder:c("signIn.emailPlaceholder"),autoComplete:"email",...o})}),e.jsx(E,{})]})}),e.jsx(b,{control:m.control,name:"password",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:c("signIn.password")}),e.jsx(_,{children:e.jsx(jr,{placeholder:c("signIn.passwordPlaceholder"),autoComplete:"current-password",...o})}),e.jsx(E,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(R,{variant:"link",type:"button",className:"px-0 text-sm font-normal text-muted-foreground hover:text-primary",onClick:n,children:c("signIn.forgotPassword")})}),e.jsx(R,{className:"w-full",size:"lg",loading:m.formState.isSubmitting,children:c("signIn.submit")})]})})})})}const ve=cn,He=dn,vc=mn,gt=ma,vr=u.forwardRef(({className:s,...n},a)=>e.jsx(Vt,{ref:a,className:N("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}));vr.displayName=Vt.displayName;const pe=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(vc,{children:[e.jsx(vr,{}),e.jsxs(Ft,{ref:l,className:N("max-h-[95%] overflow-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...a,children:[n,e.jsxs(ma,{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(Be,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));pe.displayName=Ft.displayName;const Ne=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-1.5 text-center sm:text-left",s),...n});Ne.displayName="DialogHeader";const Ke=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Ke.displayName="DialogFooter";const be=u.forwardRef(({className:s,...n},a)=>e.jsx(Mt,{ref:a,className:N("text-lg font-semibold leading-none tracking-tight",s),...n}));be.displayName=Mt.displayName;const Ee=u.forwardRef(({className:s,...n},a)=>e.jsx(Ot,{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Ee.displayName=Ot.displayName;const Js=Os("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=u.forwardRef(({className:s,variant:n,size:a,asChild:l=!1,...r},c)=>{const i=l?ia:"button";return e.jsx(i,{className:N(Js({variant:n,size:a,className:s})),ref:c,...r})});B.displayName="Button";const Ds=ql,Es=Hl,bc=Kl,yc=u.forwardRef(({className:s,inset:n,children:a,...l},r)=>e.jsxs(un,{ref:r,className:N("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),...l,children:[a,e.jsx(ua,{className:"ml-auto h-4 w-4"})]}));yc.displayName=un.displayName;const Nc=u.forwardRef(({className:s,...n},a)=>e.jsx(xn,{ref:a,className:N("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}));Nc.displayName=xn.displayName;const gs=u.forwardRef(({className:s,sideOffset:n=4,...a},l)=>e.jsx(Al,{children:e.jsx(hn,{ref:l,sideOffset:n,className:N("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a})}));gs.displayName=hn.displayName;const ye=u.forwardRef(({className:s,inset:n,...a},l)=>e.jsx(fn,{ref:l,className:N("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),...a}));ye.displayName=fn.displayName;const _c=u.forwardRef(({className:s,children:n,checked:a,...l},r)=>e.jsxs(pn,{ref:r,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:a,...l,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(gn,{children:e.jsx(zs,{className:"h-4 w-4"})})}),n]}));_c.displayName=pn.displayName;const wc=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(jn,{ref:l,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(gn,{children:e.jsx($l,{className:"h-4 w-4 fill-current"})})}),n]}));wc.displayName=jn.displayName;const ja=u.forwardRef(({className:s,inset:n,...a},l)=>e.jsx(vn,{ref:l,className:N("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",s),...a}));ja.displayName=vn.displayName;const ut=u.forwardRef(({className:s,...n},a)=>e.jsx(bn,{ref:a,className:N("-mx-1 my-1 h-px bg-muted",s),...n}));ut.displayName=bn.displayName;const ra=({className:s,...n})=>e.jsx("span",{className:N("ml-auto text-xs tracking-widest opacity-60",s),...n});ra.displayName="DropdownMenuShortcut";const Bt=[{code:"en-US",name:"English",flag:Ul,shortName:"EN"},{code:"zh-CN",name:"中文",flag:Bl,shortName:"CN"},{code:"ko-KR",name:"한국어",flag:Gl,shortName:"KR"}];function br(){const{i18n:s}=F(),n=r=>{s.changeLanguage(r)},a=Bt.find(r=>r.code===s.language)||Bt[1],l=a.flag;return e.jsxs(Ds,{children:[e.jsx(Es,{asChild:!0,children:e.jsxs(B,{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:a.shortName})]})}),e.jsx(gs,{align:"end",className:"w-[120px]",children:Bt.map(r=>{const c=r.flag,i=r.code===s.language;return e.jsxs(ye,{onClick:()=>n(r.code),className:N("flex items-center gap-2 px-2 py-1.5 cursor-pointer",i&&"bg-accent"),children:[e.jsx(c,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:N("text-sm",i&&"font-medium"),children:r.name})]},r.code)})})]})}function Cc(){const[s,n]=u.useState(!1),{t:a}=F("auth"),l=a("signIn.resetPassword.command");return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"container relative grid h-svh flex-col items-center justify-center bg-primary-foreground 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(br,{})}),e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[480px] lg:p-8",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-center",children:[e.jsx("h1",{className:"text-3xl font-bold",children:window?.settings?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:window?.settings?.description})]}),e.jsxs(Ae,{className:"p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:a("signIn.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("signIn.description")})]}),e.jsx(jc,{onForgotPassword:()=>n(!0)})]})]})]}),e.jsx(ve,{open:s,onOpenChange:n,children:e.jsx(pe,{children:e.jsxs(Ne,{children:[e.jsx(be,{children:a("signIn.resetPassword.title")}),e.jsx(Ee,{children:a("signIn.resetPassword.description")}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"rounded-md bg-secondary p-4 pr-12 text-sm",children:l}),e.jsx(B,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>Rt(l).then(()=>{A.success(a("common:copy.success"))}),children:e.jsx(Wl,{className:"h-4 w-4"})})]})})]})})})]})}const Sc=Object.freeze(Object.defineProperty({__proto__:null,default:Cc},Symbol.toStringTag,{value:"Module"})),ke=u.forwardRef(({className:s,fadedBelow:n=!1,fixedHeight:a=!1,...l},r)=>e.jsx("div",{ref:r,className:N("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",a&&"md:h-svh",s),...l}));ke.displayName="Layout";const Te=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...n}));Te.displayName="LayoutHeader";const Re=u.forwardRef(({className:s,fixedHeight:n,...a},l)=>e.jsx("div",{ref:l,className:N("flex-1 overflow-hidden px-4 py-6 md:px-8",n&&"h-[calc(100%-var(--header-height))]",s),...a}));Re.displayName="LayoutBody";const yr=Yl,Nr=Ql,_r=Jl,xe=Zl,me=Xl,ue=eo,oe=u.forwardRef(({className:s,sideOffset:n=4,...a},l)=>e.jsx(yn,{ref:l,sideOffset:n,className:N("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a}));oe.displayName=yn.displayName;function $t(){const{pathname:s}=ca();return{checkActiveNav:a=>{if(a==="/"&&s==="/")return!0;const l=a.replace(/^\//,""),r=s.replace(/^\//,"");return l?r.startsWith(l):!1}}}function wr({key:s,defaultValue:n}){const[a,l]=u.useState(()=>{const r=localStorage.getItem(s);return r!==null?JSON.parse(r):n});return u.useEffect(()=>{localStorage.setItem(s,JSON.stringify(a))},[a,s]),[a,l]}function kc(){const[s,n]=wr({key:"collapsed-sidebar-items",defaultValue:[]}),a=r=>!s.includes(r);return{isExpanded:a,toggleItem:r=>{a(r)?n([...s,r]):n(s.filter(c=>c!==r))}}}function Tc({links:s,isCollapsed:n,className:a,closeNav:l}){const{t:r}=F(),c=({sub:i,...m})=>{const x=`${r(m.title)}-${m.href}`;return n&&i?u.createElement(Ec,{...m,sub:i,key:x,closeNav:l}):n?u.createElement(Dc,{...m,key:x,closeNav:l}):i?u.createElement(Pc,{...m,sub:i,key:x,closeNav:l}):u.createElement(Cr,{...m,key:x,closeNav:l})};return e.jsx("div",{"data-collapsed":n,className:N("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",a),children:e.jsx(xe,{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(c)})})})}function Cr({title:s,icon:n,label:a,href:l,closeNav:r,subLink:c=!1}){const{checkActiveNav:i}=$t(),{t:m}=F();return e.jsxs(Ls,{to:l,onClick:r,className:N(Xs({variant:i(l)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",c&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":i(l)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:n}),m(s),a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:m(a)})]})}function Pc({title:s,icon:n,label:a,sub:l,closeNav:r}){const{checkActiveNav:c}=$t(),{isExpanded:i,toggleItem:m}=kc(),{t:x}=F(),o=!!l?.find(k=>c(k.href)),d=x(s),p=i(d)||o;return e.jsxs(yr,{open:p,onOpenChange:()=>m(d),children:[e.jsxs(Nr,{className:N(Xs({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}),x(s),a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:x(a)}),e.jsx("span",{className:N('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(Nn,{stroke:1})})]}),e.jsx(_r,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:l.map(k=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(Cr,{...k,subLink:!0,closeNav:r})},x(k.title)))})})]})}function Dc({title:s,icon:n,label:a,href:l,closeNav:r}){const{checkActiveNav:c}=$t(),{t:i}=F();return e.jsxs(me,{delayDuration:0,children:[e.jsx(ue,{asChild:!0,children:e.jsxs(Ls,{to:l,onClick:r,className:N(Xs({variant:c(l)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[n,e.jsx("span",{className:"sr-only",children:i(s)})]})}),e.jsxs(oe,{side:"right",className:"flex items-center gap-4",children:[i(s),a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:i(a)})]})]})}function Ec({title:s,icon:n,label:a,sub:l,closeNav:r}){const{checkActiveNav:c}=$t(),{t:i}=F(),m=!!l?.find(x=>c(x.href));return e.jsxs(Ds,{children:[e.jsxs(me,{delayDuration:0,children:[e.jsx(ue,{asChild:!0,children:e.jsx(Es,{asChild:!0,children:e.jsx(R,{variant:m?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:n})})}),e.jsxs(oe,{side:"right",className:"flex items-center gap-4",children:[i(s)," ",a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:i(a)}),e.jsx(Nn,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(gs,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(ja,{children:[i(s)," ",a?`(${i(a)})`:""]}),e.jsx(ut,{}),l.map(({title:x,icon:o,label:d,href:p})=>e.jsx(ye,{asChild:!0,children:e.jsxs(Ls,{to:p,onClick:r,className:`${c(p)?"bg-secondary":""}`,children:[o," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:i(x)}),d&&e.jsx("span",{className:"ml-auto text-xs",children:i(d)})]})},`${i(x)}-${p}`))]})]})}const Sr=[{title:"nav:dashboard",label:"",href:"/",icon:e.jsx(so,{size:18})},{title:"nav:systemManagement",label:"",href:"",icon:e.jsx(to,{size:18}),sub:[{title:"nav:systemConfig",label:"",href:"/config/system",icon:e.jsx(_n,{size:18})},{title:"nav:pluginManagement",label:"",href:"/config/plugin",icon:e.jsx(xa,{size:18})},{title:"nav:themeConfig",label:"",href:"/config/theme",icon:e.jsx(ao,{size:18})},{title:"nav:noticeManagement",label:"",href:"/config/notice",icon:e.jsx(no,{size:18})},{title:"nav:paymentConfig",label:"",href:"/config/payment",icon:e.jsx(za,{size:18})},{title:"nav:knowledgeManagement",label:"",href:"/config/knowledge",icon:e.jsx(ro,{size:18})}]},{title:"nav:nodeManagement",label:"",href:"",icon:e.jsx(wn,{size:18}),sub:[{title:"nav:nodeManagement",label:"",href:"/server/manage",icon:e.jsx(lo,{size:18})},{title:"nav:permissionGroupManagement",label:"",href:"/server/group",icon:e.jsx(Cn,{size:18})},{title:"nav:routeManagement",label:"",href:"/server/route",icon:e.jsx(oo,{size:18})}]},{title:"nav:subscriptionManagement",label:"",href:"",icon:e.jsx(io,{size:18}),sub:[{title:"nav:planManagement",label:"",href:"/finance/plan",icon:e.jsx(co,{size:18})},{title:"nav:orderManagement",label:"",href:"/finance/order",icon:e.jsx(za,{size:18})},{title:"nav:couponManagement",label:"",href:"/finance/coupon",icon:e.jsx(mo,{size:18})}]},{title:"nav:userManagement",label:"",href:"",icon:e.jsx(uo,{size:18}),sub:[{title:"nav:userManagement",label:"",href:"/user/manage",icon:e.jsx(xo,{size:18})},{title:"nav:ticketManagement",label:"",href:"/user/ticket",icon:e.jsx(Sn,{size:18})}]}];function Rc({className:s,isCollapsed:n,setIsCollapsed:a}){const[l,r]=u.useState(!1),{t:c}=F();return u.useEffect(()=>{l?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[l]),e.jsxs("aside",{className:N(`fixed left-0 right-0 top-0 z-50 w-full border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${n?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>r(!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(ke,{children:[e.jsxs(Te,{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(R,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":c("common:toggleNavigation"),"aria-controls":"sidebar-menu","aria-expanded":l,onClick:()=>r(i=>!i),children:l?e.jsx(ho,{}):e.jsx(fo,{})})]}),e.jsx(Tc,{id:"sidebar-menu",className:`h-full flex-1 overflow-auto ${l?"max-h-screen":"max-h-0 py-0 md:max-h-screen md:py-2"}`,closeNav:()=>r(!1),isCollapsed:n,links:Sr}),e.jsx("div",{className:N("px-4 py-3 text-xs text-muted-foreground/70 border-t border-border/50 bg-muted/20","transition-all duration-200 ease-in-out",n?"text-center":"text-left"),children:e.jsxs("div",{className:N("flex items-center gap-1.5",n?"justify-center":"justify-start"),children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-green-500/70"}),e.jsxs("span",{className:"tracking-wide",children:["v",window?.settings?.version]})]})}),e.jsx(R,{onClick:()=>a(i=>!i),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex","aria-label":c("common:toggleSidebar"),children:e.jsx(po,{stroke:1.5,className:`h-5 w-5 ${n?"rotate-180":""}`})})]})]})}function Ic(){const[s,n]=wr({key:"collapsed-sidebar",defaultValue:!1});return u.useEffect(()=>{const a=()=>{n(window.innerWidth<768?!1:s)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[s,n]),[s,n]}function Vc(){const[s,n]=Ic();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(Rc,{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(da,{})})]})}const Fc=Object.freeze(Object.defineProperty({__proto__:null,default:Vc},Symbol.toStringTag,{value:"Module"})),Rs=u.forwardRef(({className:s,...n},a)=>e.jsx(Ve,{ref:a,className:N("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...n}));Rs.displayName=Ve.displayName;const Mc=({children:s,...n})=>e.jsx(ve,{...n,children:e.jsx(pe,{className:"overflow-hidden p-0",children:e.jsx(Rs,{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})})}),$s=u.forwardRef(({className:s,...n},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(go,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Ve.Input,{ref:a,className:N("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})]}));$s.displayName=Ve.Input.displayName;const Is=u.forwardRef(({className:s,...n},a)=>e.jsx(Ve.List,{ref:a,className:N("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...n}));Is.displayName=Ve.List.displayName;const qs=u.forwardRef((s,n)=>e.jsx(Ve.Empty,{ref:n,className:"py-6 text-center text-sm",...s}));qs.displayName=Ve.Empty.displayName;const $e=u.forwardRef(({className:s,...n},a)=>e.jsx(Ve.Group,{ref:a,className:N("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}));$e.displayName=Ve.Group.displayName;const et=u.forwardRef(({className:s,...n},a)=>e.jsx(Ve.Separator,{ref:a,className:N("-mx-1 h-px bg-border",s),...n}));et.displayName=Ve.Separator.displayName;const De=u.forwardRef(({className:s,...n},a)=>e.jsx(Ve.Item,{ref:a,className:N("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}));De.displayName=Ve.Item.displayName;function Oc(){const s=[];for(const n of Sr)if(n.href&&s.push(n),n.sub)for(const a of n.sub)s.push({...a,parent:n.title});return s}function ze(){const[s,n]=u.useState(!1),a=js(),l=Oc(),{t:r}=F("search"),{t:c}=F("nav");u.useEffect(()=>{const m=x=>{x.key==="k"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),n(o=>!o))};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[]);const i=u.useCallback(m=>{n(!1),a(m)},[a]);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(kn,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:r("placeholder")}),e.jsx("span",{className:"sr-only",children:r("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:r("shortcut.key")})]}),e.jsxs(Mc,{open:s,onOpenChange:n,children:[e.jsx($s,{placeholder:r("placeholder")}),e.jsxs(Is,{children:[e.jsx(qs,{children:r("noResults")}),e.jsx($e,{heading:r("title"),children:l.map(m=>e.jsxs(De,{value:`${m.parent?m.parent+" ":""}${m.title}`,onSelect:()=>i(m.href),children:[e.jsx("div",{className:"mr-2",children:m.icon}),e.jsx("span",{children:c(m.title)}),m.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c(m.parent)})]},m.href))})]})]})]})}function Fe(){const{theme:s,setTheme:n}=Hi();return u.useEffect(()=>{const a=s==="dark"?"#020817":"#fff",l=document.querySelector("meta[name='theme-color']");l&&l.setAttribute("content",a)},[s]),e.jsxs(e.Fragment,{children:[e.jsx(R,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>n(s==="light"?"dark":"light"),children:s==="light"?e.jsx(jo,{size:20}):e.jsx(vo,{size:20})}),e.jsx(br,{})]})}const kr=u.forwardRef(({className:s,...n},a)=>e.jsx(Tn,{ref:a,className:N("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...n}));kr.displayName=Tn.displayName;const Tr=u.forwardRef(({className:s,...n},a)=>e.jsx(Pn,{ref:a,className:N("aspect-square h-full w-full",s),...n}));Tr.displayName=Pn.displayName;const Pr=u.forwardRef(({className:s,...n},a)=>e.jsx(Dn,{ref:a,className:N("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...n}));Pr.displayName=Dn.displayName;function Me(){const s=js(),n=on(),a=bo(cc),{t:l}=F(["common"]),r=()=>{ur(),n(ic()),s("/sign-in")},c=a?.email?.split("@")[0]||l("common:user"),i=c.substring(0,2).toUpperCase();return e.jsxs(Ds,{children:[e.jsx(Es,{asChild:!0,children:e.jsx(R,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(kr,{className:"h-8 w-8",children:[e.jsx(Tr,{src:a?.avatar_url,alt:c}),e.jsx(Pr,{children:i})]})})}),e.jsxs(gs,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(ja,{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:c}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:a?.email||l("common:defaultEmail")})]})}),e.jsx(ut,{}),e.jsx(ye,{asChild:!0,children:e.jsxs(Ls,{to:"/config/system",children:[l("common:settings"),e.jsx(ra,{children:"⌘S"})]})}),e.jsx(ut,{}),e.jsxs(ye,{onClick:r,children:[l("common:logout"),e.jsx(ra,{children:"⇧⌘Q"})]})]})]})}const H=window?.settings?.secure_path,zc=s=>V.get(H+"/stat/getOrder",{params:s}),Lc=()=>V.get(H+"/stat/getStats"),Wa=s=>V.get(H+"/stat/getTrafficRank",{params:s}),Ac=()=>V.get(H+"/theme/getThemes"),$c=s=>V.post(H+"/theme/getThemeConfig",{name:s}),qc=(s,n)=>V.post(H+"/theme/saveThemeConfig",{name:s,config:n}),Hc=s=>{const n=new FormData;return n.append("file",s),V.post(H+"/theme/upload",n,{headers:{"Content-Type":"multipart/form-data"}})},Kc=s=>V.post(H+"/theme/delete",{name:s}),Uc=s=>V.post(H+"/config/save",s),Dr=()=>V.get(H+"/server/manage/getNodes"),Bc=s=>V.post(H+"/server/manage/save",s),Gc=s=>V.post(H+"/server/manage/drop",s),Wc=s=>V.post(H+"/server/manage/copy",s),Yc=s=>V.post(H+"/server/manage/update",s),Qc=s=>V.post(H+"/server/manage/sort",s),qt=()=>V.get(H+"/server/group/fetch"),Jc=s=>V.post(H+"/server/group/save",s),Zc=s=>V.post(H+"/server/group/drop",s),Er=()=>V.get(H+"/server/route/fetch"),Xc=s=>V.post(H+"/server/route/save",s),ed=s=>V.post(H+"/server/route/drop",s),sd=()=>V.get(H+"/payment/fetch"),td=()=>V.get(H+"/payment/getPaymentMethods"),ad=s=>V.post(H+"/payment/getPaymentForm",s),nd=s=>V.post(H+"/payment/save",s),rd=s=>V.post(H+"/payment/drop",s),ld=s=>V.post(H+"/payment/show",s),od=s=>V.post(H+"/payment/sort",s),id=s=>V.post(H+"/notice/save",s),cd=s=>V.post(H+"/notice/drop",s),dd=s=>V.post(H+"/notice/show",s),md=()=>V.get(H+"/knowledge/fetch"),ud=s=>V.get(H+"/knowledge/fetch?id="+s),xd=s=>V.post(H+"/knowledge/save",s),hd=s=>V.post(H+"/knowledge/drop",s),fd=s=>V.post(H+"/knowledge/show",s),pd=s=>V.post(H+"/knowledge/sort",s),Hs=()=>V.get(H+"/plan/fetch"),gd=s=>V.post(H+"/plan/save",s),Gt=s=>V.post(H+"/plan/update",s),jd=s=>V.post(H+"/plan/drop",s),vd=s=>V.post(H+"/plan/sort",{ids:s}),bd=async s=>V.post(H+"/order/fetch",s),yd=s=>V.post(H+"/order/detail",s),Nd=s=>V.post(H+"/order/paid",s),_d=s=>V.post(H+"/order/cancel",s),Ya=s=>V.post(H+"/order/update",s),wd=s=>V.post(H+"/order/assign",s),Cd=s=>V.post(H+"/coupon/fetch",s),Sd=s=>V.post(H+"/coupon/generate",s),kd=s=>V.post(H+"/coupon/drop",s),Td=s=>V.post(H+"/coupon/update",s),Pd=s=>V.post(H+"/user/fetch",s),Dd=s=>V.post(H+"/user/update",s),Ed=s=>V.post(H+"/user/resetSecret",s),Rd=s=>V.post(H+"/user/generate",s),Id=s=>V.post(H+"/stat/getStatUser",s),Vd=s=>V.post(H+"/ticket/fetch",s),Fd=s=>V.get(H+"/ticket/fetch?id= "+s),Md=s=>V.post(H+"/ticket/close",{id:s}),ys=(s="")=>V.get(H+"/config/fetch?key="+s),Ns=s=>V.post(H+"/config/save",s),Od=()=>V.get(H+"/config/getEmailTemplate"),zd=()=>V.post(H+"/config/testSendMail"),Ld=()=>V.post(H+"/config/setTelegramWebhook"),va=yo,Ht=u.forwardRef(({className:s,...n},a)=>e.jsx(En,{ref:a,className:N("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...n}));Ht.displayName=En.displayName;const Ts=u.forwardRef(({className:s,...n},a)=>e.jsx(Rn,{ref:a,className:N("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}));Ts.displayName=Rn.displayName;const St=u.forwardRef(({className:s,...n},a)=>e.jsx(In,{ref:a,className:N("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...n}));St.displayName=In.displayName;const J=No,ws=Do,Z=_o,W=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(Vn,{ref:l,className:N("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...a,children:[n,e.jsx(wo,{asChild:!0,children:e.jsx(ha,{className:"h-4 w-4 opacity-50"})})]}));W.displayName=Vn.displayName;const Rr=u.forwardRef(({className:s,...n},a)=>e.jsx(Fn,{ref:a,className:N("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(Co,{className:"h-4 w-4"})}));Rr.displayName=Fn.displayName;const Ir=u.forwardRef(({className:s,...n},a)=>e.jsx(Mn,{ref:a,className:N("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(ha,{className:"h-4 w-4"})}));Ir.displayName=Mn.displayName;const Y=u.forwardRef(({className:s,children:n,position:a="popper",...l},r)=>e.jsx(So,{children:e.jsxs(On,{ref:r,className:N("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:a,...l,children:[e.jsx(Rr,{}),e.jsx(ko,{className:N("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(Ir,{})]})}));Y.displayName=On.displayName;const Ad=u.forwardRef(({className:s,...n},a)=>e.jsx(zn,{ref:a,className:N("px-2 py-1.5 text-sm font-semibold",s),...n}));Ad.displayName=zn.displayName;const q=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(Ln,{ref:l,className:N("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(To,{children:e.jsx(zs,{className:"h-4 w-4"})})}),e.jsx(Po,{children:n})]}));q.displayName=Ln.displayName;const $d=u.forwardRef(({className:s,...n},a)=>e.jsx(An,{ref:a,className:N("-mx-1 my-1 h-px bg-muted",s),...n}));$d.displayName=An.displayName;function Ks({className:s,classNames:n,showOutsideDays:a=!0,...l}){return e.jsx(Eo,{showOutsideDays:a,className:N("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:N(Js({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:N("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:N(Js({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:r,...c})=>e.jsx($n,{className:N("h-4 w-4",r),...c}),IconRight:({className:r,...c})=>e.jsx(ua,{className:N("h-4 w-4",r),...c})},...l})}Ks.displayName="Calendar";const ms=Io,us=Vo,ls=u.forwardRef(({className:s,align:n="center",sideOffset:a=4,...l},r)=>e.jsx(Ro,{children:e.jsx(qn,{ref:r,align:n,sideOffset:a,className:N("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})}));ls.displayName=qn.displayName;const Cs={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),qd=({active:s,payload:n,label:a})=>{const{t:l}=F();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:a}),n.map((r,c)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:r.color}}),e.jsxs("span",{className:"text-muted-foreground",children:[l(r.name),":"]}),e.jsx("span",{className:"font-medium",children:r.name.includes(l("dashboard:overview.amount"))?`¥${lt(r.value)}`:l("dashboard:overview.transactions",{count:r.value})})]},c))]}):null},Hd=[{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 a=new Date;if(s==="custom"&&n)return{startDate:n.from,endDate:n.to};let l;switch(s){case"7d":l=es(a,7);break;case"30d":l=es(a,30);break;case"90d":l=es(a,90);break;case"180d":l=es(a,180);break;case"365d":l=es(a,365);break;default:l=es(a,30)}return{startDate:l,endDate:a}};function Ud(){const[s,n]=u.useState("amount"),[a,l]=u.useState("30d"),[r,c]=u.useState({from:es(new Date,7),to:new Date}),{t:i}=F(),{startDate:m,endDate:x}=Kd(a,r),{data:o}=ne({queryKey:["orderStat",{start_date:Xe(m,"yyyy-MM-dd"),end_date:Xe(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:d}=await zc({start_date:Xe(m,"yyyy-MM-dd"),end_date:Xe(x,"yyyy-MM-dd")});return d},refetchInterval:3e4});return e.jsxs(Ae,{children:[e.jsx(Ge,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(ps,{children:i("dashboard:overview.title")}),e.jsxs(Qs,{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:a,onValueChange:d=>l(d),children:[e.jsx(W,{className:"w-[120px]",children:e.jsx(Z,{placeholder:i("dashboard:overview.selectTimeRange")})}),e.jsx(Y,{children:Hd.map(d=>e.jsx(q,{value:d.value,children:i(d.label)},d.value))})]}),a==="custom"&&e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsxs(B,{variant:"outline",className:N("min-w-0 justify-start text-left font-normal",!r&&"text-muted-foreground"),children:[e.jsx(ft,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:r?.from?r.to?e.jsxs(e.Fragment,{children:[Xe(r.from,"yyyy-MM-dd")," -"," ",Xe(r.to,"yyyy-MM-dd")]}):Xe(r.from,"yyyy-MM-dd"):i("dashboard:overview.selectDate")})]})}),e.jsx(ls,{className:"w-auto p-0",align:"end",children:e.jsx(Ks,{mode:"range",defaultMonth:r?.from,selected:{from:r?.from,to:r?.to},onSelect:d=>{d?.from&&d?.to&&c({from:d.from,to:d.to})},numberOfMonths:2})})]})]}),e.jsx(va,{value:s,onValueChange:d=>n(d),children:e.jsxs(Ht,{children:[e.jsx(Ts,{value:"amount",children:i("dashboard:overview.amount")}),e.jsx(Ts,{value:"count",children:i("dashboard:overview.count")})]})})]})]})}),e.jsxs(We,{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:["¥",lt(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")," ¥",lt(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:["¥",lt(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(Mo,{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:Cs.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Cs.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:Cs.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Cs.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(Oo,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>Xe(new Date(d),"MM-dd",{locale:$o})}),e.jsx(zo,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>s==="amount"?`¥${lt(d)}`:i("dashboard:overview.transactions",{count:d})}),e.jsx(Lo,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(Ao,{content:e.jsx(qd,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(La,{type:"monotone",dataKey:"paid_total",name:i("dashboard:overview.orderAmount"),stroke:Cs.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(La,{type:"monotone",dataKey:"commission_total",name:i("dashboard:overview.commissionAmount"),stroke:Cs.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(Aa,{dataKey:"paid_count",name:i("dashboard:overview.orderCount"),fill:Cs.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(Aa,{dataKey:"commission_count",name:i("dashboard:overview.commissionCount"),fill:Cs.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})]})]})}function re({className:s,...n}){return e.jsx("div",{className:N("animate-pulse rounded-md bg-primary/10",s),...n})}function Bd(){return e.jsxs(Ae,{children:[e.jsxs(Ge,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(re,{className:"h-4 w-[120px]"}),e.jsx(re,{className:"h-4 w-4"})]}),e.jsxs(We,{children:[e.jsx(re,{className:"h-8 w-[140px] mb-2"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{className:"h-4 w-4"}),e.jsx(re,{className:"h-4 w-[100px]"})]})]})]})}function Gd(){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(Bd,{},n))})}var se=(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))(se||{});const nt={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},rt={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var ss=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(ss||{}),de=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(de||{});const vt={0:"待确认",1:"发放中",2:"有效",3:"无效"},bt={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var Se=(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))(Se||{});const Wd={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var Ce=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s))(Ce||{});const Ms=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"}],fs={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a"};var Le=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(Le||{});const Yd={1:"按金额优惠",2:"按比例优惠"};var Ps=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(Ps||{}),Ie=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(Ie||{}),ct=(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))(ct||{});function Ss({title:s,value:n,icon:a,trend:l,description:r,onClick:c,highlight:i,className:m}){return e.jsxs(Ae,{className:N("transition-colors",c&&"cursor-pointer hover:bg-muted/50",i&&"border-primary/50",m),onClick:c,children:[e.jsxs(Ge,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ps,{className:"text-sm font-medium",children:s}),a]}),e.jsxs(We,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n}),l?e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(Go,{className:N("h-4 w-4",l.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:N("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:r})]})]})}function Qd({className:s}){const n=js(),{t:a}=F(),{data:l,isLoading:r}=ne({queryKey:["dashboardStats"],queryFn:async()=>(await Lc()).data,refetchInterval:1e3*60*5});if(r||!l)return e.jsx(Gd,{});const c=()=>{const i=new URLSearchParams;i.set("commission_status",de.PENDING.toString()),i.set("status",se.COMPLETED.toString()),i.set("commission_balance","gt:0"),n(`/finance/order?${i.toString()}`)};return e.jsxs("div",{className:N("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx(Ss,{title:a("dashboard:stats.todayIncome"),value:Fs(l.todayIncome),icon:e.jsx(qo,{className:"h-4 w-4 text-emerald-500"}),trend:{value:l.dayIncomeGrowth,label:a("dashboard:stats.vsYesterday"),isPositive:l.dayIncomeGrowth>0}}),e.jsx(Ss,{title:a("dashboard:stats.monthlyIncome"),value:Fs(l.currentMonthIncome),icon:e.jsx(Ho,{className:"h-4 w-4 text-blue-500"}),trend:{value:l.monthIncomeGrowth,label:a("dashboard:stats.vsLastMonth"),isPositive:l.monthIncomeGrowth>0}}),e.jsx(Ss,{title:a("dashboard:stats.pendingTickets"),value:l.ticketPendingTotal,icon:e.jsx(Ko,{className:N("h-4 w-4",l.ticketPendingTotal>0?"text-orange-500":"text-muted-foreground")}),description:l.ticketPendingTotal>0?a("dashboard:stats.hasPendingTickets"):a("dashboard:stats.noPendingTickets"),onClick:()=>n("/user/ticket"),highlight:l.ticketPendingTotal>0}),e.jsx(Ss,{title:a("dashboard:stats.pendingCommission"),value:l.commissionPendingTotal,icon:e.jsx(Uo,{className:N("h-4 w-4",l.commissionPendingTotal>0?"text-blue-500":"text-muted-foreground")}),description:l.commissionPendingTotal>0?a("dashboard:stats.hasPendingCommission"):a("dashboard:stats.noPendingCommission"),onClick:c,highlight:l.commissionPendingTotal>0}),e.jsx(Ss,{title:a("dashboard:stats.monthlyNewUsers"),value:l.currentMonthNewUsers,icon:e.jsx(ea,{className:"h-4 w-4 text-blue-500"}),trend:{value:l.userGrowth,label:a("dashboard:stats.vsLastMonth"),isPositive:l.userGrowth>0}}),e.jsx(Ss,{title:a("dashboard:stats.totalUsers"),value:l.totalUsers,icon:e.jsx(ea,{className:"h-4 w-4 text-muted-foreground"}),description:a("dashboard:stats.activeUsers",{count:l.activeUsers})}),e.jsx(Ss,{title:a("dashboard:stats.monthlyUpload"),value:cs(l.monthTraffic.upload),icon:e.jsx(dt,{className:"h-4 w-4 text-emerald-500"}),description:a("dashboard:stats.todayTraffic",{value:cs(l.todayTraffic.upload)})}),e.jsx(Ss,{title:a("dashboard:stats.monthlyDownload"),value:cs(l.monthTraffic.download),icon:e.jsx(Bo,{className:"h-4 w-4 text-blue-500"}),description:a("dashboard:stats.todayTraffic",{value:cs(l.todayTraffic.download)})})]})}const Zs=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(Hn,{ref:l,className:N("relative overflow-hidden",s),...a,children:[e.jsx(Wo,{className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(It,{}),e.jsx(Yo,{})]}));Zs.displayName=Hn.displayName;const It=u.forwardRef(({className:s,orientation:n="vertical",...a},l)=>e.jsx(Kn,{ref:l,orientation:n,className:N("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),...a,children:e.jsx(Qo,{className:"relative flex-1 rounded-full bg-border"})}));It.displayName=Kn.displayName;const la={today:{getValue:()=>{const s=Zo();return{start:s,end:Xo(s,1)}}},last7days:{getValue:()=>{const s=new Date;return{start:es(s,7),end:s}}},last30days:{getValue:()=>{const s=new Date;return{start:es(s,30),end:s}}},custom:{getValue:()=>null}};function Qa({selectedRange:s,customDateRange:n,onRangeChange:a,onCustomRangeChange:l}){const{t:r}=F(),c={today:r("dashboard:trafficRank.today"),last7days:r("dashboard:trafficRank.last7days"),last30days:r("dashboard:trafficRank.last30days"),custom:r("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:a,children:[e.jsx(W,{className:"w-[120px]",children:e.jsx(Z,{placeholder:r("dashboard:trafficRank.selectTimeRange")})}),e.jsx(Y,{position:"popper",className:"z-50",children:Object.entries(la).map(([i])=>e.jsx(q,{value:i,children:c[i]},i))})]}),s==="custom"&&e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsxs(B,{variant:"outline",className:N("min-w-0 justify-start text-left font-normal",!n&&"text-muted-foreground"),children:[e.jsx(ft,{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:[Xe(n.from,"yyyy-MM-dd")," -"," ",Xe(n.to,"yyyy-MM-dd")]}):Xe(n.from,"yyyy-MM-dd"):e.jsx("span",{children:r("dashboard:trafficRank.selectDateRange")})})]})}),e.jsx(ls,{className:"w-auto p-0",align:"end",children:e.jsx(Ks,{mode:"range",defaultMonth:n?.from,selected:{from:n?.from,to:n?.to},onSelect:i=>{i?.from&&i?.to&&l({from:i.from,to:i.to})},numberOfMonths:2})})]})]})}const Bs=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Jd({className:s}){const{t:n}=F(),[a,l]=u.useState("today"),[r,c]=u.useState({from:es(new Date,7),to:new Date}),[i,m]=u.useState("today"),[x,o]=u.useState({from:es(new Date,7),to:new Date}),d=u.useMemo(()=>a==="custom"?{start:r.from,end:r.to}:la[a].getValue(),[a,r]),p=u.useMemo(()=>i==="custom"?{start:x.from,end:x.to}:la[i].getValue(),[i,x]),{data:k}=ne({queryKey:["nodeTrafficRank",d.start,d.end],queryFn:()=>Wa({type:"node",start_time:_e.round(d.start.getTime()/1e3),end_time:_e.round(d.end.getTime()/1e3)}),refetchInterval:3e4}),{data:I}=ne({queryKey:["userTrafficRank",p.start,p.end],queryFn:()=>Wa({type:"user",start_time:_e.round(p.start.getTime()/1e3),end_time:_e.round(p.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:N("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(Ae,{children:[e.jsx(Ge,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(ps,{className:"flex items-center text-base font-medium",children:[e.jsx(Jo,{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(Qa,{selectedRange:a,customDateRange:r,onRangeChange:l,onCustomRangeChange:c}),e.jsx($a,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(We,{className:"flex-1",children:k?.data?e.jsxs(Zs,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:k.data.map(f=>e.jsx(xe,{delayDuration:200,children:e.jsxs(me,{children:[e.jsx(ue,{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:f.name}),e.jsxs("span",{className:N("ml-2 flex items-center text-xs font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?e.jsx(sa,{className:"mr-1 h-3 w-3"}):e.jsx(ta,{className:"mr-1 h-3 w-3"}),Math.abs(f.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:`${f.value/k.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Bs(f.value)})]})]})})}),e.jsx(oe,{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:Bs(f.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:Bs(f.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:N("font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?"+":"",f.change,"%"]})]})})]})},f.id))}),e.jsx(It,{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(Ae,{children:[e.jsx(Ge,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(ps,{className:"flex items-center text-base font-medium",children:[e.jsx(ea,{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(Qa,{selectedRange:i,customDateRange:x,onRangeChange:m,onCustomRangeChange:o}),e.jsx($a,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(We,{className:"flex-1",children:I?.data?e.jsxs(Zs,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:I.data.map(f=>e.jsx(xe,{children:e.jsxs(me,{children:[e.jsx(ue,{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:f.name}),e.jsxs("span",{className:N("ml-2 flex items-center text-xs font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?e.jsx(sa,{className:"mr-1 h-3 w-3"}):e.jsx(ta,{className:"mr-1 h-3 w-3"}),Math.abs(f.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:`${f.value/I.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Bs(f.value)})]})]})})}),e.jsx(oe,{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:Bs(f.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:Bs(f.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:N("font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?"+":"",f.change,"%"]})]})})]})},f.id))}),e.jsx(It,{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 Zd=Os("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 K({className:s,variant:n,...a}){return e.jsx("div",{className:N(Zd({variant:n}),s),...a})}const le=window?.settings?.secure_path,Vr=5*60*1e3,oa=new Map,Xd=s=>{const n=oa.get(s);return n?Date.now()-n.timestamp>Vr?(oa.delete(s),null):n.data:null},em=(s,n)=>{oa.set(s,{data:n,timestamp:Date.now()})},sm=async(s,n=Vr)=>{const a=Xd(s);if(a)return a;const l=await V.get(s);return em(s,l),l},tm={getList:s=>V.post(`${le}/user/fetch`,s),update:s=>V.post(`${le}/user/update`,s),resetSecret:s=>V.post(`${le}/user/resetSecret`,{id:s}),generate:s=>V.post(`${le}/user/generate`,s),getStats:s=>V.post(`${le}/stat/getStatUser`,s),destroy:s=>V.post(`${le}/user/destroy`,{id:s})},Ja={getList:()=>sm(`${le}/notice/fetch`),save:s=>V.post(`${le}/notice/save`,s),drop:s=>V.post(`${le}/notice/drop`,{id:s}),updateStatus:s=>V.post(`${le}/notice/show`,{id:s}),sort:s=>V.post(`${le}/notice/sort`,{ids:s})},Wt={getList:s=>V.post(`${le}/ticket/fetch`,s),getInfo:s=>V.get(`${le}/ticket/fetch?id=${s}`),reply:s=>V.post(`${le}/ticket/reply`,s),close:s=>V.post(`${le}/ticket/close`,{id:s})},Za={getSystemStatus:()=>V.get(`${le}/system/getSystemStatus`),getQueueStats:()=>V.get(`${le}/system/getQueueStats`),getQueueWorkload:()=>V.get(`${le}/system/getQueueWorkload`),getQueueMasters:()=>V.get(`${le}/system/getQueueMasters`),getSystemLog:s=>V.get(`${le}/system/getSystemLog`,{params:s})},hs={getPluginList:()=>V.get(`${le}/plugin/getPlugins`),uploadPlugin:s=>{const n=new FormData;return n.append("file",s),V.post(`${le}/plugin/upload`,n,{headers:{"Content-Type":"multipart/form-data"}})},deletePlugin:s=>V.post(`${le}/plugin/delete`,{code:s}),installPlugin:s=>V.post(`${le}/plugin/install`,{code:s}),uninstallPlugin:s=>V.post(`${le}/plugin/uninstall`,{code:s}),enablePlugin:s=>V.post(`${le}/plugin/enable`,{code:s}),disablePlugin:s=>V.post(`${le}/plugin/disable`,{code:s}),getPluginConfig:s=>V.get(`${le}/plugin/config`,{params:{code:s}}),updatePluginConfig:(s,n)=>V.post(`${le}/plugin/config`,{code:s,config:n})},kt=u.forwardRef(({className:s,value:n,...a},l)=>e.jsx(Un,{ref:l,className:N("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...a,children:e.jsx(ei,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));kt.displayName=Un.displayName;function am(){const{t:s}=F(),[n,a]=u.useState(null),[l,r]=u.useState(null),[c,i]=u.useState(!0),[m,x]=u.useState(!1),o=async()=>{try{x(!0);const[k,I]=await Promise.all([Za.getSystemStatus(),Za.getQueueStats()]);a(k.data),r(I.data)}catch(k){console.error("Error fetching system data:",k)}finally{i(!1),x(!1)}};u.useEffect(()=>{o();const k=setInterval(o,3e4);return()=>clearInterval(k)},[]);const d=()=>{o()};if(c)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(fa,{className:"h-6 w-6 animate-spin"})});const p=k=>k?e.jsx(Bn,{className:"h-5 w-5 text-green-500"}):e.jsx(Gn,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ae,{children:[e.jsxs(Ge,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(ps,{className:"flex items-center gap-2",children:[e.jsx(si,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Qs,{children:s("dashboard:queue.status.description")})]}),e.jsx(B,{variant:"outline",size:"icon",onClick:d,disabled:m,children:e.jsx(ti,{className:N("h-4 w-4",m&&"animate-spin")})})]}),e.jsx(We,{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:[p(l?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(K,{variant:l?.status?"secondary":"destructive",children:l?.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:l?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(xe,{children:e.jsxs(me,{children:[e.jsx(ue,{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:l?.recentJobs||0}),e.jsx(kt,{value:(l?.recentJobs||0)/(l?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(oe,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:l?.periods?.recentJobs||0})})})]})}),e.jsx(xe,{children:e.jsxs(me,{children:[e.jsx(ue,{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:l?.jobsPerMinute||0}),e.jsx(kt,{value:(l?.jobsPerMinute||0)/(l?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(oe,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:l?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(Ae,{children:[e.jsxs(Ge,{children:[e.jsxs(ps,{className:"flex items-center gap-2",children:[e.jsx(ai,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Qs,{children:s("dashboard:queue.details.description")})]}),e.jsx(We,{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.jsx("p",{className:"text-2xl font-bold text-destructive",children:l?.failedJobs||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("dashboard:queue.details.retentionPeriod",{hours:l?.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:[l?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:l?.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:[l?.processes||0," /"," ",(l?.processes||0)+(l?.pausedMasters||0)]})]}),e.jsx(kt,{value:(l?.processes||0)/((l?.processes||0)+(l?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]})}function nm(){const{t:s}=F();return e.jsxs(ke,{children:[e.jsxs(Te,{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(ze,{}),e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsx(Re,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Qd,{}),e.jsx(Ud,{}),e.jsx(Jd,{}),e.jsx(am,{})]})})})]})}const rm=Object.freeze(Object.defineProperty({__proto__:null,default:nm},Symbol.toStringTag,{value:"Module"})),we=u.forwardRef(({className:s,orientation:n="horizontal",decorative:a=!0,...l},r)=>e.jsx(Wn,{ref:r,decorative:a,orientation:n,className:N("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...l}));we.displayName=Wn.displayName;function lm({className:s,items:n,...a}){const{pathname:l}=ca(),r=js(),[c,i]=u.useState(l??"/settings"),m=o=>{i(o),r(o)},{t:x}=F("settings");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(J,{value:c,onValueChange:m,children:[e.jsx(W,{className:"h-12 sm:w-48",children:e.jsx(Z,{placeholder:"Theme"})}),e.jsx(Y,{children:n.map(o=>e.jsx(q,{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:x(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:N("flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",s),...a,children:n.map(o=>e.jsxs(Ls,{to:o.href,className:N(Xs({variant:"ghost"}),l===o.href?"bg-muted hover:bg-muted":"hover:bg-transparent hover:underline","justify-start"),children:[e.jsx("span",{className:"mr-2",children:o.icon}),x(o.title)]},o.href))})})]})}const om=[{title:"site.title",key:"site",icon:e.jsx(ni,{size:18}),href:"/config/system",description:"site.description"},{title:"safe.title",key:"safe",icon:e.jsx(Cn,{size:18}),href:"/config/system/safe",description:"safe.description"},{title:"subscribe.title",key:"subscribe",icon:e.jsx(Sn,{size:18}),href:"/config/system/subscribe",description:"subscribe.description"},{title:"invite.title",key:"invite",icon:e.jsx(ri,{size:18}),href:"/config/system/invite",description:"invite.description"},{title:"server.title",key:"server",icon:e.jsx(wn,{size:18}),href:"/config/system/server",description:"server.description"},{title:"email.title",key:"email",icon:e.jsx(li,{size:18}),href:"/config/system/email",description:"email.description"},{title:"telegram.title",key:"telegram",icon:e.jsx(oi,{size:18}),href:"/config/system/telegram",description:"telegram.description"},{title:"app.title",key:"app",icon:e.jsx(_n,{size:18}),href:"/config/system/app",description:"app.description"}];function im(){const{t:s}=F("settings");return e.jsxs(ke,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(we,{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(lm,{items:om})}),e.jsx("div",{className:"w-full p-1 pr-4 lg:max-w-xl",children:e.jsx("div",{className:"pb-16",children:e.jsx(da,{})})})]})]})]})}const cm=Object.freeze(Object.defineProperty({__proto__:null,default:im},Symbol.toStringTag,{value:"Module"})),U=u.forwardRef(({className:s,...n},a)=>e.jsx(Yn,{className:N("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:a,children:e.jsx(ii,{className:N("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")})}));U.displayName=Yn.displayName;const _s=u.forwardRef(({className:s,...n},a)=>e.jsx("textarea",{className:N("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...n}));_s.displayName="Textarea";const dm=h.object({logo:h.string().nullable().default(""),force_https:h.number().nullable().default(0),stop_register:h.number().nullable().default(0),app_name:h.string().nullable().default(""),app_description:h.string().nullable().default(""),app_url:h.string().nullable().default(""),subscribe_url:h.string().nullable().default(""),try_out_plan_id:h.number().nullable().default(0),try_out_hour:h.coerce.number().nullable().default(0),tos_url:h.string().nullable().default(""),currency:h.string().nullable().default(""),currency_symbol:h.string().nullable().default("")});function mm(){const{t:s}=F("settings"),[n,a]=u.useState(!1),l=u.useRef(null),{data:r}=ne({queryKey:["settings","site"],queryFn:()=>ys("site")}),{data:c}=ne({queryKey:["plans"],queryFn:()=>Hs()}),i=he({resolver:ge(dm),defaultValues:{},mode:"onBlur"}),{mutateAsync:m}=ds({mutationFn:Ns,onSuccess:d=>{d.data&&A.success(s("common.autoSaved"))}});u.useEffect(()=>{if(r?.data?.site){const d=r?.data?.site;Object.entries(d).forEach(([p,k])=>{i.setValue(p,k)}),l.current=d}},[r]);const x=u.useCallback(_e.debounce(async d=>{if(!_e.isEqual(d,l.current)){a(!0);try{const p=Object.entries(d).reduce((k,[I,f])=>(k[I]=f===null?"":f,k),{});await m(p),l.current=d}finally{a(!1)}}},1e3),[m]),o=u.useCallback(d=>{x(d)},[x]);return u.useEffect(()=>{const d=i.watch(p=>{o(p)});return()=>d.unsubscribe()},[i.watch,o]),e.jsx(je,{...i,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:i.control,name:"app_name",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.siteName.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("site.form.siteName.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(i.getValues())}})}),e.jsx(M,{children:s("site.form.siteName.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:i.control,name:"app_description",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.siteDescription.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("site.form.siteDescription.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(i.getValues())}})}),e.jsx(M,{children:s("site.form.siteDescription.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:i.control,name:"app_url",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.siteUrl.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("site.form.siteUrl.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(i.getValues())}})}),e.jsx(M,{children:s("site.form.siteUrl.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:i.control,name:"force_https",render:({field:d})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("site.form.forceHttps.label")}),e.jsx(M,{children:s("site.form.forceHttps.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:!!d.value,onCheckedChange:p=>{d.onChange(Number(p)),o(i.getValues())}})})]})}),e.jsx(b,{control:i.control,name:"logo",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.logo.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("site.form.logo.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(i.getValues())}})}),e.jsx(M,{children:s("site.form.logo.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:i.control,name:"subscribe_url",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.subscribeUrl.label")}),e.jsx(_,{children:e.jsx(_s,{placeholder:s("site.form.subscribeUrl.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(i.getValues())}})}),e.jsx(M,{children:s("site.form.subscribeUrl.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:i.control,name:"tos_url",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.tosUrl.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("site.form.tosUrl.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(i.getValues())}})}),e.jsx(M,{children:s("site.form.tosUrl.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:i.control,name:"stop_register",render:({field:d})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("site.form.stopRegister.label")}),e.jsx(M,{children:s("site.form.stopRegister.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:!!d.value,onCheckedChange:p=>{d.onChange(Number(p)),o(i.getValues())}})})]})}),e.jsx(b,{control:i.control,name:"try_out_plan_id",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.tryOut.label")}),e.jsx(_,{children:e.jsxs(J,{value:d.value?.toString(),onValueChange:p=>{d.onChange(Number(p)),o(i.getValues())},children:[e.jsx(W,{children:e.jsx(Z,{placeholder:s("site.form.tryOut.placeholder")})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:s("site.form.tryOut.placeholder")}),c?.data?.map(p=>e.jsx(q,{value:p.id.toString(),children:p.name},p.id.toString()))]})]})}),e.jsx(M,{children:s("site.form.tryOut.description")}),e.jsx(E,{})]})}),!!i.watch("try_out_plan_id")&&e.jsx(b,{control:i.control,name:"try_out_hour",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"",children:s("site.form.tryOut.duration.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("site.form.tryOut.duration.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(i.getValues())}})}),e.jsx(M,{children:s("site.form.tryOut.duration.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:i.control,name:"currency",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.currency.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("site.form.currency.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(i.getValues())}})}),e.jsx(M,{children:s("site.form.currency.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:i.control,name:"currency_symbol",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.currencySymbol.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("site.form.currencySymbol.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(i.getValues())}})}),e.jsx(M,{children:s("site.form.currencySymbol.description")}),e.jsx(E,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("site.form.saving")})]})})}function um(){const{t:s}=F("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(we,{}),e.jsx(mm,{})]})}const xm=Object.freeze(Object.defineProperty({__proto__:null,default:um},Symbol.toStringTag,{value:"Module"})),hm=h.object({email_verify:h.boolean().nullable(),safe_mode_enable:h.boolean().nullable(),secure_path:h.string().nullable(),email_whitelist_enable:h.boolean().nullable(),email_whitelist_suffix:h.array(h.string().nullable()).nullable(),email_gmail_limit_enable:h.boolean().nullable(),recaptcha_enable:h.boolean().nullable(),recaptcha_key:h.string().nullable(),recaptcha_site_key:h.string().nullable(),register_limit_by_ip_enable:h.boolean().nullable(),register_limit_count:h.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:h.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:h.boolean().nullable(),password_limit_count:h.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:h.coerce.string().transform(s=>s===""?null:s).nullable()}),fm={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 pm(){const{t:s}=F("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=he({resolver:ge(hm),defaultValues:fm,mode:"onBlur"}),{data:c}=ne({queryKey:["settings","safe"],queryFn:()=>ys("safe")}),{mutateAsync:i}=ds({mutationFn:Ns,onSuccess:o=>{o.data&&A.success(s("common.autoSaved"))}});u.useEffect(()=>{if(c?.data.safe){const o=c.data.safe;Object.entries(o).forEach(([d,p])=>{typeof p=="number"?r.setValue(d,String(p)):r.setValue(d,p)}),l.current=o}},[c]);const m=u.useCallback(_e.debounce(async o=>{if(!_e.isEqual(o,l.current)){a(!0);try{await i(o),l.current=o}finally{a(!1)}}},1e3),[i]),x=u.useCallback(o=>{m(o)},[m]);return u.useEffect(()=>{const o=r.watch(d=>{x(d)});return()=>o.unsubscribe()},[r.watch,x]),e.jsx(je,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"email_verify",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.emailVerify.label")}),e.jsx(M,{children:s("safe.form.emailVerify.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"email_gmail_limit_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.gmailLimit.label")}),e.jsx(M,{children:s("safe.form.gmailLimit.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"safe_mode_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.safeMode.label")}),e.jsx(M,{children:s("safe.form.safeMode.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"secure_path",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.securePath.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.securePath.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(M,{children:s("safe.form.securePath.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"email_whitelist_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.emailWhitelist.label")}),e.jsx(M,{children:s("safe.form.emailWhitelist.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),r.watch("email_whitelist_enable")&&e.jsx(b,{control:r.control,name:"email_whitelist_suffix",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.emailWhitelist.suffixes.label")}),e.jsx(_,{children:e.jsx(_s,{placeholder:s("safe.form.emailWhitelist.suffixes.placeholder"),...o,value:(o.value||[]).join(` +import{r as u,j as e,t as Cl,c as Sl,I as Ha,a as Fs,S as ya,u as Ns,b as Na,d as kl,O as _a,e as Tl,f as $,g as Dl,h as Pl,i as El,k as Rl,B as Il,l as Vl,Q as Ol,m as Ml,R as Fl,n as zl,P as Ll,o as Al,p as $l,q as fn,F as ql,C as Ul,s as Hl,v as Kl,w as Bl,x as Gl,y as pn,z as M,A as h,D as je,E as Ne,G as gn,H as Lt,J as At,K as wa,L as Ye,T as $t,M as qt,N as jn,U as vn,V as bn,W as Ca,X as yn,Y as Wl,Z as Nn,_ as _n,$ as wn,a0 as Cn,a1 as zs,a2 as Sn,a3 as Yl,a4 as kn,a5 as Tn,a6 as Ql,a7 as Jl,a8 as Zl,a9 as Xl,aa as ei,ab as si,ac as ti,ad as ai,ae as ni,af as ri,ag as li,ah as Dn,ai as ii,aj as oi,ak as Ls,al as Pn,am as ci,an as di,ao as En,ap as Sa,aq as mi,ar as ui,as as Ka,at as xi,au as Rn,av as hi,aw as In,ax as fi,ay as pi,az as gi,aA as ji,aB as vi,aC as bi,aD as Vn,aE as yi,aF as Ni,aG as _i,aH as Me,aI as wi,aJ as On,aK as Ci,aL as Si,aM as Mn,aN as Fn,aO as zn,aP as ki,aQ as Ti,aR as Ln,aS as An,aT as $n,aU as Di,aV as Pi,aW as qn,aX as Ei,aY as ka,aZ as Un,a_ as Ri,a$ as Hn,b0 as Ii,b1 as Kn,b2 as Vi,b3 as Bn,b4 as Gn,b5 as Oi,b6 as Mi,b7 as Wn,b8 as Fi,b9 as zi,ba as Yn,bb as Li,bc as Qn,bd as Ai,be as $i,bf as ts,bg as ie,bh as ss,bi as pt,bj as qi,bk as Ui,bl as Hi,bm as Ki,bn as Bi,bo as Gi,bp as Ba,bq as Ga,br as Wi,bs as Yi,bt as Qi,bu as Ji,bv as Zi,bw as xa,bx as ut,by as Xi,bz as eo,bA as Jn,bB as so,bC as to,bD as Zn,bE as ao,bF as Ce,bG as no,bH as Wa,bI as ha,bJ as fa,bK as ro,bL as lo,bM as Xn,bN as io,bO as Ta,bP as oo,bQ as co,bR as mo,bS as er,bT as sr,bU as tr,bV as uo,bW as xo,bX as ho,bY as fo,bZ as ar,b_ as po,b$ as ms,c0 as go,c1 as jo,c2 as vo,c3 as Rt,c4 as Re,c5 as Ya,c6 as bo,c7 as nr,c8 as rr,c9 as lr,ca as ir,cb as or,cc as cr,cd as yo,ce as No,cf as _o,cg as Ut,ch as As,ci as ns,cj as Ze,ck as Xe,cl as rs,cm as ls,cn as is,co as wo,cp as Co,cq as So,cr as ko,cs as To,ct as Do,cu as Po,cv as Eo,cw as Ro,cx as pa,cy as Da,cz as Pa,cA as Io,cB as _s,cC as ws,cD as gt,cE as Vo,cF as It,cG as Oo,cH as Qa,cI as dr,cJ as Ja,cK as Vt,cL as Mo,cM as Fo,cN as zo,cO as Lo,cP as mr,cQ as Ao,cR as $o,cS as ur,cT as ga,cU as xr,cV as qo,cW as hr,cX as fr,cY as Uo,cZ as Ho,c_ as Ko,c$ as Bo,d0 as Go}from"./vendor.js";import"./index.js";var Zh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xh(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Wo(s){if(s.__esModule)return s;var n=s.default;if(typeof n=="function"){var a=function l(){return this instanceof l?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};a.prototype=n.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(s).forEach(function(l){var r=Object.getOwnPropertyDescriptor(s,l);Object.defineProperty(a,l,r.get?r:{enumerable:!0,get:function(){return s[l]}})}),a}const Yo={theme:"system",setTheme:()=>null},pr=u.createContext(Yo);function Qo({children:s,defaultTheme:n="system",storageKey:a="vite-ui-theme",...l}){const[r,c]=u.useState(()=>localStorage.getItem(a)||n);u.useEffect(()=>{const m=window.document.documentElement;if(m.classList.remove("light","dark"),r==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";m.classList.add(x);return}m.classList.add(r)},[r]);const o={theme:r,setTheme:m=>{localStorage.setItem(a,m),c(m)}};return e.jsx(pr.Provider,{...l,value:o,children:s})}const Jo=()=>{const s=u.useContext(pr);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Zo=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),Xo=function(s,n){return new URL(s,n).href},Za={},me=function(n,a,l){let r=Promise.resolve();if(a&&a.length>0){const o=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),x=m?.nonce||m?.getAttribute("nonce");r=Promise.allSettled(a.map(i=>{if(i=Xo(i,l),i in Za)return;Za[i]=!0;const d=i.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(!!l)for(let f=o.length-1;f>=0;f--){const j=o[f];if(j.href===i&&(!d||j.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${p}`))return;const P=document.createElement("link");if(P.rel=d?"stylesheet":Zo,d||(P.as="script"),P.crossOrigin="",P.href=i,x&&P.setAttribute("nonce",x),document.head.appendChild(P),d)return new Promise((f,j)=>{P.addEventListener("load",f),P.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${i}`)))})}))}function c(o){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=o,window.dispatchEvent(m),!m.defaultPrevented)throw o}return r.then(o=>{for(const m of o||[])m.status==="rejected"&&c(m.reason);return n().catch(c)})};function N(...s){return Cl(Sl(s))}const et=Fs("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),D=u.forwardRef(({className:s,variant:n,size:a,asChild:l=!1,children:r,disabled:c,loading:o=!1,leftSection:m,rightSection:x,...i},d)=>{const p=l?ya:"button";return e.jsxs(p,{className:N(et({variant:n,size:a,className:s})),disabled:o||c,ref:d,...i,children:[(m&&o||!m&&!x&&o)&&e.jsx(Ha,{className:"mr-2 h-4 w-4 animate-spin"}),!o&&m&&e.jsx("div",{className:"mr-2",children:m}),r,!o&&x&&e.jsx("div",{className:"ml-2",children:x}),x&&o&&e.jsx(Ha,{className:"ml-2 h-4 w-4 animate-spin"})]})});D.displayName="Button";function Ks({className:s,minimal:n=!1}){const a=Ns();return e.jsx("div",{className:N("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",{})," Please try again later."]}),!n&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(D,{variant:"outline",onClick:()=>a(-1),children:"Go Back"}),e.jsx(D,{onClick:()=>a("/"),children:"Back to Home"})]})]})})}function Xa(){const s=Ns();return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"404"}),e.jsx("span",{className:"font-medium",children:"Oops! Page Not Found!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["It seems like the page you're looking for ",e.jsx("br",{}),"does not exist or might have been removed."]}),e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(D,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(D,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function ec(){return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"503"}),e.jsx("span",{className:"font-medium",children:"Website is under maintenance!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["The site is not available at the moment. ",e.jsx("br",{}),"We'll be back online shortly."]}),e.jsx("div",{className:"mt-6 flex gap-4",children:e.jsx(D,{variant:"outline",children:"Learn more"})})]})})}function sc(s){return typeof s>"u"}function tc(s){return s===null}function ac(s){return tc(s)||sc(s)}class nc{storage;prefixKey;constructor(n){this.storage=n.storage,this.prefixKey=n.prefixKey}getKey(n){return`${this.prefixKey}${n}`.toUpperCase()}set(n,a,l=null){const r=JSON.stringify({value:a,time:Date.now(),expire:l!==null?new Date().getTime()+l*1e3:null});this.storage.setItem(this.getKey(n),r)}get(n,a=null){const l=this.storage.getItem(this.getKey(n));if(!l)return{value:a,time:0};try{const r=JSON.parse(l),{value:c,time:o,expire:m}=r;return ac(m)||m>new Date().getTime()?{value:c,time:o}:(this.remove(n),{value:a,time:0})}catch{return this.remove(n),{value:a,time:0}}}remove(n){this.storage.removeItem(this.getKey(n))}clear(){this.storage.clear()}}function gr({prefixKey:s="",storage:n=sessionStorage}){return new nc({prefixKey:s,storage:n})}const jr="Xboard_",rc=function(s={}){return gr({prefixKey:s.prefixKey||"",storage:localStorage})},lc=function(s={}){return gr({prefixKey:s.prefixKey||"",storage:sessionStorage})},Ht=rc({prefixKey:jr});lc({prefixKey:jr});const vr="access_token";function xt(){return Ht.get(vr)}function br(){Ht.remove(vr)}const en=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function ic({children:s}){const n=Ns(),a=Na(),l=xt();return u.useEffect(()=>{if(!l.value&&!en.includes(a.pathname)){const r=encodeURIComponent(a.pathname+a.search);n(`/sign-in?redirect=${r}`)}},[l.value,a.pathname,a.search,n]),en.includes(a.pathname)||l.value?e.jsx(e.Fragment,{children:s}):null}const oc=()=>e.jsx(ic,{children:e.jsx(_a,{})}),cc=kl([{path:"/sign-in",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Vc);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(oc,{}),children:[{path:"/",lazy:async()=>({Component:(await me(()=>Promise.resolve().then(()=>Uc),void 0,import.meta.url)).default}),errorElement:e.jsx(Ks,{}),children:[{index:!0,lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>um);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Ks,{}),children:[{path:"system",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>pm);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>bm);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Cm);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Pm);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Om);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Am);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Km);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Qm);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>su);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>lu);return{default:s}},void 0,import.meta.url)).default})}]},{path:"payment",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>pu);return{default:s}},void 0,import.meta.url)).default})},{path:"plugin",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>vu);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>_u);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Pu);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>zu);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Ks,{}),children:[{path:"manage",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>cx);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>hx);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>bx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Ks,{}),children:[{path:"plan",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Dx);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Ux);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Zx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Ks,{}),children:[{path:"manage",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Dh);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await me(async()=>{const{default:s}=await Promise.resolve().then(()=>Yh);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Ks},{path:"/404",Component:Xa},{path:"/503",Component:ec},{path:"*",Component:Xa}]),dc="locale";function mc(){return Ht.get(dc)}function yr(){br();const s=window.location.pathname,n=s&&!["/404","/sign-in"].includes(s),a=new URL(window.location.href),r=`${a.pathname.split("/")[1]?`/${a.pathname.split("/")[1]}`:""}#/sign-in`;window.location.href=r+(n?`?redirect=${s}`:"")}const uc=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function xc(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const V=Tl.create({baseURL:xc(),timeout:12e3,headers:{"Content-Type":"application/json"}});V.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const n=xt();if(!uc.includes(s.url?.split("?")[0]||"")){if(!n.value)return yr(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=n.value}return s.headers["Content-Language"]=mc().value||"zh-CN",s},s=>Promise.reject(s));V.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const n=s.response?.status,a=s.response?.data?.message;return(n===401||n===403)&&yr(),$.error(a||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[n]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});function hc(){return V.get("/user/info")}const ta={token:xt()?.value||"",userInfo:null,isLoggedIn:!!xt()?.value,loading:!1,error:null},ct=Dl("user/fetchUserInfo",async()=>(await hc()).data,{condition:(s,{getState:n})=>{const{user:a}=n();return!!a.token&&!a.loading}}),Nr=Pl({name:"user",initialState:ta,reducers:{setToken(s,n){s.token=n.payload,s.isLoggedIn=!!n.payload},resetUserState:()=>ta},extraReducers:s=>{s.addCase(ct.pending,n=>{n.loading=!0,n.error=null}).addCase(ct.fulfilled,(n,a)=>{n.loading=!1,n.userInfo=a.payload,n.error=null}).addCase(ct.rejected,(n,a)=>{if(n.loading=!1,n.error=a.error.message||"Failed to fetch user info",!n.token)return ta})}}),{setToken:fc,resetUserState:pc}=Nr.actions,gc=s=>s.user.userInfo,jc=Nr.reducer,_r=El({reducer:{user:jc}});xt()?.value&&_r.dispatch(ct());Rl.use(Il).use(Vl).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 vc=new Ol;Ml.createRoot(document.getElementById("root")).render(e.jsx(Fl.StrictMode,{children:e.jsx(zl,{client:vc,children:e.jsx(Ll,{store:_r,children:e.jsxs(Qo,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(Al,{router:cc}),e.jsx($l,{richColors:!0,position:"top-right"})]})})})}));const He=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("rounded-xl border bg-card text-card-foreground shadow",s),...n}));He.displayName="Card";const Qe=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("flex flex-col space-y-1.5 p-6",s),...n}));Qe.displayName="CardHeader";const vs=u.forwardRef(({className:s,...n},a)=>e.jsx("h3",{ref:a,className:N("font-semibold leading-none tracking-tight",s),...n}));vs.displayName="CardTitle";const Qs=u.forwardRef(({className:s,...n},a)=>e.jsx("p",{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Qs.displayName="CardDescription";const Je=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("p-6 pt-0",s),...n}));Je.displayName="CardContent";const bc=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("flex items-center p-6 pt-0",s),...n}));bc.displayName="CardFooter";const yc=Fs("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ot=u.forwardRef(({className:s,...n},a)=>e.jsx(fn,{ref:a,className:N(yc(),s),...n}));Ot.displayName=fn.displayName;const _e=ql,wr=u.createContext({}),b=({...s})=>e.jsx(wr.Provider,{value:{name:s.name},children:e.jsx(Ul,{...s})}),Kt=()=>{const s=u.useContext(wr),n=u.useContext(Cr),{getFieldState:a,formState:l}=Hl(),r=a(s.name,l);if(!s)throw new Error("useFormField should be used within ");const{id:c}=n;return{id:c,name:s.name,formItemId:`${c}-form-item`,formDescriptionId:`${c}-form-item-description`,formMessageId:`${c}-form-item-message`,...r}},Cr=u.createContext({}),v=u.forwardRef(({className:s,...n},a)=>{const l=u.useId();return e.jsx(Cr.Provider,{value:{id:l},children:e.jsx("div",{ref:a,className:N("space-y-2",s),...n})})});v.displayName="FormItem";const y=u.forwardRef(({className:s,...n},a)=>{const{error:l,formItemId:r}=Kt();return e.jsx(Ot,{ref:a,className:N(l&&"text-destructive",s),htmlFor:r,...n})});y.displayName="FormLabel";const _=u.forwardRef(({...s},n)=>{const{error:a,formItemId:l,formDescriptionId:r,formMessageId:c}=Kt();return e.jsx(ya,{ref:n,id:l,"aria-describedby":a?`${r} ${c}`:`${r}`,"aria-invalid":!!a,...s})});_.displayName="FormControl";const z=u.forwardRef(({className:s,...n},a)=>{const{formDescriptionId:l}=Kt();return e.jsx("p",{ref:a,id:l,className:N("text-[0.8rem] text-muted-foreground",s),...n})});z.displayName="FormDescription";const T=u.forwardRef(({className:s,children:n,...a},l)=>{const{error:r,formMessageId:c}=Kt(),o=r?String(r?.message):n;return o?e.jsx("p",{ref:l,id:c,className:N("text-[0.8rem] font-medium text-destructive",s),...a,children:o}):null});T.displayName="FormMessage";const k=u.forwardRef(({className:s,type:n,...a},l)=>e.jsx("input",{type:n,className:N("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,...a}));k.displayName="Input";const Sr=u.forwardRef(({className:s,...n},a)=>{const[l,r]=u.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:l?"text":"password",className:N("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...n}),e.jsx(D,{type:"button",size:"icon",variant:"ghost",className:"absolute right-1 top-1/2 h-6 w-6 -translate-y-1/2 rounded-md text-muted-foreground",onClick:()=>r(c=>!c),children:l?e.jsx(Kl,{size:18}):e.jsx(Bl,{size:18})})]})});Sr.displayName="PasswordInput";const Nc=s=>V({url:"/passport/auth/login",method:"post",data:s});function ve(s=void 0,n="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),Gl(s).format(n))}function _c(s=void 0,n="YYYY-MM-DD"){return ve(s,n)}function Ws(s){const n=typeof s=="string"?parseFloat(s):s;return isNaN(n)?"0.00":n.toFixed(2)}function Os(s,n=!0){if(s==null)return n?"¥0.00":"0.00";const a=typeof s=="string"?parseFloat(s):s;if(isNaN(a))return n?"¥0.00":"0.00";const r=(a/100).toFixed(2).replace(/\.?0+$/,c=>c.includes(".")?".00":c);return n?`¥${r}`:r}function Mt(s){return new Promise(n=>{(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 r=document.execCommand("copy");if(document.body.removeChild(l),!r)throw new Error("execCommand failed")}n(!0)}catch(l){console.error(l),n(!1)}})()})}function ds(s){const n=s/1024,a=n/1024,l=a/1024,r=l/1024;return r>=1?Ws(r)+" TB":l>=1?Ws(l)+" GB":a>=1?Ws(a)+" MB":Ws(n)+" KB"}const wc="access_token";function Cc(s){Ht.set(wc,s)}function Sc({className:s,onForgotPassword:n,...a}){const l=Ns(),r=pn(),{t:c}=M("auth"),o=h.object({email:h.string().min(1,{message:c("signIn.validation.emailRequired")}),password:h.string().min(1,{message:c("signIn.validation.passwordRequired")}).min(7,{message:c("signIn.validation.passwordLength")})}),m=je({resolver:Ne(o),defaultValues:{email:"",password:""}});async function x(i){try{const{data:d}=await Nc(i);Cc(d.auth_data),r(fc(d.auth_data)),await r(ct()).unwrap(),l("/")}catch(d){console.error("Login failed:",d),d.response?.data?.message&&m.setError("root",{message:d.response.data.message})}}return e.jsx("div",{className:N("grid gap-6",s),...a,children:e.jsx(_e,{...m,children:e.jsx("form",{onSubmit:m.handleSubmit(x),className:"space-y-4",children:e.jsxs("div",{className:"space-y-4",children:[m.formState.errors.root&&e.jsx("div",{className:"text-sm text-destructive",children:m.formState.errors.root.message}),e.jsx(b,{control:m.control,name:"email",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:c("signIn.email")}),e.jsx(_,{children:e.jsx(k,{placeholder:c("signIn.emailPlaceholder"),autoComplete:"email",...i})}),e.jsx(T,{})]})}),e.jsx(b,{control:m.control,name:"password",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:c("signIn.password")}),e.jsx(_,{children:e.jsx(Sr,{placeholder:c("signIn.passwordPlaceholder"),autoComplete:"current-password",...i})}),e.jsx(T,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(D,{variant:"link",type:"button",className:"px-0 text-sm font-normal text-muted-foreground hover:text-primary",onClick:n,children:c("signIn.forgotPassword")})}),e.jsx(D,{className:"w-full",size:"lg",loading:m.formState.isSubmitting,children:c("signIn.submit")})]})})})})}const be=gn,Ge=jn,kc=vn,jt=wa,kr=u.forwardRef(({className:s,...n},a)=>e.jsx(Lt,{ref:a,className:N("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}));kr.displayName=Lt.displayName;const ge=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(kc,{children:[e.jsx(kr,{}),e.jsxs(At,{ref:l,className:N("max-h-[95%] overflow-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...a,children:[n,e.jsxs(wa,{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(Ye,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ge.displayName=At.displayName;const we=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-1.5 text-center sm:text-left",s),...n});we.displayName="DialogHeader";const Ae=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Ae.displayName="DialogFooter";const ye=u.forwardRef(({className:s,...n},a)=>e.jsx($t,{ref:a,className:N("text-lg font-semibold leading-none tracking-tight",s),...n}));ye.displayName=$t.displayName;const De=u.forwardRef(({className:s,...n},a)=>e.jsx(qt,{ref:a,className:N("text-sm text-muted-foreground",s),...n}));De.displayName=qt.displayName;const Js=Fs("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=u.forwardRef(({className:s,variant:n,size:a,asChild:l=!1,...r},c)=>{const o=l?ya:"button";return e.jsx(o,{className:N(Js({variant:n,size:a,className:s})),ref:c,...r})});G.displayName="Button";const bs=Ql,ys=Jl,Tc=Zl,Dc=u.forwardRef(({className:s,inset:n,children:a,...l},r)=>e.jsxs(bn,{ref:r,className:N("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),...l,children:[a,e.jsx(Ca,{className:"ml-auto h-4 w-4"})]}));Dc.displayName=bn.displayName;const Pc=u.forwardRef(({className:s,...n},a)=>e.jsx(yn,{ref:a,className:N("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}));Pc.displayName=yn.displayName;const us=u.forwardRef(({className:s,sideOffset:n=4,...a},l)=>e.jsx(Wl,{children:e.jsx(Nn,{ref:l,sideOffset:n,className:N("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a})}));us.displayName=Nn.displayName;const fe=u.forwardRef(({className:s,inset:n,...a},l)=>e.jsx(_n,{ref:l,className:N("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),...a}));fe.displayName=_n.displayName;const Ec=u.forwardRef(({className:s,children:n,checked:a,...l},r)=>e.jsxs(wn,{ref:r,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:a,...l,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Cn,{children:e.jsx(zs,{className:"h-4 w-4"})})}),n]}));Ec.displayName=wn.displayName;const Rc=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(Sn,{ref:l,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Cn,{children:e.jsx(Yl,{className:"h-4 w-4 fill-current"})})}),n]}));Rc.displayName=Sn.displayName;const Ea=u.forwardRef(({className:s,inset:n,...a},l)=>e.jsx(kn,{ref:l,className:N("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",s),...a}));Ea.displayName=kn.displayName;const Zs=u.forwardRef(({className:s,...n},a)=>e.jsx(Tn,{ref:a,className:N("-mx-1 my-1 h-px bg-muted",s),...n}));Zs.displayName=Tn.displayName;const ja=({className:s,...n})=>e.jsx("span",{className:N("ml-auto text-xs tracking-widest opacity-60",s),...n});ja.displayName="DropdownMenuShortcut";const aa=[{code:"en-US",name:"English",flag:Xl,shortName:"EN"},{code:"zh-CN",name:"中文",flag:ei,shortName:"CN"},{code:"ko-KR",name:"한국어",flag:si,shortName:"KR"}];function Tr(){const{i18n:s}=M(),n=r=>{s.changeLanguage(r)},a=aa.find(r=>r.code===s.language)||aa[1],l=a.flag;return e.jsxs(bs,{children:[e.jsx(ys,{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:a.shortName})]})}),e.jsx(us,{align:"end",className:"w-[120px]",children:aa.map(r=>{const c=r.flag,o=r.code===s.language;return e.jsxs(fe,{onClick:()=>n(r.code),className:N("flex items-center gap-2 px-2 py-1.5 cursor-pointer",o&&"bg-accent"),children:[e.jsx(c,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:N("text-sm",o&&"font-medium"),children:r.name})]},r.code)})})]})}function Ic(){const[s,n]=u.useState(!1),{t:a}=M("auth"),l=a("signIn.resetPassword.command");return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"container relative grid h-svh flex-col items-center justify-center bg-primary-foreground 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(Tr,{})}),e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[480px] lg:p-8",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-center",children:[e.jsx("h1",{className:"text-3xl font-bold",children:window?.settings?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:window?.settings?.description})]}),e.jsxs(He,{className:"p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:a("signIn.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("signIn.description")})]}),e.jsx(Sc,{onForgotPassword:()=>n(!0)})]})]})]}),e.jsx(be,{open:s,onOpenChange:n,children:e.jsx(ge,{children:e.jsxs(we,{children:[e.jsx(ye,{children:a("signIn.resetPassword.title")}),e.jsx(De,{children:a("signIn.resetPassword.description")}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"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:()=>Mt(l).then(()=>{$.success(a("common:copy.success"))}),children:e.jsx(ti,{className:"h-4 w-4"})})]})})]})})})]})}const Vc=Object.freeze(Object.defineProperty({__proto__:null,default:Ic},Symbol.toStringTag,{value:"Module"})),Pe=u.forwardRef(({className:s,fadedBelow:n=!1,fixedHeight:a=!1,...l},r)=>e.jsx("div",{ref:r,className:N("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",a&&"md:h-svh",s),...l}));Pe.displayName="Layout";const Ee=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...n}));Ee.displayName="LayoutHeader";const Ve=u.forwardRef(({className:s,fixedHeight:n,...a},l)=>e.jsx("div",{ref:l,className:N("flex-1 overflow-hidden px-4 py-6 md:px-8",n&&"h-[calc(100%-var(--header-height))]",s),...a}));Ve.displayName="LayoutBody";const Dr=ai,Pr=ni,Er=ri,pe=li,xe=ii,he=oi,ce=u.forwardRef(({className:s,sideOffset:n=4,...a},l)=>e.jsx(Dn,{ref:l,sideOffset:n,className:N("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a}));ce.displayName=Dn.displayName;function Bt(){const{pathname:s}=Na();return{checkActiveNav:a=>{if(a==="/"&&s==="/")return!0;const l=a.replace(/^\//,""),r=s.replace(/^\//,"");return l?r.startsWith(l):!1}}}function Rr({key:s,defaultValue:n}){const[a,l]=u.useState(()=>{const r=localStorage.getItem(s);return r!==null?JSON.parse(r):n});return u.useEffect(()=>{localStorage.setItem(s,JSON.stringify(a))},[a,s]),[a,l]}function Oc(){const[s,n]=Rr({key:"collapsed-sidebar-items",defaultValue:[]}),a=r=>!s.includes(r);return{isExpanded:a,toggleItem:r=>{a(r)?n([...s,r]):n(s.filter(c=>c!==r))}}}function Mc({links:s,isCollapsed:n,className:a,closeNav:l}){const{t:r}=M(),c=({sub:o,...m})=>{const x=`${r(m.title)}-${m.href}`;return n&&o?u.createElement(Lc,{...m,sub:o,key:x,closeNav:l}):n?u.createElement(zc,{...m,key:x,closeNav:l}):o?u.createElement(Fc,{...m,sub:o,key:x,closeNav:l}):u.createElement(Ir,{...m,key:x,closeNav:l})};return e.jsx("div",{"data-collapsed":n,className:N("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",a),children:e.jsx(pe,{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(c)})})})}function Ir({title:s,icon:n,label:a,href:l,closeNav:r,subLink:c=!1}){const{checkActiveNav:o}=Bt(),{t:m}=M();return e.jsxs(Ls,{to:l,onClick:r,className:N(et({variant:o(l)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",c&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":o(l)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:n}),m(s),a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:m(a)})]})}function Fc({title:s,icon:n,label:a,sub:l,closeNav:r}){const{checkActiveNav:c}=Bt(),{isExpanded:o,toggleItem:m}=Oc(),{t:x}=M(),i=!!l?.find(C=>c(C.href)),d=x(s),p=o(d)||i;return e.jsxs(Dr,{open:p,onOpenChange:()=>m(d),children:[e.jsxs(Pr,{className:N(et({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:n}),x(s),a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:x(a)}),e.jsx("span",{className:N('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(Pn,{stroke:1})})]}),e.jsx(Er,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:l.map(C=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(Ir,{...C,subLink:!0,closeNav:r})},x(C.title)))})})]})}function zc({title:s,icon:n,label:a,href:l,closeNav:r}){const{checkActiveNav:c}=Bt(),{t:o}=M();return e.jsxs(xe,{delayDuration:0,children:[e.jsx(he,{asChild:!0,children:e.jsxs(Ls,{to:l,onClick:r,className:N(et({variant:c(l)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[n,e.jsx("span",{className:"sr-only",children:o(s)})]})}),e.jsxs(ce,{side:"right",className:"flex items-center gap-4",children:[o(s),a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:o(a)})]})]})}function Lc({title:s,icon:n,label:a,sub:l,closeNav:r}){const{checkActiveNav:c}=Bt(),{t:o}=M(),m=!!l?.find(x=>c(x.href));return e.jsxs(bs,{children:[e.jsxs(xe,{delayDuration:0,children:[e.jsx(he,{asChild:!0,children:e.jsx(ys,{asChild:!0,children:e.jsx(D,{variant:m?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:n})})}),e.jsxs(ce,{side:"right",className:"flex items-center gap-4",children:[o(s)," ",a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:o(a)}),e.jsx(Pn,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(us,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(Ea,{children:[o(s)," ",a?`(${o(a)})`:""]}),e.jsx(Zs,{}),l.map(({title:x,icon:i,label:d,href:p})=>e.jsx(fe,{asChild:!0,children:e.jsxs(Ls,{to:p,onClick:r,className:`${c(p)?"bg-secondary":""}`,children:[i," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:o(x)}),d&&e.jsx("span",{className:"ml-auto text-xs",children:o(d)})]})},`${o(x)}-${p}`))]})]})}const Vr=[{title:"nav:dashboard",label:"",href:"/",icon:e.jsx(ci,{size:18})},{title:"nav:systemManagement",label:"",href:"",icon:e.jsx(di,{size:18}),sub:[{title:"nav:systemConfig",label:"",href:"/config/system",icon:e.jsx(En,{size:18})},{title:"nav:pluginManagement",label:"",href:"/config/plugin",icon:e.jsx(Sa,{size:18})},{title:"nav:themeConfig",label:"",href:"/config/theme",icon:e.jsx(mi,{size:18})},{title:"nav:noticeManagement",label:"",href:"/config/notice",icon:e.jsx(ui,{size:18})},{title:"nav:paymentConfig",label:"",href:"/config/payment",icon:e.jsx(Ka,{size:18})},{title:"nav:knowledgeManagement",label:"",href:"/config/knowledge",icon:e.jsx(xi,{size:18})}]},{title:"nav:nodeManagement",label:"",href:"",icon:e.jsx(Rn,{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(In,{size:18})},{title:"nav:routeManagement",label:"",href:"/server/route",icon:e.jsx(fi,{size:18})}]},{title:"nav:subscriptionManagement",label:"",href:"",icon:e.jsx(pi,{size:18}),sub:[{title:"nav:planManagement",label:"",href:"/finance/plan",icon:e.jsx(gi,{size:18})},{title:"nav:orderManagement",label:"",href:"/finance/order",icon:e.jsx(Ka,{size:18})},{title:"nav:couponManagement",label:"",href:"/finance/coupon",icon:e.jsx(ji,{size:18})}]},{title:"nav:userManagement",label:"",href:"",icon:e.jsx(vi,{size:18}),sub:[{title:"nav:userManagement",label:"",href:"/user/manage",icon:e.jsx(bi,{size:18})},{title:"nav:ticketManagement",label:"",href:"/user/ticket",icon:e.jsx(Vn,{size:18})}]}];function Ac({className:s,isCollapsed:n,setIsCollapsed:a}){const[l,r]=u.useState(!1),{t:c}=M();return u.useEffect(()=>{l?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[l]),e.jsxs("aside",{className:N(`fixed left-0 right-0 top-0 z-50 w-full border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${n?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>r(!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(Pe,{children:[e.jsxs(Ee,{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(D,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":c("common:toggleNavigation"),"aria-controls":"sidebar-menu","aria-expanded":l,onClick:()=>r(o=>!o),children:l?e.jsx(yi,{}):e.jsx(Ni,{})})]}),e.jsx(Mc,{id:"sidebar-menu",className:`h-full flex-1 overflow-auto ${l?"max-h-screen":"max-h-0 py-0 md:max-h-screen md:py-2"}`,closeNav:()=>r(!1),isCollapsed:n,links:Vr}),e.jsx("div",{className:N("px-4 py-3 text-xs text-muted-foreground/70 border-t border-border/50 bg-muted/20","transition-all duration-200 ease-in-out",n?"text-center":"text-left"),children:e.jsxs("div",{className:N("flex items-center gap-1.5",n?"justify-center":"justify-start"),children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-green-500/70"}),e.jsxs("span",{className:"tracking-wide",children:["v",window?.settings?.version]})]})}),e.jsx(D,{onClick:()=>a(o=>!o),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex","aria-label":c("common:toggleSidebar"),children:e.jsx(_i,{stroke:1.5,className:`h-5 w-5 ${n?"rotate-180":""}`})})]})]})}function $c(){const[s,n]=Rr({key:"collapsed-sidebar",defaultValue:!1});return u.useEffect(()=>{const a=()=>{n(window.innerWidth<768?!1:s)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[s,n]),[s,n]}function qc(){const[s,n]=$c();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(Ac,{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(_a,{})})]})}const Uc=Object.freeze(Object.defineProperty({__proto__:null,default:qc},Symbol.toStringTag,{value:"Module"})),Is=u.forwardRef(({className:s,...n},a)=>e.jsx(Me,{ref:a,className:N("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...n}));Is.displayName=Me.displayName;const Hc=({children:s,...n})=>e.jsx(be,{...n,children:e.jsx(ge,{className:"overflow-hidden p-0",children:e.jsx(Is,{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})})}),$s=u.forwardRef(({className:s,...n},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(wi,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Me.Input,{ref:a,className:N("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})]}));$s.displayName=Me.Input.displayName;const Vs=u.forwardRef(({className:s,...n},a)=>e.jsx(Me.List,{ref:a,className:N("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...n}));Vs.displayName=Me.List.displayName;const qs=u.forwardRef((s,n)=>e.jsx(Me.Empty,{ref:n,className:"py-6 text-center text-sm",...s}));qs.displayName=Me.Empty.displayName;const Ke=u.forwardRef(({className:s,...n},a)=>e.jsx(Me.Group,{ref:a,className:N("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}));Ke.displayName=Me.Group.displayName;const st=u.forwardRef(({className:s,...n},a)=>e.jsx(Me.Separator,{ref:a,className:N("-mx-1 h-px bg-border",s),...n}));st.displayName=Me.Separator.displayName;const Ie=u.forwardRef(({className:s,...n},a)=>e.jsx(Me.Item,{ref:a,className:N("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}));Ie.displayName=Me.Item.displayName;function Kc(){const s=[];for(const n of Vr)if(n.href&&s.push(n),n.sub)for(const a of n.sub)s.push({...a,parent:n.title});return s}function $e(){const[s,n]=u.useState(!1),a=Ns(),l=Kc(),{t:r}=M("search"),{t:c}=M("nav");u.useEffect(()=>{const m=x=>{x.key==="k"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),n(i=>!i))};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[]);const o=u.useCallback(m=>{n(!1),a(m)},[a]);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:()=>n(!0),children:[e.jsx(On,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:r("placeholder")}),e.jsx("span",{className:"sr-only",children:r("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:r("shortcut.key")})]}),e.jsxs(Hc,{open:s,onOpenChange:n,children:[e.jsx($s,{placeholder:r("placeholder")}),e.jsxs(Vs,{children:[e.jsx(qs,{children:r("noResults")}),e.jsx(Ke,{heading:r("title"),children:l.map(m=>e.jsxs(Ie,{value:`${m.parent?m.parent+" ":""}${m.title}`,onSelect:()=>o(m.href),children:[e.jsx("div",{className:"mr-2",children:m.icon}),e.jsx("span",{children:c(m.title)}),m.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c(m.parent)})]},m.href))})]})]})]})}function Fe(){const{theme:s,setTheme:n}=Jo();return u.useEffect(()=>{const a=s==="dark"?"#020817":"#fff",l=document.querySelector("meta[name='theme-color']");l&&l.setAttribute("content",a)},[s]),e.jsxs(e.Fragment,{children:[e.jsx(D,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>n(s==="light"?"dark":"light"),children:s==="light"?e.jsx(Ci,{size:20}):e.jsx(Si,{size:20})}),e.jsx(Tr,{})]})}const Or=u.forwardRef(({className:s,...n},a)=>e.jsx(Mn,{ref:a,className:N("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...n}));Or.displayName=Mn.displayName;const Mr=u.forwardRef(({className:s,...n},a)=>e.jsx(Fn,{ref:a,className:N("aspect-square h-full w-full",s),...n}));Mr.displayName=Fn.displayName;const Fr=u.forwardRef(({className:s,...n},a)=>e.jsx(zn,{ref:a,className:N("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...n}));Fr.displayName=zn.displayName;function ze(){const s=Ns(),n=pn(),a=ki(gc),{t:l}=M(["common"]),r=()=>{br(),n(pc()),s("/sign-in")},c=a?.email?.split("@")[0]||l("common:user"),o=c.substring(0,2).toUpperCase();return e.jsxs(bs,{children:[e.jsx(ys,{asChild:!0,children:e.jsx(D,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(Or,{className:"h-8 w-8",children:[e.jsx(Mr,{src:a?.avatar_url,alt:c}),e.jsx(Fr,{children:o})]})})}),e.jsxs(us,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(Ea,{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:c}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:a?.email||l("common:defaultEmail")})]})}),e.jsx(Zs,{}),e.jsx(fe,{asChild:!0,children:e.jsxs(Ls,{to:"/config/system",children:[l("common:settings"),e.jsx(ja,{children:"⌘S"})]})}),e.jsx(Zs,{}),e.jsxs(fe,{onClick:r,children:[l("common:logout"),e.jsx(ja,{children:"⇧⌘Q"})]})]})]})}const H=window?.settings?.secure_path,Bc=s=>V.get(H+"/stat/getOrder",{params:s}),Gc=()=>V.get(H+"/stat/getStats"),sn=s=>V.get(H+"/stat/getTrafficRank",{params:s}),Wc=()=>V.get(H+"/theme/getThemes"),Yc=s=>V.post(H+"/theme/getThemeConfig",{name:s}),Qc=(s,n)=>V.post(H+"/theme/saveThemeConfig",{name:s,config:n}),Jc=s=>{const n=new FormData;return n.append("file",s),V.post(H+"/theme/upload",n,{headers:{"Content-Type":"multipart/form-data"}})},Zc=s=>V.post(H+"/theme/delete",{name:s}),Xc=s=>V.post(H+"/config/save",s),zr=()=>V.get(H+"/server/manage/getNodes"),ed=s=>V.post(H+"/server/manage/save",s),sd=s=>V.post(H+"/server/manage/drop",s),td=s=>V.post(H+"/server/manage/copy",s),ad=s=>V.post(H+"/server/manage/update",s),nd=s=>V.post(H+"/server/manage/sort",s),vt=()=>V.get(H+"/server/group/fetch"),rd=s=>V.post(H+"/server/group/save",s),ld=s=>V.post(H+"/server/group/drop",s),Lr=()=>V.get(H+"/server/route/fetch"),id=s=>V.post(H+"/server/route/save",s),od=s=>V.post(H+"/server/route/drop",s),cd=()=>V.get(H+"/payment/fetch"),dd=()=>V.get(H+"/payment/getPaymentMethods"),md=s=>V.post(H+"/payment/getPaymentForm",s),ud=s=>V.post(H+"/payment/save",s),xd=s=>V.post(H+"/payment/drop",s),hd=s=>V.post(H+"/payment/show",s),fd=s=>V.post(H+"/payment/sort",s),pd=s=>V.post(H+"/notice/save",s),gd=s=>V.post(H+"/notice/drop",s),jd=s=>V.post(H+"/notice/show",s),vd=()=>V.get(H+"/knowledge/fetch"),bd=s=>V.get(H+"/knowledge/fetch?id="+s),yd=s=>V.post(H+"/knowledge/save",s),Nd=s=>V.post(H+"/knowledge/drop",s),_d=s=>V.post(H+"/knowledge/show",s),wd=s=>V.post(H+"/knowledge/sort",s),Us=()=>V.get(H+"/plan/fetch"),Cd=s=>V.post(H+"/plan/save",s),na=s=>V.post(H+"/plan/update",s),Sd=s=>V.post(H+"/plan/drop",s),kd=s=>V.post(H+"/plan/sort",{ids:s}),Td=async s=>V.post(H+"/order/fetch",s),Dd=s=>V.post(H+"/order/detail",s),Pd=s=>V.post(H+"/order/paid",s),Ed=s=>V.post(H+"/order/cancel",s),tn=s=>V.post(H+"/order/update",s),Rd=s=>V.post(H+"/order/assign",s),Id=s=>V.post(H+"/coupon/fetch",s),Vd=s=>V.post(H+"/coupon/generate",s),Od=s=>V.post(H+"/coupon/drop",s),Md=s=>V.post(H+"/coupon/update",s),Fd=s=>V.post(H+"/user/fetch",s),zd=s=>V.post(H+"/user/update",s),Ld=s=>V.post(H+"/user/resetSecret",s),Ad=s=>V.post(H+"/user/generate",s),$d=s=>V.post(H+"/stat/getStatUser",s),qd=s=>V.post(H+"/ticket/fetch",s),Ud=s=>V.get(H+"/ticket/fetch?id= "+s),Hd=s=>V.post(H+"/ticket/close",{id:s}),Cs=(s="")=>V.get(H+"/config/fetch?key="+s),Ss=s=>V.post(H+"/config/save",s),Kd=()=>V.get(H+"/config/getEmailTemplate"),Bd=()=>V.post(H+"/config/testSendMail"),Gd=()=>V.post(H+"/config/setTelegramWebhook"),Ra=Ti,Gt=u.forwardRef(({className:s,...n},a)=>e.jsx(Ln,{ref:a,className:N("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...n}));Gt.displayName=Ln.displayName;const Es=u.forwardRef(({className:s,...n},a)=>e.jsx(An,{ref:a,className:N("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}));Es.displayName=An.displayName;const Tt=u.forwardRef(({className:s,...n},a)=>e.jsx($n,{ref:a,className:N("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...n}));Tt.displayName=$n.displayName;const X=Di,ks=Fi,ee=Pi,Q=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(qn,{ref:l,className:N("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...a,children:[n,e.jsx(Ei,{asChild:!0,children:e.jsx(ka,{className:"h-4 w-4 opacity-50"})})]}));Q.displayName=qn.displayName;const Ar=u.forwardRef(({className:s,...n},a)=>e.jsx(Un,{ref:a,className:N("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(Ri,{className:"h-4 w-4"})}));Ar.displayName=Un.displayName;const $r=u.forwardRef(({className:s,...n},a)=>e.jsx(Hn,{ref:a,className:N("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(ka,{className:"h-4 w-4"})}));$r.displayName=Hn.displayName;const J=u.forwardRef(({className:s,children:n,position:a="popper",...l},r)=>e.jsx(Ii,{children:e.jsxs(Kn,{ref:r,className:N("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:a,...l,children:[e.jsx(Ar,{}),e.jsx(Vi,{className:N("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx($r,{})]})}));J.displayName=Kn.displayName;const Wd=u.forwardRef(({className:s,...n},a)=>e.jsx(Bn,{ref:a,className:N("px-2 py-1.5 text-sm font-semibold",s),...n}));Wd.displayName=Bn.displayName;const U=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(Gn,{ref:l,className:N("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Oi,{children:e.jsx(zs,{className:"h-4 w-4"})})}),e.jsx(Mi,{children:n})]}));U.displayName=Gn.displayName;const Yd=u.forwardRef(({className:s,...n},a)=>e.jsx(Wn,{ref:a,className:N("-mx-1 my-1 h-px bg-muted",s),...n}));Yd.displayName=Wn.displayName;function Hs({className:s,classNames:n,showOutsideDays:a=!0,...l}){return e.jsx(zi,{showOutsideDays:a,className:N("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:N(Js({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:N("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:N(Js({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:r,...c})=>e.jsx(Yn,{className:N("h-4 w-4",r),...c}),IconRight:({className:r,...c})=>e.jsx(Ca,{className:N("h-4 w-4",r),...c})},...l})}Hs.displayName="Calendar";const xs=Ai,hs=$i,os=u.forwardRef(({className:s,align:n="center",sideOffset:a=4,...l},r)=>e.jsx(Li,{children:e.jsx(Qn,{ref:r,align:n,sideOffset:a,className:N("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})}));os.displayName=Qn.displayName;const Ts={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},it=s=>(s/100).toFixed(2),Qd=({active:s,payload:n,label:a})=>{const{t:l}=M();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:a}),n.map((r,c)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:r.color}}),e.jsxs("span",{className:"text-muted-foreground",children:[l(r.name),":"]}),e.jsx("span",{className:"font-medium",children:r.name.includes(l("dashboard:overview.amount"))?`¥${it(r.value)}`:l("dashboard:overview.transactions",{count:r.value})})]},c))]}):null},Jd=[{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"}],Zd=(s,n)=>{const a=new Date;if(s==="custom"&&n)return{startDate:n.from,endDate:n.to};let l;switch(s){case"7d":l=ts(a,7);break;case"30d":l=ts(a,30);break;case"90d":l=ts(a,90);break;case"180d":l=ts(a,180);break;case"365d":l=ts(a,365);break;default:l=ts(a,30)}return{startDate:l,endDate:a}};function Xd(){const[s,n]=u.useState("amount"),[a,l]=u.useState("30d"),[r,c]=u.useState({from:ts(new Date,7),to:new Date}),{t:o}=M(),{startDate:m,endDate:x}=Zd(a,r),{data:i}=ie({queryKey:["orderStat",{start_date:ss(m,"yyyy-MM-dd"),end_date:ss(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:d}=await Bc({start_date:ss(m,"yyyy-MM-dd"),end_date:ss(x,"yyyy-MM-dd")});return d},refetchInterval:3e4});return e.jsxs(He,{children:[e.jsx(Qe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(vs,{children:o("dashboard:overview.title")}),e.jsxs(Qs,{children:[i?.summary.start_date," ",o("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:a,onValueChange:d=>l(d),children:[e.jsx(Q,{className:"w-[120px]",children:e.jsx(ee,{placeholder:o("dashboard:overview.selectTimeRange")})}),e.jsx(J,{children:Jd.map(d=>e.jsx(U,{value:d.value,children:o(d.label)},d.value))})]}),a==="custom"&&e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:N("min-w-0 justify-start text-left font-normal",!r&&"text-muted-foreground"),children:[e.jsx(pt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:r?.from?r.to?e.jsxs(e.Fragment,{children:[ss(r.from,"yyyy-MM-dd")," -"," ",ss(r.to,"yyyy-MM-dd")]}):ss(r.from,"yyyy-MM-dd"):o("dashboard:overview.selectDate")})]})}),e.jsx(os,{className:"w-auto p-0",align:"end",children:e.jsx(Hs,{mode:"range",defaultMonth:r?.from,selected:{from:r?.from,to:r?.to},onSelect:d=>{d?.from&&d?.to&&c({from:d.from,to:d.to})},numberOfMonths:2})})]})]}),e.jsx(Ra,{value:s,onValueChange:d=>n(d),children:e.jsxs(Gt,{children:[e.jsx(Es,{value:"amount",children:o("dashboard:overview.amount")}),e.jsx(Es,{value:"count",children:o("dashboard:overview.count")})]})})]})]})}),e.jsxs(Je,{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:o("dashboard:overview.totalIncome")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",it(i?.summary?.paid_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:o("dashboard:overview.totalTransactions",{count:i?.summary?.paid_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[o("dashboard:overview.avgOrderAmount")," ¥",it(i?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:o("dashboard:overview.totalCommission")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",it(i?.summary?.commission_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:o("dashboard:overview.totalTransactions",{count:i?.summary?.commission_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[o("dashboard:overview.commissionRate")," ",i?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]}),e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(qi,{width:"100%",height:"100%",children:e.jsxs(Ui,{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:Ts.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Ts.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:Ts.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Ts.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(Hi,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>ss(new Date(d),"MM-dd",{locale:Wi})}),e.jsx(Ki,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>s==="amount"?`¥${it(d)}`:o("dashboard:overview.transactions",{count:d})}),e.jsx(Bi,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(Gi,{content:e.jsx(Qd,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(Ba,{type:"monotone",dataKey:"paid_total",name:o("dashboard:overview.orderAmount"),stroke:Ts.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(Ba,{type:"monotone",dataKey:"commission_total",name:o("dashboard:overview.commissionAmount"),stroke:Ts.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ga,{dataKey:"paid_count",name:o("dashboard:overview.orderCount"),fill:Ts.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(Ga,{dataKey:"commission_count",name:o("dashboard:overview.commissionCount"),fill:Ts.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})]})]})}function oe({className:s,...n}){return e.jsx("div",{className:N("animate-pulse rounded-md bg-primary/10",s),...n})}function em(){return e.jsxs(He,{children:[e.jsxs(Qe,{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(Je,{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 sm(){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(em,{},n))})}var re=(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))(re||{});const rt={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},lt={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var as=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(as||{}),ue=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(ue||{});const yt={0:"待确认",1:"发放中",2:"有效",3:"无效"},Nt={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var Te=(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))(Te||{});const tm={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var ke=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s))(ke||{});const Ms=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"}],js={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a"};var Ue=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(Ue||{});const am={1:"按金额优惠",2:"按比例优惠"};var Rs=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(Rs||{}),Oe=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(Oe||{}),dt=(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))(dt||{});function Ds({title:s,value:n,icon:a,trend:l,description:r,onClick:c,highlight:o,className:m}){return e.jsxs(He,{className:N("transition-colors",c&&"cursor-pointer hover:bg-muted/50",o&&"border-primary/50",m),onClick:c,children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(vs,{className:"text-sm font-medium",children:s}),a]}),e.jsxs(Je,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n}),l?e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(eo,{className:N("h-4 w-4",l.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:N("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:r})]})]})}function nm({className:s}){const n=Ns(),{t:a}=M(),{data:l,isLoading:r}=ie({queryKey:["dashboardStats"],queryFn:async()=>(await Gc()).data,refetchInterval:1e3*60*5});if(r||!l)return e.jsx(sm,{});const c=()=>{const o=new URLSearchParams;o.set("commission_status",ue.PENDING.toString()),o.set("status",re.COMPLETED.toString()),o.set("commission_balance","gt:0"),n(`/finance/order?${o.toString()}`)};return e.jsxs("div",{className:N("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx(Ds,{title:a("dashboard:stats.todayIncome"),value:Os(l.todayIncome),icon:e.jsx(Yi,{className:"h-4 w-4 text-emerald-500"}),trend:{value:l.dayIncomeGrowth,label:a("dashboard:stats.vsYesterday"),isPositive:l.dayIncomeGrowth>0}}),e.jsx(Ds,{title:a("dashboard:stats.monthlyIncome"),value:Os(l.currentMonthIncome),icon:e.jsx(Qi,{className:"h-4 w-4 text-blue-500"}),trend:{value:l.monthIncomeGrowth,label:a("dashboard:stats.vsLastMonth"),isPositive:l.monthIncomeGrowth>0}}),e.jsx(Ds,{title:a("dashboard:stats.pendingTickets"),value:l.ticketPendingTotal,icon:e.jsx(Ji,{className:N("h-4 w-4",l.ticketPendingTotal>0?"text-orange-500":"text-muted-foreground")}),description:l.ticketPendingTotal>0?a("dashboard:stats.hasPendingTickets"):a("dashboard:stats.noPendingTickets"),onClick:()=>n("/user/ticket"),highlight:l.ticketPendingTotal>0}),e.jsx(Ds,{title:a("dashboard:stats.pendingCommission"),value:l.commissionPendingTotal,icon:e.jsx(Zi,{className:N("h-4 w-4",l.commissionPendingTotal>0?"text-blue-500":"text-muted-foreground")}),description:l.commissionPendingTotal>0?a("dashboard:stats.hasPendingCommission"):a("dashboard:stats.noPendingCommission"),onClick:c,highlight:l.commissionPendingTotal>0}),e.jsx(Ds,{title:a("dashboard:stats.monthlyNewUsers"),value:l.currentMonthNewUsers,icon:e.jsx(xa,{className:"h-4 w-4 text-blue-500"}),trend:{value:l.userGrowth,label:a("dashboard:stats.vsLastMonth"),isPositive:l.userGrowth>0}}),e.jsx(Ds,{title:a("dashboard:stats.totalUsers"),value:l.totalUsers,icon:e.jsx(xa,{className:"h-4 w-4 text-muted-foreground"}),description:a("dashboard:stats.activeUsers",{count:l.activeUsers})}),e.jsx(Ds,{title:a("dashboard:stats.monthlyUpload"),value:ds(l.monthTraffic.upload),icon:e.jsx(ut,{className:"h-4 w-4 text-emerald-500"}),description:a("dashboard:stats.todayTraffic",{value:ds(l.todayTraffic.upload)})}),e.jsx(Ds,{title:a("dashboard:stats.monthlyDownload"),value:ds(l.monthTraffic.download),icon:e.jsx(Xi,{className:"h-4 w-4 text-blue-500"}),description:a("dashboard:stats.todayTraffic",{value:ds(l.todayTraffic.download)})})]})}const Xs=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(Jn,{ref:l,className:N("relative overflow-hidden",s),...a,children:[e.jsx(so,{className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(Ft,{}),e.jsx(to,{})]}));Xs.displayName=Jn.displayName;const Ft=u.forwardRef(({className:s,orientation:n="vertical",...a},l)=>e.jsx(Zn,{ref:l,orientation:n,className:N("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),...a,children:e.jsx(ao,{className:"relative flex-1 rounded-full bg-border"})}));Ft.displayName=Zn.displayName;const va={today:{getValue:()=>{const s=ro();return{start:s,end:lo(s,1)}}},last7days:{getValue:()=>{const s=new Date;return{start:ts(s,7),end:s}}},last30days:{getValue:()=>{const s=new Date;return{start:ts(s,30),end:s}}},custom:{getValue:()=>null}};function an({selectedRange:s,customDateRange:n,onRangeChange:a,onCustomRangeChange:l}){const{t:r}=M(),c={today:r("dashboard:trafficRank.today"),last7days:r("dashboard:trafficRank.last7days"),last30days:r("dashboard:trafficRank.last30days"),custom:r("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:a,children:[e.jsx(Q,{className:"w-[120px]",children:e.jsx(ee,{placeholder:r("dashboard:trafficRank.selectTimeRange")})}),e.jsx(J,{position:"popper",className:"z-50",children:Object.entries(va).map(([o])=>e.jsx(U,{value:o,children:c[o]},o))})]}),s==="custom"&&e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:N("min-w-0 justify-start text-left font-normal",!n&&"text-muted-foreground"),children:[e.jsx(pt,{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:[ss(n.from,"yyyy-MM-dd")," -"," ",ss(n.to,"yyyy-MM-dd")]}):ss(n.from,"yyyy-MM-dd"):e.jsx("span",{children:r("dashboard:trafficRank.selectDateRange")})})]})}),e.jsx(os,{className:"w-auto p-0",align:"end",children:e.jsx(Hs,{mode:"range",defaultMonth:n?.from,selected:{from:n?.from,to:n?.to},onSelect:o=>{o?.from&&o?.to&&l({from:o.from,to:o.to})},numberOfMonths:2})})]})]})}const Bs=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function rm({className:s}){const{t:n}=M(),[a,l]=u.useState("today"),[r,c]=u.useState({from:ts(new Date,7),to:new Date}),[o,m]=u.useState("today"),[x,i]=u.useState({from:ts(new Date,7),to:new Date}),d=u.useMemo(()=>a==="custom"?{start:r.from,end:r.to}:va[a].getValue(),[a,r]),p=u.useMemo(()=>o==="custom"?{start:x.from,end:x.to}:va[o].getValue(),[o,x]),{data:C}=ie({queryKey:["nodeTrafficRank",d.start,d.end],queryFn:()=>sn({type:"node",start_time:Ce.round(d.start.getTime()/1e3),end_time:Ce.round(d.end.getTime()/1e3)}),refetchInterval:3e4}),{data:P}=ie({queryKey:["userTrafficRank",p.start,p.end],queryFn:()=>sn({type:"user",start_time:Ce.round(p.start.getTime()/1e3),end_time:Ce.round(p.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:N("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(He,{children:[e.jsx(Qe,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(vs,{className:"flex items-center text-base font-medium",children:[e.jsx(no,{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:a,customDateRange:r,onRangeChange:l,onCustomRangeChange:c}),e.jsx(Wa,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Je,{className:"flex-1",children:C?.data?e.jsxs(Xs,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:C.data.map(f=>e.jsx(pe,{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:f.name}),e.jsxs("span",{className:N("ml-2 flex items-center text-xs font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?e.jsx(ha,{className:"mr-1 h-3 w-3"}):e.jsx(fa,{className:"mr-1 h-3 w-3"}),Math.abs(f.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:`${f.value/C.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Bs(f.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:Bs(f.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:Bs(f.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:N("font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?"+":"",f.change,"%"]})]})})]})},f.id))}),e.jsx(Ft,{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(He,{children:[e.jsx(Qe,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(vs,{className:"flex items-center text-base font-medium",children:[e.jsx(xa,{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:o,customDateRange:x,onRangeChange:m,onCustomRangeChange:i}),e.jsx(Wa,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Je,{className:"flex-1",children:P?.data?e.jsxs(Xs,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:P.data.map(f=>e.jsx(pe,{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:f.name}),e.jsxs("span",{className:N("ml-2 flex items-center text-xs font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?e.jsx(ha,{className:"mr-1 h-3 w-3"}):e.jsx(fa,{className:"mr-1 h-3 w-3"}),Math.abs(f.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:`${f.value/P.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Bs(f.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:Bs(f.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:Bs(f.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:N("font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?"+":"",f.change,"%"]})]})})]})},f.id))}),e.jsx(Ft,{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 lm=Fs("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 K({className:s,variant:n,...a}){return e.jsx("div",{className:N(lm({variant:n}),s),...a})}const le=window?.settings?.secure_path,qr=5*60*1e3,ba=new Map,im=s=>{const n=ba.get(s);return n?Date.now()-n.timestamp>qr?(ba.delete(s),null):n.data:null},om=(s,n)=>{ba.set(s,{data:n,timestamp:Date.now()})},cm=async(s,n=qr)=>{const a=im(s);if(a)return a;const l=await V.get(s);return om(s,l),l},zt={getList:s=>V.post(`${le}/user/fetch`,s),update:s=>V.post(`${le}/user/update`,s),resetSecret:s=>V.post(`${le}/user/resetSecret`,{id:s}),generate:s=>V.post(`${le}/user/generate`,s),getStats:s=>V.post(`${le}/stat/getStatUser`,s),destroy:s=>V.post(`${le}/user/destroy`,{id:s}),sendMail:s=>V.post(`${le}/user/sendMail`,s),dumpCSV:s=>V.post(`${le}/user/dumpCSV`,s,{responseType:"blob"}),batchBan:s=>V.post(`${le}/user/ban`,s)},nn={getList:()=>cm(`${le}/notice/fetch`),save:s=>V.post(`${le}/notice/save`,s),drop:s=>V.post(`${le}/notice/drop`,{id:s}),updateStatus:s=>V.post(`${le}/notice/show`,{id:s}),sort:s=>V.post(`${le}/notice/sort`,{ids:s})},ra={getList:s=>V.post(`${le}/ticket/fetch`,s),getInfo:s=>V.get(`${le}/ticket/fetch?id=${s}`),reply:s=>V.post(`${le}/ticket/reply`,s),close:s=>V.post(`${le}/ticket/close`,{id:s})},rn={getSystemStatus:()=>V.get(`${le}/system/getSystemStatus`),getQueueStats:()=>V.get(`${le}/system/getQueueStats`),getQueueWorkload:()=>V.get(`${le}/system/getQueueWorkload`),getQueueMasters:()=>V.get(`${le}/system/getQueueMasters`),getSystemLog:s=>V.get(`${le}/system/getSystemLog`,{params:s})},gs={getPluginList:()=>V.get(`${le}/plugin/getPlugins`),uploadPlugin:s=>{const n=new FormData;return n.append("file",s),V.post(`${le}/plugin/upload`,n,{headers:{"Content-Type":"multipart/form-data"}})},deletePlugin:s=>V.post(`${le}/plugin/delete`,{code:s}),installPlugin:s=>V.post(`${le}/plugin/install`,{code:s}),uninstallPlugin:s=>V.post(`${le}/plugin/uninstall`,{code:s}),enablePlugin:s=>V.post(`${le}/plugin/enable`,{code:s}),disablePlugin:s=>V.post(`${le}/plugin/disable`,{code:s}),getPluginConfig:s=>V.get(`${le}/plugin/config`,{params:{code:s}}),updatePluginConfig:(s,n)=>V.post(`${le}/plugin/config`,{code:s,config:n})},Dt=u.forwardRef(({className:s,value:n,...a},l)=>e.jsx(Xn,{ref:l,className:N("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...a,children:e.jsx(io,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));Dt.displayName=Xn.displayName;function dm(){const{t:s}=M(),[n,a]=u.useState(null),[l,r]=u.useState(null),[c,o]=u.useState(!0),[m,x]=u.useState(!1),i=async()=>{try{x(!0);const[C,P]=await Promise.all([rn.getSystemStatus(),rn.getQueueStats()]);a(C.data),r(P.data)}catch(C){console.error("Error fetching system data:",C)}finally{o(!1),x(!1)}};u.useEffect(()=>{i();const C=setInterval(i,3e4);return()=>clearInterval(C)},[]);const d=()=>{i()};if(c)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(Ta,{className:"h-6 w-6 animate-spin"})});const p=C=>C?e.jsx(er,{className:"h-5 w-5 text-green-500"}):e.jsx(sr,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(He,{children:[e.jsxs(Qe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(vs,{className:"flex items-center gap-2",children:[e.jsx(oo,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Qs,{children:s("dashboard:queue.status.description")})]}),e.jsx(G,{variant:"outline",size:"icon",onClick:d,disabled:m,children:e.jsx(co,{className:N("h-4 w-4",m&&"animate-spin")})})]}),e.jsx(Je,{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:[p(l?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(K,{variant:l?.status?"secondary":"destructive",children:l?.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:l?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(pe,{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:l?.recentJobs||0}),e.jsx(Dt,{value:(l?.recentJobs||0)/(l?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:l?.periods?.recentJobs||0})})})]})}),e.jsx(pe,{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:l?.jobsPerMinute||0}),e.jsx(Dt,{value:(l?.jobsPerMinute||0)/(l?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:l?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(He,{children:[e.jsxs(Qe,{children:[e.jsxs(vs,{className:"flex items-center gap-2",children:[e.jsx(mo,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Qs,{children:s("dashboard:queue.details.description")})]}),e.jsx(Je,{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.jsx("p",{className:"text-2xl font-bold text-destructive",children:l?.failedJobs||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("dashboard:queue.details.retentionPeriod",{hours:l?.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:[l?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:l?.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:[l?.processes||0," /"," ",(l?.processes||0)+(l?.pausedMasters||0)]})]}),e.jsx(Dt,{value:(l?.processes||0)/((l?.processes||0)+(l?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]})}function mm(){const{t:s}=M();return e.jsxs(Pe,{children:[e.jsxs(Ee,{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($e,{}),e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsx(Ve,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(nm,{}),e.jsx(Xd,{}),e.jsx(rm,{}),e.jsx(dm,{})]})})})]})}const um=Object.freeze(Object.defineProperty({__proto__:null,default:mm},Symbol.toStringTag,{value:"Module"})),Se=u.forwardRef(({className:s,orientation:n="horizontal",decorative:a=!0,...l},r)=>e.jsx(tr,{ref:r,decorative:a,orientation:n,className:N("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...l}));Se.displayName=tr.displayName;function xm({className:s,items:n,...a}){const{pathname:l}=Na(),r=Ns(),[c,o]=u.useState(l??"/settings"),m=i=>{o(i),r(i)},{t:x}=M("settings");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(X,{value:c,onValueChange:m,children:[e.jsx(Q,{className:"h-12 sm:w-48",children:e.jsx(ee,{placeholder:"Theme"})}),e.jsx(J,{children:n.map(i=>e.jsx(U,{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:x(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:N("flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",s),...a,children:n.map(i=>e.jsxs(Ls,{to:i.href,className:N(et({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}),x(i.title)]},i.href))})})]})}const hm=[{title:"site.title",key:"site",icon:e.jsx(uo,{size:18}),href:"/config/system",description:"site.description"},{title:"safe.title",key:"safe",icon:e.jsx(In,{size:18}),href:"/config/system/safe",description:"safe.description"},{title:"subscribe.title",key:"subscribe",icon:e.jsx(Vn,{size:18}),href:"/config/system/subscribe",description:"subscribe.description"},{title:"invite.title",key:"invite",icon:e.jsx(xo,{size:18}),href:"/config/system/invite",description:"invite.description"},{title:"server.title",key:"server",icon:e.jsx(Rn,{size:18}),href:"/config/system/server",description:"server.description"},{title:"email.title",key:"email",icon:e.jsx(ho,{size:18}),href:"/config/system/email",description:"email.description"},{title:"telegram.title",key:"telegram",icon:e.jsx(fo,{size:18}),href:"/config/system/telegram",description:"telegram.description"},{title:"app.title",key:"app",icon:e.jsx(En,{size:18}),href:"/config/system/app",description:"app.description"}];function fm(){const{t:s}=M("settings");return e.jsxs(Pe,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(Se,{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(xm,{items:hm})}),e.jsx("div",{className:"w-full p-1 pr-4 lg:max-w-xl",children:e.jsx("div",{className:"pb-16",children:e.jsx(_a,{})})})]})]})]})}const pm=Object.freeze(Object.defineProperty({__proto__:null,default:fm},Symbol.toStringTag,{value:"Module"})),W=u.forwardRef(({className:s,...n},a)=>e.jsx(ar,{className:N("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:a,children:e.jsx(po,{className:N("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")})}));W.displayName=ar.displayName;const fs=u.forwardRef(({className:s,...n},a)=>e.jsx("textarea",{className:N("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...n}));fs.displayName="Textarea";const gm=h.object({logo:h.string().nullable().default(""),force_https:h.number().nullable().default(0),stop_register:h.number().nullable().default(0),app_name:h.string().nullable().default(""),app_description:h.string().nullable().default(""),app_url:h.string().nullable().default(""),subscribe_url:h.string().nullable().default(""),try_out_plan_id:h.number().nullable().default(0),try_out_hour:h.coerce.number().nullable().default(0),tos_url:h.string().nullable().default(""),currency:h.string().nullable().default(""),currency_symbol:h.string().nullable().default("")});function jm(){const{t:s}=M("settings"),[n,a]=u.useState(!1),l=u.useRef(null),{data:r}=ie({queryKey:["settings","site"],queryFn:()=>Cs("site")}),{data:c}=ie({queryKey:["plans"],queryFn:()=>Us()}),o=je({resolver:Ne(gm),defaultValues:{},mode:"onBlur"}),{mutateAsync:m}=ms({mutationFn:Ss,onSuccess:d=>{d.data&&$.success(s("common.autoSaved"))}});u.useEffect(()=>{if(r?.data?.site){const d=r?.data?.site;Object.entries(d).forEach(([p,C])=>{o.setValue(p,C)}),l.current=d}},[r]);const x=u.useCallback(Ce.debounce(async d=>{if(!Ce.isEqual(d,l.current)){a(!0);try{const p=Object.entries(d).reduce((C,[P,f])=>(C[P]=f===null?"":f,C),{});await m(p),l.current=d}finally{a(!1)}}},1e3),[m]),i=u.useCallback(d=>{x(d)},[x]);return u.useEffect(()=>{const d=o.watch(p=>{i(p)});return()=>d.unsubscribe()},[o.watch,i]),e.jsx(_e,{...o,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:o.control,name:"app_name",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.siteName.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("site.form.siteName.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),i(o.getValues())}})}),e.jsx(z,{children:s("site.form.siteName.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:o.control,name:"app_description",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.siteDescription.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("site.form.siteDescription.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),i(o.getValues())}})}),e.jsx(z,{children:s("site.form.siteDescription.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:o.control,name:"app_url",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.siteUrl.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("site.form.siteUrl.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),i(o.getValues())}})}),e.jsx(z,{children:s("site.form.siteUrl.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:o.control,name:"force_https",render:({field:d})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("site.form.forceHttps.label")}),e.jsx(z,{children:s("site.form.forceHttps.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:!!d.value,onCheckedChange:p=>{d.onChange(Number(p)),i(o.getValues())}})})]})}),e.jsx(b,{control:o.control,name:"logo",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.logo.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("site.form.logo.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),i(o.getValues())}})}),e.jsx(z,{children:s("site.form.logo.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:o.control,name:"subscribe_url",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.subscribeUrl.label")}),e.jsx(_,{children:e.jsx(fs,{placeholder:s("site.form.subscribeUrl.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),i(o.getValues())}})}),e.jsx(z,{children:s("site.form.subscribeUrl.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:o.control,name:"tos_url",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.tosUrl.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("site.form.tosUrl.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),i(o.getValues())}})}),e.jsx(z,{children:s("site.form.tosUrl.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:o.control,name:"stop_register",render:({field:d})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("site.form.stopRegister.label")}),e.jsx(z,{children:s("site.form.stopRegister.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:!!d.value,onCheckedChange:p=>{d.onChange(Number(p)),i(o.getValues())}})})]})}),e.jsx(b,{control:o.control,name:"try_out_plan_id",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.tryOut.label")}),e.jsx(_,{children:e.jsxs(X,{value:d.value?.toString(),onValueChange:p=>{d.onChange(Number(p)),i(o.getValues())},children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:s("site.form.tryOut.placeholder")})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:s("site.form.tryOut.placeholder")}),c?.data?.map(p=>e.jsx(U,{value:p.id.toString(),children:p.name},p.id.toString()))]})]})}),e.jsx(z,{children:s("site.form.tryOut.description")}),e.jsx(T,{})]})}),!!o.watch("try_out_plan_id")&&e.jsx(b,{control:o.control,name:"try_out_hour",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"",children:s("site.form.tryOut.duration.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("site.form.tryOut.duration.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),i(o.getValues())}})}),e.jsx(z,{children:s("site.form.tryOut.duration.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:o.control,name:"currency",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.currency.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("site.form.currency.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),i(o.getValues())}})}),e.jsx(z,{children:s("site.form.currency.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:o.control,name:"currency_symbol",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("site.form.currencySymbol.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("site.form.currencySymbol.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),i(o.getValues())}})}),e.jsx(z,{children:s("site.form.currencySymbol.description")}),e.jsx(T,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("site.form.saving")})]})})}function vm(){const{t:s}=M("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(Se,{}),e.jsx(jm,{})]})}const bm=Object.freeze(Object.defineProperty({__proto__:null,default:vm},Symbol.toStringTag,{value:"Module"})),ym=h.object({email_verify:h.boolean().nullable(),safe_mode_enable:h.boolean().nullable(),secure_path:h.string().nullable(),email_whitelist_enable:h.boolean().nullable(),email_whitelist_suffix:h.array(h.string().nullable()).nullable(),email_gmail_limit_enable:h.boolean().nullable(),recaptcha_enable:h.boolean().nullable(),recaptcha_key:h.string().nullable(),recaptcha_site_key:h.string().nullable(),register_limit_by_ip_enable:h.boolean().nullable(),register_limit_count:h.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:h.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:h.boolean().nullable(),password_limit_count:h.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:h.coerce.string().transform(s=>s===""?null:s).nullable()}),Nm={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 _m(){const{t:s}=M("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=je({resolver:Ne(ym),defaultValues:Nm,mode:"onBlur"}),{data:c}=ie({queryKey:["settings","safe"],queryFn:()=>Cs("safe")}),{mutateAsync:o}=ms({mutationFn:Ss,onSuccess:i=>{i.data&&$.success(s("common.autoSaved"))}});u.useEffect(()=>{if(c?.data.safe){const i=c.data.safe;Object.entries(i).forEach(([d,p])=>{typeof p=="number"?r.setValue(d,String(p)):r.setValue(d,p)}),l.current=i}},[c]);const m=u.useCallback(Ce.debounce(async i=>{if(!Ce.isEqual(i,l.current)){a(!0);try{await o(i),l.current=i}finally{a(!1)}}},1e3),[o]),x=u.useCallback(i=>{m(i)},[m]);return u.useEffect(()=>{const i=r.watch(d=>{x(d)});return()=>i.unsubscribe()},[r.watch,x]),e.jsx(_e,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"email_verify",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.emailVerify.label")}),e.jsx(z,{children:s("safe.form.emailVerify.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"email_gmail_limit_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.gmailLimit.label")}),e.jsx(z,{children:s("safe.form.gmailLimit.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"safe_mode_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.safeMode.label")}),e.jsx(z,{children:s("safe.form.safeMode.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"secure_path",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.securePath.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.securePath.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),x(r.getValues())}})}),e.jsx(z,{children:s("safe.form.securePath.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"email_whitelist_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.emailWhitelist.label")}),e.jsx(z,{children:s("safe.form.emailWhitelist.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),r.watch("email_whitelist_enable")&&e.jsx(b,{control:r.control,name:"email_whitelist_suffix",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.emailWhitelist.suffixes.label")}),e.jsx(_,{children:e.jsx(fs,{placeholder:s("safe.form.emailWhitelist.suffixes.placeholder"),...i,value:(i.value||[]).join(` `),onChange:d=>{const p=d.target.value.split(` -`).filter(Boolean);o.onChange(p),x(r.getValues())}})}),e.jsx(M,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"recaptcha_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.recaptcha.enable.label")}),e.jsx(M,{children:s("safe.form.recaptcha.enable.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),r.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:r.control,name:"recaptcha_key",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.recaptcha.key.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.recaptcha.key.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(M,{children:s("safe.form.recaptcha.key.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"recaptcha_site_key",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.recaptcha.siteKey.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.recaptcha.siteKey.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(M,{children:s("safe.form.recaptcha.siteKey.description")}),e.jsx(E,{})]})})]}),e.jsx(b,{control:r.control,name:"register_limit_by_ip_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(M,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),r.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:r.control,name:"register_limit_count",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.registerLimit.count.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.registerLimit.count.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(M,{children:s("safe.form.registerLimit.count.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"register_limit_expire",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.registerLimit.expire.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.registerLimit.expire.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(M,{children:s("safe.form.registerLimit.expire.description")}),e.jsx(E,{})]})})]}),e.jsx(b,{control:r.control,name:"password_limit_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.passwordLimit.enable.label")}),e.jsx(M,{children:s("safe.form.passwordLimit.enable.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),r.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:r.control,name:"password_limit_count",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.passwordLimit.count.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.passwordLimit.count.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(M,{children:s("safe.form.passwordLimit.count.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"password_limit_expire",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.passwordLimit.expire.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.passwordLimit.expire.placeholder"),...o,value:o.value||"",onChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(M,{children:s("safe.form.passwordLimit.expire.description")}),e.jsx(E,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("safe.form.saving")})]})})}function gm(){const{t:s}=F("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(we,{}),e.jsx(pm,{})]})}const jm=Object.freeze(Object.defineProperty({__proto__:null,default:gm},Symbol.toStringTag,{value:"Module"})),vm=h.object({plan_change_enable:h.boolean().nullable().default(!1),reset_traffic_method:h.coerce.number().nullable().default(0),surplus_enable:h.boolean().nullable().default(!1),new_order_event_id:h.coerce.number().nullable().default(0),renew_order_event_id:h.coerce.number().nullable().default(0),change_order_event_id:h.coerce.number().nullable().default(0),show_info_to_server_enable:h.boolean().nullable().default(!1),show_protocol_to_server_enable:h.boolean().nullable().default(!1),default_remind_expire:h.boolean().nullable().default(!1),default_remind_traffic:h.boolean().nullable().default(!1),subscribe_path:h.string().nullable().default("s")}),bm={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 ym(){const{t:s}=F("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=he({resolver:ge(vm),defaultValues:bm,mode:"onBlur"}),{data:c}=ne({queryKey:["settings","subscribe"],queryFn:()=>ys("subscribe")}),{mutateAsync:i}=ds({mutationFn:Ns,onSuccess:o=>{o.data&&A.success(s("common.autoSaved"))}});u.useEffect(()=>{if(c?.data?.subscribe){const o=c?.data?.subscribe;Object.entries(o).forEach(([d,p])=>{r.setValue(d,p)}),l.current=o}},[c]);const m=u.useCallback(_e.debounce(async o=>{if(!_e.isEqual(o,l.current)){a(!0);try{await i(o),l.current=o}finally{a(!1)}}},1e3),[i]),x=u.useCallback(o=>{m(o)},[m]);return u.useEffect(()=>{const o=r.watch(d=>{x(d)});return()=>o.unsubscribe()},[r.watch,x]),e.jsx(je,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"plan_change_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.plan_change_enable.title")}),e.jsx(M,{children:s("subscribe.plan_change_enable.description")}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"reset_traffic_method",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.reset_traffic_method.title")}),e.jsxs(J,{onValueChange:o.onChange,value:o.value?.toString()||"0",children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Z,{placeholder:"请选择重置方式"})})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:s("subscribe.reset_traffic_method.options.monthly_first")}),e.jsx(q,{value:"1",children:s("subscribe.reset_traffic_method.options.monthly_reset")}),e.jsx(q,{value:"2",children:s("subscribe.reset_traffic_method.options.no_reset")}),e.jsx(q,{value:"3",children:s("subscribe.reset_traffic_method.options.yearly_first")}),e.jsx(q,{value:"4",children:s("subscribe.reset_traffic_method.options.yearly_reset")})]})]}),e.jsx(M,{children:s("subscribe.reset_traffic_method.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"surplus_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.surplus_enable.title")}),e.jsx(M,{children:s("subscribe.surplus_enable.description")}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"new_order_event_id",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.new_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(_,{children:e.jsxs(J,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:"请选择"})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:s("subscribe.new_order_event.options.no_action")}),e.jsx(q,{value:"1",children:s("subscribe.new_order_event.options.reset_traffic")})]})]})})}),e.jsx(M,{children:s("subscribe.new_order_event.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"renew_order_event_id",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.renew_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(_,{children:e.jsxs(J,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:"请选择"})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:s("subscribe.renew_order_event.options.no_action")}),e.jsx(q,{value:"1",children:s("subscribe.renew_order_event.options.reset_traffic")})]})]})})}),e.jsx(M,{children:s("renew_order_event.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"change_order_event_id",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.change_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(_,{children:e.jsxs(J,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:"请选择"})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:s("subscribe.change_order_event.options.no_action")}),e.jsx(q,{value:"1",children:s("subscribe.change_order_event.options.reset_traffic")})]})]})})}),e.jsx(M,{children:s("subscribe.change_order_event.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"subscribe_path",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.subscribe_path.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:"subscribe",...o,value:o.value||"",onChange:d=>{o.onChange(d),x(r.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(E,{})]})}),e.jsx(b,{control:r.control,name:"show_info_to_server_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("subscribe.show_info_to_server.title")}),e.jsx(M,{children:s("subscribe.show_info_to_server.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"show_protocol_to_server_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("subscribe.show_protocol_to_server.title")}),e.jsx(M,{children:s("subscribe.show_protocol_to_server.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Nm(){const{t:s}=F("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(we,{}),e.jsx(ym,{})]})}const _m=Object.freeze(Object.defineProperty({__proto__:null,default:Nm},Symbol.toStringTag,{value:"Module"})),wm=h.object({invite_force:h.boolean().default(!1),invite_commission:h.coerce.string().default("0"),invite_gen_limit:h.coerce.string().default("0"),invite_never_expire:h.boolean().default(!1),commission_first_time_enable:h.boolean().default(!1),commission_auto_check_enable:h.boolean().default(!1),commission_withdraw_limit:h.coerce.string().default("0"),commission_withdraw_method:h.array(h.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:h.boolean().default(!1),commission_distribution_enable:h.boolean().default(!1),commission_distribution_l1:h.coerce.number().default(0),commission_distribution_l2:h.coerce.number().default(0),commission_distribution_l3:h.coerce.number().default(0)}),Cm={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 Sm(){const{t:s}=F("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=he({resolver:ge(wm),defaultValues:Cm,mode:"onBlur"}),{data:c}=ne({queryKey:["settings","invite"],queryFn:()=>ys("invite")}),{mutateAsync:i}=ds({mutationFn:Ns,onSuccess:o=>{o.data&&A.success(s("common.autoSaved"))}});u.useEffect(()=>{if(c?.data?.invite){const o=c?.data?.invite;Object.entries(o).forEach(([d,p])=>{typeof p=="number"?r.setValue(d,String(p)):r.setValue(d,p)}),l.current=o}},[c]);const m=u.useCallback(_e.debounce(async o=>{if(!_e.isEqual(o,l.current)){a(!0);try{await i(o),l.current=o}finally{a(!1)}}},1e3),[i]),x=u.useCallback(o=>{m(o)},[m]);return u.useEffect(()=>{const o=r.watch(d=>{x(d)});return()=>o.unsubscribe()},[r.watch,x]),e.jsx(je,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"invite_force",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.invite_force.title")}),e.jsx(M,{children:s("invite.invite_force.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"invite_commission",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("invite.invite_commission.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("invite.invite_commission.placeholder"),...o,value:o.value||""})}),e.jsx(M,{children:s("invite.invite_commission.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"invite_gen_limit",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("invite.invite_gen_limit.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("invite.invite_gen_limit.placeholder"),...o,value:o.value||""})}),e.jsx(M,{children:s("invite.invite_gen_limit.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"invite_never_expire",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.invite_never_expire.title")}),e.jsx(M,{children:s("invite.invite_never_expire.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"commission_first_time_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.commission_first_time.title")}),e.jsx(M,{children:s("invite.commission_first_time.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"commission_auto_check_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.commission_auto_check.title")}),e.jsx(M,{children:s("invite.commission_auto_check.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"commission_withdraw_limit",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("invite.commission_withdraw_limit.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("invite.commission_withdraw_limit.placeholder"),...o,value:o.value||""})}),e.jsx(M,{children:s("invite.commission_withdraw_limit.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"commission_withdraw_method",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("invite.commission_withdraw_method.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("invite.commission_withdraw_method.placeholder"),...o,value:Array.isArray(o.value)?o.value.join(","):"",onChange:d=>{const p=d.target.value.split(",").filter(Boolean);o.onChange(p),x(r.getValues())}})}),e.jsx(M,{children:s("invite.commission_withdraw_method.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"withdraw_close_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.withdraw_close.title")}),e.jsx(M,{children:s("invite.withdraw_close.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"commission_distribution_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.commission_distribution.title")}),e.jsx(M,{children:s("invite.commission_distribution.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),r.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:r.control,name:"commission_distribution_l1",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:s("invite.commission_distribution.l1")}),e.jsx(_,{children:e.jsx(D,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...o,value:o.value||"",onChange:d=>{const p=d.target.value?Number(d.target.value):0;o.onChange(p),x(r.getValues())}})}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"commission_distribution_l2",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:s("invite.commission_distribution.l2")}),e.jsx(_,{children:e.jsx(D,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...o,value:o.value||"",onChange:d=>{const p=d.target.value?Number(d.target.value):0;o.onChange(p),x(r.getValues())}})}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"commission_distribution_l3",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:s("invite.commission_distribution.l3")}),e.jsx(_,{children:e.jsx(D,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...o,value:o.value||"",onChange:d=>{const p=d.target.value?Number(d.target.value):0;o.onChange(p),x(r.getValues())}})}),e.jsx(E,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("invite.saving")})]})})}function km(){const{t:s}=F("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(we,{}),e.jsx(Sm,{})]})}const Tm=Object.freeze(Object.defineProperty({__proto__:null,default:km},Symbol.toStringTag,{value:"Module"})),Pm=h.object({frontend_theme:h.string().nullable(),frontend_theme_sidebar:h.string().nullable(),frontend_theme_header:h.string().nullable(),frontend_theme_color:h.string().nullable(),frontend_background_url:h.string().url().nullable()}),Dm={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function Em(){const{data:s}=ne({queryKey:["settings","frontend"],queryFn:()=>ys("frontend")}),n=he({resolver:ge(Pm),defaultValues:Dm,mode:"onChange"});u.useEffect(()=>{if(s?.data?.frontend){const l=s?.data?.frontend;Object.entries(l).forEach(([r,c])=>{n.setValue(r,c)})}},[s]);function a(l){Ns(l).then(({data:r})=>{r&&A.success("更新成功")})}return e.jsx(je,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(a),className:"space-y-8",children:[e.jsx(b,{control:n.control,name:"frontend_theme_sidebar",render:({field:l})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:"边栏风格"}),e.jsx(M,{children:"边栏风格"})]}),e.jsx(_,{children:e.jsx(U,{checked:l.value,onCheckedChange:l.onChange})})]})}),e.jsx(b,{control:n.control,name:"frontend_theme_header",render:({field:l})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:"头部风格"}),e.jsx(M,{children:"边栏风格"})]}),e.jsx(_,{children:e.jsx(U,{checked:l.value,onCheckedChange:l.onChange})})]})}),e.jsx(b,{control:n.control,name:"frontend_theme_color",render:({field:l})=>e.jsxs(v,{children:[e.jsx(y,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(_,{children:e.jsxs("select",{className:N(Xs({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(ha,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(M,{children:"主题色"}),e.jsx(E,{})]})}),e.jsx(b,{control:n.control,name:"frontend_background_url",render:({field:l})=>e.jsxs(v,{children:[e.jsx(y,{children:"背景"}),e.jsx(_,{children:e.jsx(D,{placeholder:"请输入图片地址",...l})}),e.jsx(M,{children:"将会在后台登录页面进行展示。"}),e.jsx(E,{})]})}),e.jsx(R,{type:"submit",children:"保存设置"})]})})}function Rm(){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(we,{}),e.jsx(Em,{})]})}const Im=Object.freeze(Object.defineProperty({__proto__:null,default:Rm},Symbol.toStringTag,{value:"Module"})),Vm=h.object({server_pull_interval:h.coerce.number().nullable(),server_push_interval:h.coerce.number().nullable(),server_token:h.string().nullable(),device_limit_mode:h.coerce.number().nullable()}),Fm={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function Mm(){const{t:s}=F("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=he({resolver:ge(Vm),defaultValues:Fm,mode:"onBlur"}),{data:c}=ne({queryKey:["settings","server"],queryFn:()=>ys("server")}),{mutateAsync:i}=ds({mutationFn:Ns,onSuccess:d=>{d.data&&A.success(s("common.AutoSaved"))}});u.useEffect(()=>{if(c?.data.server){const d=c.data.server;Object.entries(d).forEach(([p,k])=>{r.setValue(p,k)}),l.current=d}},[c]);const m=u.useCallback(_e.debounce(async d=>{if(!_e.isEqual(d,l.current)){a(!0);try{await i(d),l.current=d}finally{a(!1)}}},1e3),[i]),x=u.useCallback(d=>{m(d)},[m]);u.useEffect(()=>{const d=r.watch(p=>{x(p)});return()=>d.unsubscribe()},[r.watch,x]);const o=()=>{const d=Math.floor(Math.random()*17)+16,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let k="";for(let I=0;Ie.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("server.server_token.title")}),e.jsx(_,{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(xe,{children:e.jsxs(me,{children:[e.jsx(ue,{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:p=>{p.preventDefault(),o()},children:e.jsx(ci,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(oe,{children:e.jsx("p",{children:s("server.server_token.generate_tooltip")})})]})})]})}),e.jsx(M,{children:s("server.server_token.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"server_pull_interval",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("server.server_pull_interval.title")}),e.jsx(_,{children:e.jsx(D,{type:"number",placeholder:s("server.server_pull_interval.placeholder"),...d,value:d.value||"",onChange:p=>{const k=p.target.value?Number(p.target.value):null;d.onChange(k)}})}),e.jsx(M,{children:s("server.server_pull_interval.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"server_push_interval",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("server.server_push_interval.title")}),e.jsx(_,{children:e.jsx(D,{type:"number",placeholder:s("server.server_push_interval.placeholder"),...d,value:d.value||"",onChange:p=>{const k=p.target.value?Number(p.target.value):null;d.onChange(k)}})}),e.jsx(M,{children:s("server.server_push_interval.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"device_limit_mode",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("server.device_limit_mode.title")}),e.jsxs(J,{onValueChange:d.onChange,value:d.value?.toString()||"0",children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Z,{placeholder:s("server.device_limit_mode.placeholder")})})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:s("server.device_limit_mode.strict")}),e.jsx(q,{value:"1",children:s("server.device_limit_mode.relaxed")})]})]}),e.jsx(M,{children:s("server.device_limit_mode.description")}),e.jsx(E,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("server.saving")})]})})}function Om(){const{t:s}=F("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(we,{}),e.jsx(Mm,{})]})}const zm=Object.freeze(Object.defineProperty({__proto__:null,default:Om},Symbol.toStringTag,{value:"Module"}));function Lm({open:s,onOpenChange:n,result:a}){const l=!a.error;return e.jsx(ve,{open:s,onOpenChange:n,children:e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(Ne,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l?e.jsx(Bn,{className:"h-5 w-5 text-green-500"}):e.jsx(Gn,{className:"h-5 w-5 text-destructive"}),e.jsx(be,{children:l?"邮件发送成功":"邮件发送失败"})]}),e.jsx(Ee,{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:a.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:a.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:a.template_name})]})]}),a.error&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium text-destructive",children:"错误信息"}),e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive break-all",children:a.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(Zs,{className:"h-[200px] rounded-md border p-4",children:e.jsx("div",{className:"grid gap-2 text-sm",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2",children:[e.jsx("div",{className:"text-muted-foreground",children:"驱动"}),e.jsx("div",{children:a.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:a.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:a.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:a.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:a.config.from.address?`${a.config.from.address}${a.config.from.name?` (${a.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:a.config.username||"未设置"})]})})})]})]})]})})}const Am=h.object({email_template:h.string().nullable().default("classic"),email_host:h.string().nullable().default(""),email_port:h.coerce.number().nullable().default(465),email_username:h.string().nullable().default(""),email_password:h.string().nullable().default(""),email_encryption:h.string().nullable().default(""),email_from_address:h.string().email().nullable().default(""),remind_mail_enable:h.boolean().nullable().default(!1)});function $m(){const{t:s}=F("settings"),[n,a]=u.useState(null),[l,r]=u.useState(!1),c=u.useRef(null),[i,m]=u.useState(!1),x=he({resolver:ge(Am),defaultValues:{},mode:"onBlur"}),{data:o}=ne({queryKey:["settings","email"],queryFn:()=>ys("email")}),{data:d}=ne({queryKey:["emailTemplate"],queryFn:()=>Od()}),{mutateAsync:p}=ds({mutationFn:Ns,onSuccess:C=>{C.data&&A.success(s("common.autoSaved"))}}),{mutate:k,isPending:I}=ds({mutationFn:zd,onMutate:()=>{a(null),r(!1)},onSuccess:C=>{a(C.data),r(!0),C.data.error?A.error(s("email.test.error")):A.success(s("email.test.success"))}});u.useEffect(()=>{if(o?.data.email){const C=o.data.email;Object.entries(C).forEach(([g,w])=>{x.setValue(g,w)}),c.current=C}},[o]);const f=u.useCallback(_e.debounce(async C=>{if(!_e.isEqual(C,c.current)){m(!0);try{await p(C),c.current=C}finally{m(!1)}}},1e3),[p]),j=u.useCallback(C=>{f(C)},[f]);return u.useEffect(()=>{const C=x.watch(g=>{j(g)});return()=>C.unsubscribe()},[x.watch,j]),e.jsxs(e.Fragment,{children:[e.jsx(je,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:x.control,name:"email_host",render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_host.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("common.placeholder"),...C,value:C.value||""})}),e.jsx(M,{children:s("email.email_host.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_port",render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_port.title")}),e.jsx(_,{children:e.jsx(D,{type:"number",placeholder:s("common.placeholder"),...C,value:C.value||"",onChange:g=>{const w=g.target.value?Number(g.target.value):null;C.onChange(w)}})}),e.jsx(M,{children:s("email.email_port.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_encryption",render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_encryption.title")}),e.jsxs(J,{onValueChange:C.onChange,value:C.value||"none",children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Z,{placeholder:"请选择加密方式"})})}),e.jsxs(Y,{children:[e.jsx(q,{value:"none",children:s("email.email_encryption.none")}),e.jsx(q,{value:"ssl",children:s("email.email_encryption.ssl")}),e.jsx(q,{value:"tls",children:s("email.email_encryption.tls")})]})]}),e.jsx(M,{children:s("email.email_encryption.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_username",render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_username.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("common.placeholder"),...C,value:C.value||""})}),e.jsx(M,{children:s("email.email_username.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_password",render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_password.title")}),e.jsx(_,{children:e.jsx(D,{type:"password",placeholder:s("common.placeholder"),...C,value:C.value||""})}),e.jsx(M,{children:s("email.email_password.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_from_address",render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_from.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("common.placeholder"),...C,value:C.value||""})}),e.jsx(M,{children:s("email.email_from.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_template",render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_template.title")}),e.jsxs(J,{onValueChange:g=>{C.onChange(g),j(x.getValues())},value:C.value||void 0,children:[e.jsx(_,{children:e.jsx(W,{className:"w-[200px]",children:e.jsx(Z,{placeholder:s("email.email_template.placeholder")})})}),e.jsx(Y,{children:d?.data?.map(g=>e.jsx(q,{value:g,children:g},g))})]}),e.jsx(M,{children:s("email.email_template.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"remind_mail_enable",render:({field:C})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("email.remind_mail.title")}),e.jsx(M,{children:s("email.remind_mail.description")})]}),e.jsx(_,{children:e.jsx(U,{checked:C.value||!1,onCheckedChange:g=>{C.onChange(g),j(x.getValues())}})})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(R,{onClick:()=>k(),loading:I,disabled:I,children:s(I?"test.sending":"test.title")})})]})}),i&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("saving")}),n&&e.jsx(Lm,{open:l,onOpenChange:r,result:n})]})}function qm(){const{t:s}=F("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(we,{}),e.jsx($m,{})]})}const Hm=Object.freeze(Object.defineProperty({__proto__:null,default:qm},Symbol.toStringTag,{value:"Module"})),Km=h.object({telegram_bot_enable:h.boolean().nullable(),telegram_bot_token:h.string().nullable(),telegram_discuss_link:h.string().nullable()}),Um={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function Bm(){const{t:s}=F("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=he({resolver:ge(Km),defaultValues:Um,mode:"onBlur"}),{data:c}=ne({queryKey:["settings","telegram"],queryFn:()=>ys("telegram")}),{mutateAsync:i}=ds({mutationFn:Ns,onSuccess:p=>{p.data&&A.success(s("common.autoSaved"))}}),{mutate:m,isPending:x}=ds({mutationFn:Ld,onSuccess:p=>{p.data&&A.success(s("telegram.webhook.success"))}});u.useEffect(()=>{if(c?.data.telegram){const p=c.data.telegram;Object.entries(p).forEach(([k,I])=>{r.setValue(k,I)}),l.current=p}},[c]);const o=u.useCallback(_e.debounce(async p=>{if(!_e.isEqual(p,l.current)){a(!0);try{await i(p),l.current=p}finally{a(!1)}}},1e3),[i]),d=u.useCallback(p=>{o(p)},[o]);return u.useEffect(()=>{const p=r.watch(k=>{d(k)});return()=>p.unsubscribe()},[r.watch,d]),e.jsx(je,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"telegram_bot_token",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("telegram.bot_token.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("telegram.bot_token.placeholder"),...p,value:p.value||""})}),e.jsx(M,{children:s("telegram.bot_token.description")}),e.jsx(E,{})]})}),r.watch("telegram_bot_token")&&e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("telegram.webhook.title")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(R,{loading:x,disabled:x,onClick:()=>m(),children:s(x?"telegram.webhook.setting":"telegram.webhook.button")}),n&&e.jsx("span",{className:"text-sm text-muted-foreground",children:s("common.saving")})]}),e.jsx(M,{children:s("telegram.webhook.description")}),e.jsx(E,{})]}),e.jsx(b,{control:r.control,name:"telegram_bot_enable",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("telegram.bot_enable.title")}),e.jsx(M,{children:s("telegram.bot_enable.description")}),e.jsx(_,{children:e.jsx(U,{checked:p.value||!1,onCheckedChange:k=>{p.onChange(k),d(r.getValues())}})}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"telegram_discuss_link",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("telegram.discuss_link.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("telegram.discuss_link.placeholder"),...p,value:p.value||""})}),e.jsx(M,{children:s("telegram.discuss_link.description")}),e.jsx(E,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Gm(){const{t:s}=F("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(we,{}),e.jsx(Bm,{})]})}const Wm=Object.freeze(Object.defineProperty({__proto__:null,default:Gm},Symbol.toStringTag,{value:"Module"})),Ym=h.object({windows_version:h.string().nullable(),windows_download_url:h.string().nullable(),macos_version:h.string().nullable(),macos_download_url:h.string().nullable(),android_version:h.string().nullable(),android_download_url:h.string().nullable()}),Qm={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function Jm(){const{t:s}=F("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=he({resolver:ge(Ym),defaultValues:Qm,mode:"onBlur"}),{data:c}=ne({queryKey:["settings","app"],queryFn:()=>ys("app")}),{mutateAsync:i}=ds({mutationFn:Ns,onSuccess:o=>{o.data&&A.success(s("app.save_success"))}});u.useEffect(()=>{if(c?.data.app){const o=c.data.app;Object.entries(o).forEach(([d,p])=>{r.setValue(d,p)}),l.current=o}},[c]);const m=u.useCallback(_e.debounce(async o=>{if(!_e.isEqual(o,l.current)){a(!0);try{await i(o),l.current=o}finally{a(!1)}}},1e3),[i]),x=u.useCallback(o=>{m(o)},[m]);return u.useEffect(()=>{const o=r.watch(d=>{x(d)});return()=>o.unsubscribe()},[r.watch,x]),e.jsx(je,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"windows_version",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.windows.version.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(M,{children:s("app.windows.version.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"windows_download_url",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.windows.download.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(M,{children:s("app.windows.download.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"macos_version",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.macos.version.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(M,{children:s("app.macos.version.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"macos_download_url",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.macos.download.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(M,{children:s("app.macos.download.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"android_version",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.android.version.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(M,{children:s("app.android.version.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"android_download_url",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.android.download.title")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("common.placeholder"),...o,value:o.value||""})}),e.jsx(M,{children:s("app.android.download.description")}),e.jsx(E,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Zm(){const{t:s}=F("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(we,{}),e.jsx(Jm,{})]})}const Xm=Object.freeze(Object.defineProperty({__proto__:null,default:Zm},Symbol.toStringTag,{value:"Module"})),ba=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:N("w-full caption-bottom text-sm",s),...n})}));ba.displayName="Table";const ya=u.forwardRef(({className:s,...n},a)=>e.jsx("thead",{ref:a,className:N("[&_tr]:border-b",s),...n}));ya.displayName="TableHeader";const Na=u.forwardRef(({className:s,...n},a)=>e.jsx("tbody",{ref:a,className:N("[&_tr:last-child]:border-0",s),...n}));Na.displayName="TableBody";const eu=u.forwardRef(({className:s,...n},a)=>e.jsx("tfoot",{ref:a,className:N("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...n}));eu.displayName="TableFooter";const ks=u.forwardRef(({className:s,...n},a)=>e.jsx("tr",{ref:a,className:N("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...n}));ks.displayName="TableRow";const _a=u.forwardRef(({className:s,...n},a)=>e.jsx("th",{ref:a,className:N("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}));_a.displayName="TableHead";const Ys=u.forwardRef(({className:s,...n},a)=>e.jsx("td",{ref:a,className:N("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...n}));Ys.displayName="TableCell";const su=u.forwardRef(({className:s,...n},a)=>e.jsx("caption",{ref:a,className:N("mt-4 text-sm text-muted-foreground",s),...n}));su.displayName="TableCaption";function tu({table:s}){const[n,a]=u.useState(""),{t:l}=F("common");u.useEffect(()=>{a((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const r=c=>{const i=parseInt(c);!isNaN(i)&&i>=1&&i<=s.getPageCount()?s.setPageIndex(i-1):a((s.getState().pagination.pageIndex+1).toString())};return e.jsxs("div",{className:"flex flex-col-reverse gap-4 px-2 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.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(J,{value:`${s.getState().pagination.pageSize}`,onValueChange:c=>{s.setPageSize(Number(c))},children:[e.jsx(W,{className:"h-8 w-[70px]",children:e.jsx(Z,{placeholder:s.getState().pagination.pageSize})}),e.jsx(Y,{side:"top",children:[10,20,30,40,50,100,500].map(c=>e.jsx(q,{value:`${c}`,children:c},c))})]})]}),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:n,onChange:c=>a(c.target.value),onBlur:c=>r(c.target.value),onKeyDown:c=>{c.key==="Enter"&&r(c.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(R,{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(di,{className:"h-4 w-4"})]}),e.jsxs(R,{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($n,{className:"h-4 w-4"})]}),e.jsxs(R,{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(ua,{className:"h-4 w-4"})]}),e.jsxs(R,{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(mi,{className:"h-4 w-4"})]})]})]})]})}function os({table:s,toolbar:n,draggable:a=!1,onDragStart:l,onDragEnd:r,onDragOver:c,onDragLeave:i,onDrop:m,showPagination:x=!0,isLoading:o=!1}){const{t:d}=F("common"),p=u.useRef(null),k=s.getAllColumns().filter(C=>C.getIsPinned()==="left"),I=s.getAllColumns().filter(C=>C.getIsPinned()==="right"),f=C=>k.slice(0,C).reduce((g,w)=>g+(w.getSize()??0),0),j=C=>I.slice(C+1).reduce((g,w)=>g+(w.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof n=="function"?n(s):n,e.jsx("div",{ref:p,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs(ba,{children:[e.jsx(ya,{children:s.getHeaderGroups().map(C=>e.jsx(ks,{className:"hover:bg-transparent",children:C.headers.map((g,w)=>{const T=g.column.getIsPinned()==="left",S=g.column.getIsPinned()==="right",P=T?f(k.indexOf(g.column)):void 0,L=S?j(I.indexOf(g.column)):void 0;return e.jsx(_a,{colSpan:g.colSpan,style:{width:g.getSize(),...T&&{left:P},...S&&{right:L}},className:N("h-11 bg-card px-4 text-muted-foreground",(T||S)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",T&&"before:right-0",S&&"before:left-0"]),children:g.isPlaceholder?null:Tt(g.column.columnDef.header,g.getContext())},g.id)})},C.id))}),e.jsx(Na,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((C,g)=>e.jsx(ks,{"data-state":C.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:a,onDragStart:w=>l?.(w,g),onDragEnd:r,onDragOver:c,onDragLeave:i,onDrop:w=>m?.(w,g),children:C.getVisibleCells().map((w,T)=>{const S=w.column.getIsPinned()==="left",P=w.column.getIsPinned()==="right",L=S?f(k.indexOf(w.column)):void 0,G=P?j(I.indexOf(w.column)):void 0;return e.jsx(Ys,{style:{width:w.column.getSize(),...S&&{left:L},...P&&{right:G}},className:N("bg-card",(S||P)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",S&&"before:right-0",P&&"before:left-0"]),children:Tt(w.column.columnDef.cell,w.getContext())},w.id)})},C.id)):e.jsx(ks,{children:e.jsx(Ys,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:d("table.noData")})})})]})})}),x&&e.jsx(tu,{table:s})]})}const au=s=>h.object({id:h.number().nullable(),name:h.string().min(2,s("form.validation.name.min")).max(30,s("form.validation.name.max")),icon:h.string().optional().nullable(),notify_domain:h.string().refine(a=>!a||/^https?:\/\/\S+/.test(a),s("form.validation.notify_domain.url")).optional().nullable(),handling_fee_fixed:h.coerce.number().min(0).optional().nullable(),handling_fee_percent:h.coerce.number().min(0).max(100).optional().nullable(),payment:h.string().min(1,s("form.validation.payment.required")),config:h.record(h.string(),h.string())}),Xa={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function Fr({refetch:s,dialogTrigger:n,type:a="add",defaultFormValues:l=Xa}){const{t:r}=F("payment"),[c,i]=u.useState(!1),[m,x]=u.useState(!1),[o,d]=u.useState([]),[p,k]=u.useState([]),I=au(r),f=he({resolver:ge(I),defaultValues:l,mode:"onChange"}),j=f.watch("payment");u.useEffect(()=>{c&&(async()=>{const{data:w}=await td();d(w)})()},[c]),u.useEffect(()=>{if(!j||!c)return;(async()=>{const w={payment:j,...a==="edit"&&{id:Number(f.getValues("id"))}};ad(w).then(({data:T})=>{k(T);const S=T.reduce((P,L)=>(L.field_name&&(P[L.field_name]=L.value??""),P),{});f.setValue("config",S)})})()},[j,c,f,a]);const C=async g=>{x(!0);try{(await nd(g)).data&&(A.success(r("form.messages.success")),f.reset(Xa),s(),i(!1))}finally{x(!1)}};return e.jsxs(ve,{open:c,onOpenChange:i,children:[e.jsx(He,{asChild:!0,children:n||e.jsxs(R,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Pe,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add.button")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsx(Ne,{children:e.jsx(be,{children:r(a==="add"?"form.add.title":"form.edit.title")})}),e.jsx(je,{...f,children:e.jsxs("form",{onSubmit:f.handleSubmit(C),className:"space-y-4",children:[e.jsx(b,{control:f.control,name:"name",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:r("form.fields.name.placeholder"),...g})}),e.jsx(M,{children:r("form.fields.name.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"icon",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.icon.label")}),e.jsx(_,{children:e.jsx(D,{...g,value:g.value||"",placeholder:r("form.fields.icon.placeholder")})}),e.jsx(M,{children:r("form.fields.icon.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"notify_domain",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.notify_domain.label")}),e.jsx(_,{children:e.jsx(D,{...g,value:g.value||"",placeholder:r("form.fields.notify_domain.placeholder")})}),e.jsx(M,{children:r("form.fields.notify_domain.description")}),e.jsx(E,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(b,{control:f.control,name:"handling_fee_percent",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.handling_fee_percent.label")}),e.jsx(_,{children:e.jsx(D,{type:"number",...g,value:g.value||"",placeholder:r("form.fields.handling_fee_percent.placeholder")})}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"handling_fee_fixed",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.handling_fee_fixed.label")}),e.jsx(_,{children:e.jsx(D,{type:"number",...g,value:g.value||"",placeholder:r("form.fields.handling_fee_fixed.placeholder")})}),e.jsx(E,{})]})})]}),e.jsx(b,{control:f.control,name:"payment",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.payment.label")}),e.jsxs(J,{onValueChange:g.onChange,defaultValue:g.value,children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Z,{placeholder:r("form.fields.payment.placeholder")})})}),e.jsx(Y,{children:o.map(w=>e.jsx(q,{value:w,children:w},w))})]}),e.jsx(M,{children:r("form.fields.payment.description")}),e.jsx(E,{})]})}),p.length>0&&e.jsx("div",{className:"space-y-4",children:p.map(g=>e.jsx(b,{control:f.control,name:`config.${g.field_name}`,render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{children:g.label}),e.jsx(_,{children:e.jsx(D,{...w,value:w.value||""})}),e.jsx(E,{})]})},g.field_name))}),e.jsxs(Ke,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(R,{type:"button",variant:"outline",children:r("form.buttons.cancel")})}),e.jsx(R,{type:"submit",disabled:m,children:r("form.buttons.submit")})]})]})})]})]})}function z({column:s,title:n,tooltip:a,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(R,{variant:"ghost",size:"default",className:N("-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:n}),a&&e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(qa,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(oe,{children:a})]})}),s.getIsSorted()==="asc"?e.jsx(sa,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(ta,{className:"h-4 w-4 text-foreground/70"}):e.jsx(ui,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-foreground/70"})]})})}):e.jsxs("div",{className:N("flex items-center space-x-1 text-nowrap py-2 font-medium text-muted-foreground",l),children:[e.jsx("span",{children:n}),a&&e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{children:e.jsx(qa,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(oe,{children:a})]})})]})}const Mr=xi,Or=hi,nu=fi,zr=u.forwardRef(({className:s,...n},a)=>e.jsx(Qn,{className:N("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:a}));zr.displayName=Qn.displayName;const wa=u.forwardRef(({className:s,...n},a)=>e.jsxs(nu,{children:[e.jsx(zr,{}),e.jsx(Jn,{ref:a,className:N("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})]}));wa.displayName=Jn.displayName;const Ca=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-2 text-center sm:text-left",s),...n});Ca.displayName="AlertDialogHeader";const Sa=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Sa.displayName="AlertDialogFooter";const ka=u.forwardRef(({className:s,...n},a)=>e.jsx(Zn,{ref:a,className:N("text-lg font-semibold",s),...n}));ka.displayName=Zn.displayName;const Ta=u.forwardRef(({className:s,...n},a)=>e.jsx(Xn,{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Ta.displayName=Xn.displayName;const Pa=u.forwardRef(({className:s,...n},a)=>e.jsx(er,{ref:a,className:N(Js(),s),...n}));Pa.displayName=er.displayName;const Da=u.forwardRef(({className:s,...n},a)=>e.jsx(sr,{ref:a,className:N(Js({variant:"outline"}),"mt-2 sm:mt-0",s),...n}));Da.displayName=sr.displayName;function qe({onConfirm:s,children:n,title:a="确认操作",description:l="确定要执行此操作吗?",cancelText:r="取消",confirmText:c="确认",variant:i="default",className:m}){return e.jsxs(Mr,{children:[e.jsx(Or,{asChild:!0,children:n}),e.jsxs(wa,{className:N("sm:max-w-[425px]",m),children:[e.jsxs(Ca,{children:[e.jsx(ka,{children:a}),e.jsx(Ta,{children:l})]}),e.jsxs(Sa,{children:[e.jsx(Da,{asChild:!0,children:e.jsx(R,{variant:"outline",children:r})}),e.jsx(Pa,{asChild:!0,children:e.jsx(R,{variant:i,onClick:s,children:c})})]})]})]})}const Lr=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"})}),ru=({refetch:s,isSortMode:n=!1})=>{const{t:a}=F("payment");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(zt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(z,{column:l,title:a("table.columns.id")}),cell:({row:l})=>e.jsx(K,{variant:"outline",children:l.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:l})=>e.jsx(z,{column:l,title:a("table.columns.enable")}),cell:({row:l})=>e.jsx(U,{defaultChecked:l.getValue("enable"),onCheckedChange:async()=>{const{data:r}=await ld({id:l.original.id});r||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:l})=>e.jsx(z,{column:l,title:a("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:a("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:a("table.columns.notify_url")}),e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{className:"ml-1",children:e.jsx(Lr,{className:"h-4 w-4"})}),e.jsx(oe,{children:a("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:a("table.columns.actions")}),cell:({row:l})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Fr,{refetch:s,dialogTrigger:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{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:l.original}),e.jsx(qe,{title:a("table.actions.delete.title"),description:a("table.actions.delete.description"),onConfirm:async()=>{const{data:r}=await rd({id:l.original.id});r&&s()},children:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(ts,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:a("table.actions.delete.title")})]})})]}),size:100}]};function lu({table:s,refetch:n,saveOrder:a,isSortMode:l}){const{t:r}=F("payment"),c=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:r("table.toolbar.sort.hint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fr,{refetch:n}),e.jsx(D,{placeholder:r("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:i=>s.getColumn("name")?.setFilterValue(i.target.value),className:"h-8 w-[250px]"}),c&&e.jsxs(R,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[r("table.toolbar.reset"),e.jsx(Be,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(R,{variant:l?"default":"outline",onClick:a,size:"sm",children:r(l?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}function ou(){const[s,n]=u.useState([]),[a,l]=u.useState([]),[r,c]=u.useState(!1),[i,m]=u.useState([]),[x,o]=u.useState({"drag-handle":!1}),[d,p]=u.useState({pageSize:20,pageIndex:0}),{refetch:k}=ne({queryKey:["paymentList"],queryFn:async()=>{const{data:g}=await sd();return m(g?.map(w=>({...w,enable:!!w.enable}))||[]),g}});u.useEffect(()=>{o({"drag-handle":r,actions:!r}),p({pageSize:r?99999:10,pageIndex:0})},[r]);const I=(g,w)=>{r&&(g.dataTransfer.setData("text/plain",w.toString()),g.currentTarget.classList.add("opacity-50"))},f=(g,w)=>{if(!r)return;g.preventDefault(),g.currentTarget.classList.remove("bg-muted");const T=parseInt(g.dataTransfer.getData("text/plain"));if(T===w)return;const S=[...i],[P]=S.splice(T,1);S.splice(w,0,P),m(S)},j=async()=>{r?od({ids:i.map(g=>g.id)}).then(()=>{k(),c(!1),A.success("排序保存成功")}):c(!0)},C=Ye({data:i,columns:ru({refetch:k,isSortMode:r}),state:{sorting:a,columnFilters:s,columnVisibility:x,pagination:d},onSortingChange:l,onColumnFiltersChange:n,onColumnVisibilityChange:o,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),getSortedRowModel:rs(),initialState:{columnPinning:{right:["actions"]}},pageCount:r?1:void 0});return e.jsx(os,{table:C,toolbar:g=>e.jsx(lu,{table:g,refetch:k,saveOrder:j,isSortMode:r}),draggable:r,onDragStart:I,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:f,showPagination:!r})}function iu(){const{t:s}=F("payment");return e.jsxs(ke,{children:[e.jsxs(Te,{className:"flex items-center justify-between",children:[e.jsx(ze,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(ou,{})})]})]})}const cu=Object.freeze(Object.defineProperty({__proto__:null,default:iu},Symbol.toStringTag,{value:"Module"}));function du({pluginName:s,onClose:n,onSuccess:a}){const{t:l}=F("plugin"),[r,c]=u.useState(!0),[i,m]=u.useState(!1),[x,o]=u.useState(null),d=pi({config:gi(ji())}),p=he({resolver:ge(d),defaultValues:{config:{}}});u.useEffect(()=>{(async()=>{try{const{data:j}=await hs.getPluginConfig(s);o(j),p.reset({config:Object.fromEntries(Object.entries(j).map(([C,g])=>[C,g.value]))})}catch{A.error(l("messages.configLoadError"))}finally{c(!1)}})()},[s]);const k=async f=>{m(!0);try{await hs.updatePluginConfig(s,f.config),A.success(l("messages.configSaveSuccess")),a()}catch{A.error(l("messages.configSaveError"))}finally{m(!1)}},I=(f,j)=>{switch(j.type){case"string":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{children:j.label||j.description}),e.jsx(_,{children:e.jsx(D,{placeholder:j.placeholder,...C})}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description}),e.jsx(E,{})]})},f);case"number":case"percentage":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{children:j.label||j.description}),e.jsx(_,{children:e.jsxs("div",{className:"relative",children:[e.jsx(D,{type:"number",placeholder:j.placeholder,...C,onChange:g=>{const w=Number(g.target.value);j.type==="percentage"?C.onChange(Math.min(100,Math.max(0,w))):C.onChange(w)},className:j.type==="percentage"?"pr-8":"",min:j.type==="percentage"?0:void 0,max:j.type==="percentage"?100:void 0,step:j.type==="percentage"?1:void 0}),j.type==="percentage"&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(vi,{className:"h-4 w-4 text-muted-foreground"})})]})}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description}),e.jsx(E,{})]})},f);case"select":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{children:j.label||j.description}),e.jsxs(J,{onValueChange:C.onChange,defaultValue:C.value,children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Z,{placeholder:j.placeholder})})}),e.jsx(Y,{children:j.options?.map(g=>e.jsx(q,{value:g.value,children:g.label},g.value))})]}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description}),e.jsx(E,{})]})},f);case"boolean":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:C})=>e.jsxs(v,{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(y,{className:"text-base",children:j.label||j.description}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description})]}),e.jsx(_,{children:e.jsx(U,{checked:C.value,onCheckedChange:C.onChange})})]})},f);case"text":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{children:j.label||j.description}),e.jsx(_,{children:e.jsx(_s,{placeholder:j.placeholder,...C})}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description}),e.jsx(E,{})]})},f);default:return null}};return r?e.jsxs("div",{className:"space-y-4",children:[e.jsx(re,{className:"h-4 w-[200px]"}),e.jsx(re,{className:"h-10 w-full"}),e.jsx(re,{className:"h-4 w-[200px]"}),e.jsx(re,{className:"h-10 w-full"})]}):e.jsx(je,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(k),className:"space-y-4",children:[x&&Object.entries(x).map(([f,j])=>I(f,j)),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(R,{type:"button",variant:"outline",onClick:n,disabled:i,children:l("config.cancel")}),e.jsx(R,{type:"submit",loading:i,disabled:i,children:l("config.save")})]})]})})}function mu(){const{t:s}=F("plugin"),[n,a]=u.useState(null),[l,r]=u.useState(!1),[c,i]=u.useState(null),[m,x]=u.useState(""),[o,d]=u.useState("all"),[p,k]=u.useState(!1),[I,f]=u.useState(!1),[j,C]=u.useState(!1),g=u.useRef(null),{data:w,isLoading:T,refetch:S}=ne({queryKey:["pluginList"],queryFn:async()=>{const{data:$}=await hs.getPluginList();return $}});w&&[...new Set(w.map($=>$.category||"other"))];const P=w?.filter($=>{const ae=$.name.toLowerCase().includes(m.toLowerCase())||$.description.toLowerCase().includes(m.toLowerCase())||$.code.toLowerCase().includes(m.toLowerCase()),te=o==="all"||$.category===o;return ae&&te}),L=async $=>{a($),hs.installPlugin($).then(()=>{A.success(s("messages.installSuccess")),S()}).catch(ae=>{A.error(ae.message||s("messages.installError"))}).finally(()=>{a(null)})},G=async $=>{a($),hs.uninstallPlugin($).then(()=>{A.success(s("messages.uninstallSuccess")),S()}).catch(ae=>{A.error(ae.message||s("messages.uninstallError"))}).finally(()=>{a(null)})},O=async($,ae)=>{a($),(ae?hs.disablePlugin:hs.enablePlugin)($).then(()=>{A.success(s(ae?"messages.disableSuccess":"messages.enableSuccess")),S()}).catch(Ue=>{A.error(Ue.message||s(ae?"messages.disableError":"messages.enableError"))}).finally(()=>{a(null)})},X=$=>{w?.find(ae=>ae.code===$),i($),r(!0)},Je=async $=>{if(!$.name.endsWith(".zip")){A.error(s("upload.error.format"));return}k(!0),hs.uploadPlugin($).then(()=>{A.success(s("messages.uploadSuccess")),f(!1),S()}).catch(ae=>{A.error(ae.message||s("messages.uploadError"))}).finally(()=>{k(!1),g.current&&(g.current.value="")})},is=$=>{$.preventDefault(),$.stopPropagation(),$.type==="dragenter"||$.type==="dragover"?C(!0):$.type==="dragleave"&&C(!1)},Vs=$=>{$.preventDefault(),$.stopPropagation(),C(!1),$.dataTransfer.files&&$.dataTransfer.files[0]&&Je($.dataTransfer.files[0])},ee=async $=>{a($),hs.deletePlugin($).then(()=>{A.success(s("messages.deleteSuccess")),S()}).catch(ae=>{A.error(ae.message||s("messages.deleteError"))}).finally(()=>{a(null)})};return e.jsxs(ke,{children:[e.jsxs(Te,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(xa,{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(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(kn,{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:m,onChange:$=>x($.target.value),className:"pl-9"})]}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs(R,{onClick:()=>f(!0),variant:"outline",className:"shrink-0",size:"sm",children:[e.jsx(dt,{className:"mr-2 h-4 w-4"}),s("upload.button")]})})]}),e.jsxs(va,{defaultValue:"all",className:"w-full",children:[e.jsxs(Ht,{children:[e.jsx(Ts,{value:"all",children:s("tabs.all")}),e.jsx(Ts,{value:"installed",children:s("tabs.installed")}),e.jsx(Ts,{value:"available",children:s("tabs.available")})]}),e.jsx(St,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:T?e.jsxs(e.Fragment,{children:[e.jsx(Qt,{}),e.jsx(Qt,{}),e.jsx(Qt,{})]}):P?.map($=>e.jsx(Yt,{plugin:$,onInstall:L,onUninstall:G,onToggleEnable:O,onOpenConfig:X,onDelete:ee,isLoading:n===$.name},$.name))})}),e.jsx(St,{value:"installed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:P?.filter($=>$.is_installed).map($=>e.jsx(Yt,{plugin:$,onInstall:L,onUninstall:G,onToggleEnable:O,onOpenConfig:X,onDelete:ee,isLoading:n===$.name},$.name))})}),e.jsx(St,{value:"available",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:P?.filter($=>!$.is_installed).map($=>e.jsx(Yt,{plugin:$,onInstall:L,onUninstall:G,onToggleEnable:O,onOpenConfig:X,onDelete:ee,isLoading:n===$.name},$.code))})})]})]}),e.jsx(ve,{open:l,onOpenChange:r,children:e.jsxs(pe,{className:"sm:max-w-lg",children:[e.jsxs(Ne,{children:[e.jsxs(be,{children:[w?.find($=>$.code===c)?.name," ",s("config.title")]}),e.jsx(Ee,{children:s("config.description")})]}),c&&e.jsx(du,{pluginName:c,onClose:()=>r(!1),onSuccess:()=>{r(!1),S()}})]})}),e.jsx(ve,{open:I,onOpenChange:f,children:e.jsxs(pe,{className:"sm:max-w-md",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:s("upload.title")}),e.jsx(Ee,{children:s("upload.description")})]}),e.jsxs("div",{className:N("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",j&&"border-primary/50 bg-muted/50"),onDragEnter:is,onDragLeave:is,onDragOver:is,onDrop:Vs,children:[e.jsx("input",{type:"file",ref:g,className:"hidden",accept:".zip",onChange:$=>{const ae=$.target.files?.[0];ae&&Je(ae)}}),p?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(dt,{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 Yt({plugin:s,onInstall:n,onUninstall:a,onToggleEnable:l,onOpenConfig:r,onDelete:c,isLoading:i}){const{t:m}=F("plugin");return e.jsxs(Ae,{className:"group relative overflow-hidden transition-all hover:shadow-md",children:[e.jsxs(Ge,{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(ps,{children:s.name}),s.is_installed&&e.jsx(K,{variant:s.is_enabled?"success":"secondary",children:s.is_enabled?m("status.enabled"):m("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(xa,{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(Qs,{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:[m("author"),": ",s.author]})})]})})]}),e.jsx(We,{children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.is_installed?e.jsxs(e.Fragment,{children:[e.jsxs(R,{variant:"outline",size:"sm",onClick:()=>r(s.code),disabled:!s.is_enabled||i,children:[e.jsx(bi,{className:"mr-2 h-4 w-4"}),m("button.config")]}),e.jsxs(R,{variant:s.is_enabled?"destructive":"default",size:"sm",onClick:()=>l(s.code,s.is_enabled),disabled:i,children:[e.jsx(yi,{className:"mr-2 h-4 w-4"}),s.is_enabled?m("button.disable"):m("button.enable")]}),e.jsx(qe,{title:m("uninstall.title"),description:m("uninstall.description"),cancelText:m("common:cancel"),confirmText:m("uninstall.button"),variant:"destructive",onConfirm:()=>a(s.code),children:e.jsxs(R,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",disabled:i,children:[e.jsx(ts,{className:"mr-2 h-4 w-4"}),m("button.uninstall")]})})]}):e.jsxs(e.Fragment,{children:[e.jsx(R,{onClick:()=>n(s.code),disabled:i,loading:i,children:m("button.install")}),e.jsx(qe,{title:m("delete.title"),description:m("delete.description"),cancelText:m("common:cancel"),confirmText:m("delete.button"),variant:"destructive",onConfirm:()=>c(s.code),children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",disabled:i,children:e.jsx(ts,{className:"h-4 w-4"})})})]})})})]})}function Qt(){return e.jsxs(Ae,{children:[e.jsxs(Ge,{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(re,{className:"h-6 w-[200px]"}),e.jsx(re,{className:"h-6 w-[80px]"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(re,{className:"h-5 w-[120px]"}),e.jsx(re,{className:"h-5 w-[60px]"})]})]})}),e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx(re,{className:"h-4 w-[300px]"}),e.jsx(re,{className:"h-4 w-[150px]"})]})]}),e.jsx(We,{children:e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(re,{className:"h-9 w-[100px]"}),e.jsx(re,{className:"h-9 w-[100px]"}),e.jsx(re,{className:"h-8 w-8"})]})})]})}const uu=Object.freeze(Object.defineProperty({__proto__:null,default:mu},Symbol.toStringTag,{value:"Module"})),xu=(s,n)=>{let a=null;switch(s.field_type){case"input":a=e.jsx(D,{placeholder:s.placeholder,...n});break;case"textarea":a=e.jsx(_s,{placeholder:s.placeholder,...n});break;case"select":a=e.jsx("select",{className:N(Js({variant:"outline"}),"w-full appearance-none font-normal"),...n,children:s.select_options&&Object.keys(s.select_options).map(l=>e.jsx("option",{value:l,children:s.select_options?.[l]},l))});break;default:a=null;break}return a};function hu({themeKey:s,themeInfo:n}){const{t:a}=F("theme"),[l,r]=u.useState(!1),[c,i]=u.useState(!1),[m,x]=u.useState(!1),o=he({defaultValues:n.configs.reduce((k,I)=>(k[I.field_name]="",k),{})}),d=async()=>{i(!0),$c(s).then(({data:k})=>{Object.entries(k).forEach(([I,f])=>{o.setValue(I,f)})}).finally(()=>{i(!1)})},p=async k=>{x(!0),qc(s,k).then(()=>{A.success(a("config.success")),r(!1)}).finally(()=>{x(!1)})};return e.jsxs(ve,{open:l,onOpenChange:k=>{r(k),k?d():o.reset()},children:[e.jsx(He,{asChild:!0,children:e.jsx(R,{variant:"outline",children:a("card.configureTheme")})}),e.jsxs(pe,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:a("config.title",{name:n.name})}),e.jsx(Ee,{children:a("config.description")})]}),c?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(fa,{className:"h-6 w-6 animate-spin"})}):e.jsx(je,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(p),className:"space-y-4",children:[n.configs.map(k=>e.jsx(b,{control:o.control,name:k.field_name,render:({field:I})=>e.jsxs(v,{children:[e.jsx(y,{children:k.label}),e.jsx(_,{children:xu(k,I)}),e.jsx(E,{})]})},k.field_name)),e.jsxs(Ke,{className:"mt-6 gap-2",children:[e.jsx(R,{type:"button",variant:"secondary",onClick:()=>r(!1),children:a("config.cancel")}),e.jsx(R,{type:"submit",loading:m,children:a("config.save")})]})]})})]})]})}function fu(){const{t:s}=F("theme"),[n,a]=u.useState(null),[l,r]=u.useState(!1),[c,i]=u.useState(!1),[m,x]=u.useState(!1),[o,d]=u.useState(null),p=u.useRef(null),[k,I]=u.useState(0),{data:f,isLoading:j,refetch:C}=ne({queryKey:["themeList"],queryFn:async()=>{const{data:O}=await Ac();return O}}),g=async O=>{a(O),Uc({frontend_theme:O}).then(()=>{A.success("主题切换成功"),C()}).finally(()=>{a(null)})},w=async O=>{if(!O.name.endsWith(".zip")){A.error(s("upload.error.format"));return}r(!0),Hc(O).then(()=>{A.success("主题上传成功"),i(!1),C()}).finally(()=>{r(!1),p.current&&(p.current.value="")})},T=O=>{O.preventDefault(),O.stopPropagation(),O.type==="dragenter"||O.type==="dragover"?x(!0):O.type==="dragleave"&&x(!1)},S=O=>{O.preventDefault(),O.stopPropagation(),x(!1),O.dataTransfer.files&&O.dataTransfer.files[0]&&w(O.dataTransfer.files[0])},P=()=>{o&&I(O=>O===0?o.images.length-1:O-1)},L=()=>{o&&I(O=>O===o.images.length-1?0:O+1)},G=(O,X)=>{I(0),d({name:O,images:X})};return e.jsxs(ke,{children:[e.jsxs(Te,{className:"flex items-center justify-between",children:[e.jsx(ze,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(R,{onClick:()=>i(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(dt,{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:j?e.jsxs(e.Fragment,{children:[e.jsx(en,{}),e.jsx(en,{})]}):f?.themes&&Object.entries(f.themes).map(([O,X])=>e.jsx(Ae,{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:N("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(qe,{title:s("card.delete.title"),description:s("card.delete.description"),confirmText:s("card.delete.button"),variant:"destructive",onConfirm:async()=>{if(O===f?.active){A.error(s("card.delete.error.active"));return}a(O),Kc(O).then(()=>{A.success("主题删除成功"),C()}).finally(()=>{a(null)})},children:e.jsx(R,{disabled:n===O,loading:n===O,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(ts,{className:"h-4 w-4"})})})}),e.jsxs(Ge,{children:[e.jsx(ps,{children:X.name}),e.jsx(Qs,{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(We,{className:"flex items-center justify-end space-x-3",children:[X.images&&Array.isArray(X.images)&&X.images.length>0&&e.jsx(R,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>G(X.name,X.images),children:e.jsx(Ni,{className:"h-4 w-4"})}),e.jsx(hu,{themeKey:O,themeInfo:X}),e.jsx(R,{onClick:()=>g(O),disabled:n===O||O===f.active,loading:n===O,variant:O===f.active?"secondary":"default",children:O===f.active?s("card.currentTheme"):s("card.activateTheme")})]})]})},O))}),e.jsx(ve,{open:c,onOpenChange:i,children:e.jsxs(pe,{className:"sm:max-w-md",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:s("upload.title")}),e.jsx(Ee,{children:s("upload.description")})]}),e.jsxs("div",{className:N("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",m&&"border-primary/50 bg-muted/50"),onDragEnter:T,onDragLeave:T,onDragOver:T,onDrop:S,children:[e.jsx("input",{type:"file",ref:p,className:"hidden",accept:".zip",onChange:O=>{const X=O.target.files?.[0];X&&w(X)}}),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(dt,{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")})]})]})})]})]})}),e.jsx(ve,{open:!!o,onOpenChange:O=>{O||(d(null),I(0))},children:e.jsxs(pe,{className:"max-w-4xl",children:[e.jsxs(Ne,{children:[e.jsxs(be,{children:[o?.name," ",s("preview.title")]}),e.jsx(Ee,{className:"text-center",children:o&&s("preview.imageCount",{current:k+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[k]&&e.jsx("img",{src:o.images[k],alt:`${o.name} 预览图 ${k+1}`,className:"h-full w-full object-contain"})}),o&&o.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(R,{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:P,children:e.jsx(_i,{className:"h-4 w-4"})}),e.jsx(R,{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:L,children:e.jsx(wi,{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((O,X)=>e.jsx("button",{onClick:()=>I(X),className:N("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",k===X?"border-primary":"border-transparent"),children:e.jsx("img",{src:O,alt:`缩略图 ${X+1}`,className:"h-full w-full object-cover"})},X))})]})})]})]})}function en(){return e.jsxs(Ae,{children:[e.jsxs(Ge,{children:[e.jsx(re,{className:"h-6 w-[200px]"}),e.jsx(re,{className:"h-4 w-[300px]"})]}),e.jsxs(We,{className:"flex items-center justify-end space-x-3",children:[e.jsx(re,{className:"h-10 w-[100px]"}),e.jsx(re,{className:"h-10 w-[100px]"})]})]})}const pu=Object.freeze(Object.defineProperty({__proto__:null,default:fu},Symbol.toStringTag,{value:"Module"})),Ea=u.forwardRef(({className:s,value:n,onChange:a,...l},r)=>{const[c,i]=u.useState("");u.useEffect(()=>{if(c.includes(",")){const x=new Set([...n,...c.split(",").map(o=>o.trim())]);a(Array.from(x)),i("")}},[c,a,n]);const m=()=>{if(c){const x=new Set([...n,c]);a(Array.from(x)),i("")}};return e.jsxs("div",{className:N(" 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(x=>e.jsxs(K,{variant:"secondary",children:[x,e.jsx(B,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{a(n.filter(o=>o!==x))},children:e.jsx(aa,{className:"w-3"})})]},x)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:c,onChange:x=>i(x.target.value),onKeyDown:x=>{x.key==="Enter"||x.key===","?(x.preventDefault(),m()):x.key==="Backspace"&&c.length===0&&n.length>0&&(x.preventDefault(),a(n.slice(0,-1)))},...l,ref:r})]})});Ea.displayName="InputTags";const gu=h.object({id:h.number().nullable(),title:h.string().min(1).max(250),content:h.string().min(1),show:h.boolean(),tags:h.array(h.string()),img_url:h.string().nullable()}),ju={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function Ar({refetch:s,dialogTrigger:n,type:a="add",defaultFormValues:l=ju}){const{t:r}=F("notice"),[c,i]=u.useState(!1),m=he({resolver:ge(gu),defaultValues:l,mode:"onChange",shouldFocusError:!0}),x=new pa({html:!0});return e.jsx(je,{...m,children:e.jsxs(ve,{onOpenChange:i,open:c,children:[e.jsx(He,{asChild:!0,children:n||e.jsxs(R,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Pe,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add.button")})]})}),e.jsxs(pe,{className:"sm:max-w-[1025px]",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:r(a==="add"?"form.add.title":"form.edit.title")}),e.jsx(Ee,{})]}),e.jsx(b,{control:m.control,name:"title",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.title.label")}),e.jsx("div",{className:"relative ",children:e.jsx(_,{children:e.jsx(D,{placeholder:r("form.fields.title.placeholder"),...o})})}),e.jsx(E,{})]})}),e.jsx(b,{control:m.control,name:"content",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.content.label")}),e.jsx(_,{children:e.jsx(ga,{style:{height:"500px"},value:o.value,renderHTML:d=>x.render(d),onChange:({text:d})=>{o.onChange(d)}})}),e.jsx(E,{})]})}),e.jsx(b,{control:m.control,name:"img_url",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.img_url.label")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(D,{type:"text",placeholder:r("form.fields.img_url.placeholder"),...o,value:o.value||""})})}),e.jsx(E,{})]})}),e.jsx(b,{control:m.control,name:"show",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.show.label")}),e.jsx("div",{className:"relative py-2",children:e.jsx(_,{children:e.jsx(U,{checked:o.value,onCheckedChange:o.onChange})})}),e.jsx(E,{})]})}),e.jsx(b,{control:m.control,name:"tags",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.tags.label")}),e.jsx(_,{children:e.jsx(Ea,{value:o.value,onChange:o.onChange,placeholder:r("form.fields.tags.placeholder"),className:"w-full"})}),e.jsx(E,{})]})}),e.jsxs(Ke,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(R,{type:"button",variant:"outline",children:r("form.buttons.cancel")})}),e.jsx(R,{type:"submit",onClick:o=>{o.preventDefault(),m.handleSubmit(async d=>{id(d).then(({data:p})=>{p&&(A.success(r("form.buttons.success")),s(),i(!1))})})()},children:r("form.buttons.submit")})]})]})]})})}function vu({table:s,refetch:n,saveOrder:a,isSortMode:l}){const{t:r}=F("notice"),c=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(Ar,{refetch:n}),!l&&e.jsx(D,{placeholder:r("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]"}),c&&!l&&e.jsxs(R,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:[r("table.toolbar.reset"),e.jsx(Be,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(R,{variant:l?"default":"outline",onClick:a,className:"h-8",size:"sm",children:r(l?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}const bu=s=>{const{t:n}=F("notice");return[{id:"drag-handle",header:"",cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Ci,{className:"h-4 w-4 text-muted-foreground cursor-move"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.id")}),cell:({row:a})=>e.jsx(K,{variant:"outline",className:"font-mono",children:a.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.show")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(U,{defaultChecked:a.getValue("show"),onCheckedChange:async()=>{const{data:l}=await dd({id:a.original.id});l||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.title")}),cell:({row:a})=>e.jsx("div",{className:"flex max-w-[500px] items-center",children:e.jsx("span",{className:"truncate font-medium",children:a.getValue("title")})}),enableSorting:!1,size:6e3},{id:"actions",header:({column:a})=>e.jsx(z,{className:"justify-end",column:a,title:n("table.columns.actions")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Ar,{refetch:s,dialogTrigger:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{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:a.original}),e.jsx(qe,{title:n("table.actions.delete.title"),description:n("table.actions.delete.description"),onConfirm:async()=>{cd({id:a.original.id}).then(()=>{A.success(n("table.actions.delete.success")),s()})},children:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ts,{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 yu(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,c]=u.useState([]),[i,m]=u.useState([]),[x,o]=u.useState(!1),[d,p]=u.useState({}),[k,I]=u.useState({pageSize:50,pageIndex:0}),[f,j]=u.useState([]),{refetch:C}=ne({queryKey:["notices"],queryFn:async()=>{const{data:P}=await Ja.getList();return j(P),P}});u.useEffect(()=>{l({"drag-handle":x,content:!x,created_at:!x,actions:!x}),I({pageSize:x?99999:50,pageIndex:0})},[x]);const g=(P,L)=>{x&&(P.dataTransfer.setData("text/plain",L.toString()),P.currentTarget.classList.add("opacity-50"))},w=(P,L)=>{if(!x)return;P.preventDefault(),P.currentTarget.classList.remove("bg-muted");const G=parseInt(P.dataTransfer.getData("text/plain"));if(G===L)return;const O=[...f],[X]=O.splice(G,1);O.splice(L,0,X),j(O)},T=async()=>{if(!x){o(!0);return}Ja.sort(f.map(P=>P.id)).then(()=>{A.success("排序保存成功"),o(!1),C()}).finally(()=>{o(!1)})},S=Ye({data:f??[],columns:bu(C),state:{sorting:i,columnVisibility:a,rowSelection:s,columnFilters:r,columnSizing:d,pagination:k},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,onColumnSizingChange:p,onPaginationChange:I,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),getSortedRowModel:rs(),getFacetedRowModel:vs(),getFacetedUniqueValues:bs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(os,{table:S,toolbar:P=>e.jsx(vu,{table:P,refetch:C,saveOrder:T,isSortMode:x}),draggable:x,onDragStart:g,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:w,showPagination:!x})})}function Nu(){const{t:s}=F("notice");return e.jsxs(ke,{children:[e.jsxs(Te,{className:"flex items-center justify-between",children:[e.jsx(ze,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(yu,{})})]})]})}const _u=Object.freeze(Object.defineProperty({__proto__:null,default:Nu},Symbol.toStringTag,{value:"Module"})),wu=h.object({id:h.number().nullable(),language:h.string().max(250),category:h.string().max(250),title:h.string().min(1).max(250),body:h.string().min(1),show:h.boolean()}),Cu={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function $r({refreshData:s,dialogTrigger:n,type:a="add",defaultFormValues:l=Cu}){const{t:r}=F("knowledge"),[c,i]=u.useState(!1),m=he({resolver:ge(wu),defaultValues:l,mode:"onChange",shouldFocusError:!0}),x=new pa({html:!0});return u.useEffect(()=>{c&&l.id&&ud(l.id).then(({data:o})=>{m.reset(o)})},[l.id,m,c]),e.jsxs(ve,{onOpenChange:i,open:c,children:[e.jsx(He,{asChild:!0,children:n||e.jsxs(R,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Pe,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add")})]})}),e.jsxs(pe,{className:"sm:max-w-[1025px]",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:r(a==="add"?"form.add":"form.edit")}),e.jsx(Ee,{})]}),e.jsxs(je,{...m,children:[e.jsx(b,{control:m.control,name:"title",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.title")}),e.jsx("div",{className:"relative ",children:e.jsx(_,{children:e.jsx(D,{placeholder:r("form.titlePlaceholder"),...o})})}),e.jsx(E,{})]})}),e.jsx(b,{control:m.control,name:"category",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.category")}),e.jsx("div",{className:"relative ",children:e.jsx(_,{children:e.jsx(D,{placeholder:r("form.categoryPlaceholder"),...o})})}),e.jsx(E,{})]})}),e.jsx(b,{control:m.control,name:"language",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.language")}),e.jsx(_,{children:e.jsxs(J,{value:o.value,onValueChange:o.onChange,children:[e.jsx(W,{children:e.jsx(Z,{placeholder:r("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(q,{value:d.value,className:"cursor-pointer",children:r(`languages.${d.value}`)},d.value))})]})})]})}),e.jsx(b,{control:m.control,name:"body",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.content")}),e.jsx(_,{children:e.jsx(ga,{style:{height:"500px"},value:o.value,renderHTML:d=>x.render(d),onChange:({text:d})=>{o.onChange(d)}})}),e.jsx(E,{})]})}),e.jsx(b,{control:m.control,name:"show",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.show")}),e.jsx("div",{className:"relative py-2",children:e.jsx(_,{children:e.jsx(U,{checked:o.value,onCheckedChange:o.onChange})})}),e.jsx(E,{})]})}),e.jsxs(Ke,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(R,{type:"button",variant:"outline",children:r("form.cancel")})}),e.jsx(R,{type:"submit",onClick:()=>{m.handleSubmit(o=>{xd(o).then(({data:d})=>{d&&(m.reset(),A.success(r("messages.operationSuccess")),i(!1),s())})})()},children:r("form.submit")})]})]})]})]})}function Su({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsxs(R,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(pt,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(we,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{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(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(c=>r.has(c.value)).map(c=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(ls,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Rs,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Is,{children:[e.jsx(qs,{children:"No results found."}),e.jsx($e,{children:a.map(c=>{const i=r.has(c.value);return e.jsxs(De,{onSelect:()=>{i?r.delete(c.value):r.add(c.value);const m=Array.from(r);s?.setFilterValue(m.length?m:void 0)},children:[e.jsx("div",{className:N("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(zs,{className:N("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:c.label}),l?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(c.value)})]},c.value)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(et,{}),e.jsx($e,{children:e.jsx(De,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function ku({table:s,refetch:n,saveOrder:a,isSortMode:l}){const r=s.getState().columnFilters.length>0,{t:c}=F("knowledge");return e.jsxs("div",{className:"flex items-center justify-between",children:[l?e.jsx("p",{className:"text-sm text-muted-foreground",children:c("toolbar.sortModeHint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($r,{refreshData:n}),e.jsx(D,{placeholder:c("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(Su,{column:s.getColumn("category"),title:c("columns.category"),options:Array.from(new Set(s.getCoreRowModel().rows.map(i=>i.getValue("category")))).map(i=>({label:i,value:i}))}),r&&e.jsxs(R,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[c("toolbar.reset"),e.jsx(Be,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(R,{variant:l?"default":"outline",onClick:a,size:"sm",children:c(l?"toolbar.saveSort":"toolbar.editSort")})})]})}const Tu=({refetch:s,isSortMode:n=!1})=>{const{t:a}=F("knowledge");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(zt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx(K,{variant:"outline",className:"justify-center",children:l.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.status")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center",children:e.jsx(U,{defaultChecked:l.getValue("show"),onCheckedChange:async()=>{fd({id:l.original.id}).then(({data:r})=>{r||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:l})=>e.jsx(z,{column:l,title:a("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:a("columns.category")}),cell:({row:l})=>e.jsx(K,{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:a("columns.actions")}),cell:({row:l})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx($r,{refreshData:s,dialogTrigger:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:a("form.edit")})]}),type:"edit",defaultFormValues:l.original}),e.jsx(qe,{title:a("messages.deleteConfirm"),description:a("messages.deleteDescription"),confirmText:a("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{hd({id:l.original.id}).then(({data:r})=>{r&&(A.success(a("messages.operationSuccess")),s())})},children:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ts,{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")})]})})]}),size:100}]};function Pu(){const[s,n]=u.useState([]),[a,l]=u.useState([]),[r,c]=u.useState(!1),[i,m]=u.useState([]),[x,o]=u.useState({"drag-handle":!1}),[d,p]=u.useState({pageSize:20,pageIndex:0}),{refetch:k,isLoading:I,data:f}=ne({queryKey:["knowledge"],queryFn:async()=>{const{data:T}=await md();return m(T||[]),T}});u.useEffect(()=>{o({"drag-handle":r,actions:!r}),p({pageSize:r?99999:10,pageIndex:0})},[r]);const j=(T,S)=>{r&&(T.dataTransfer.setData("text/plain",S.toString()),T.currentTarget.classList.add("opacity-50"))},C=(T,S)=>{if(!r)return;T.preventDefault(),T.currentTarget.classList.remove("bg-muted");const P=parseInt(T.dataTransfer.getData("text/plain"));if(P===S)return;const L=[...i],[G]=L.splice(P,1);L.splice(S,0,G),m(L)},g=async()=>{r?pd({ids:i.map(T=>T.id)}).then(()=>{k(),c(!1),A.success("排序保存成功")}):c(!0)},w=Ye({data:i,columns:Tu({refetch:k,isSortMode:r}),state:{sorting:a,columnFilters:s,columnVisibility:x,pagination:d},onSortingChange:l,onColumnFiltersChange:n,onColumnVisibilityChange:o,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),getSortedRowModel:rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(os,{table:w,toolbar:T=>e.jsx(ku,{table:T,refetch:k,saveOrder:g,isSortMode:r}),draggable:r,onDragStart:j,onDragEnd:T=>T.currentTarget.classList.remove("opacity-50"),onDragOver:T=>{T.preventDefault(),T.currentTarget.classList.add("bg-muted")},onDragLeave:T=>T.currentTarget.classList.remove("bg-muted"),onDrop:C,showPagination:!r})}function Du(){const{t:s}=F("knowledge");return e.jsxs(ke,{children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(Pu,{})})]})]})}const Eu=Object.freeze(Object.defineProperty({__proto__:null,default:Du},Symbol.toStringTag,{value:"Module"}));function Ru(s,n){const[a,l]=u.useState(s);return u.useEffect(()=>{const r=setTimeout(()=>l(s),n);return()=>{clearTimeout(r)}},[s,n]),a}function Jt(s,n){if(s.length===0)return{};if(!n)return{"":s};const a={};return s.forEach(l=>{const r=l[n]||"";a[r]||(a[r]=[]),a[r].push(l)}),a}function Iu(s,n){const a=JSON.parse(JSON.stringify(s));for(const[l,r]of Object.entries(a))a[l]=r.filter(c=>!n.find(i=>i.value===c.value));return a}function Vu(s,n){for(const[,a]of Object.entries(s))if(a.some(l=>n.find(r=>r.value===l.value)))return!0;return!1}const qr=u.forwardRef(({className:s,...n},a)=>Si(r=>r.filtered.count===0)?e.jsx("div",{ref:a,className:N("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...n}):null);qr.displayName="CommandEmpty";const xt=u.forwardRef(({value:s,onChange:n,placeholder:a,defaultOptions:l=[],options:r,delay:c,onSearch:i,loadingIndicator:m,emptyIndicator:x,maxSelected:o=Number.MAX_SAFE_INTEGER,onMaxSelected:d,hidePlaceholderWhenSelected:p,disabled:k,groupBy:I,className:f,badgeClassName:j,selectFirstItem:C=!0,creatable:g=!1,triggerSearchOnFocus:w=!1,commandProps:T,inputProps:S,hideClearAllButton:P=!1},L)=>{const G=u.useRef(null),[O,X]=u.useState(!1),Je=u.useRef(!1),[is,Vs]=u.useState(!1),[ee,$]=u.useState(s||[]),[ae,te]=u.useState(Jt(l,I)),[Ue,st]=u.useState(""),tt=Ru(Ue,c||500);u.useImperativeHandle(L,()=>({selectedValue:[...ee],input:G.current,focus:()=>G.current?.focus()}),[ee]);const jt=u.useCallback(Q=>{const ie=ee.filter(Oe=>Oe.value!==Q.value);$(ie),n?.(ie)},[n,ee]),ml=u.useCallback(Q=>{const ie=G.current;ie&&((Q.key==="Delete"||Q.key==="Backspace")&&ie.value===""&&ee.length>0&&(ee[ee.length-1].fixed||jt(ee[ee.length-1])),Q.key==="Escape"&&ie.blur())},[jt,ee]);u.useEffect(()=>{s&&$(s)},[s]),u.useEffect(()=>{if(!r||i)return;const Q=Jt(r||[],I);JSON.stringify(Q)!==JSON.stringify(ae)&&te(Q)},[l,r,I,i,ae]),u.useEffect(()=>{const Q=async()=>{Vs(!0);const Oe=await i?.(tt);te(Jt(Oe||[],I)),Vs(!1)};(async()=>{!i||!O||(w&&await Q(),tt&&await Q())})()},[tt,I,O,w]);const ul=()=>{if(!g||Vu(ae,[{value:Ue,label:Ue}])||ee.find(ie=>ie.value===Ue))return;const Q=e.jsx(De,{value:Ue,className:"cursor-pointer",onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation()},onSelect:ie=>{if(ee.length>=o){d?.(ee.length);return}st("");const Oe=[...ee,{value:ie,label:ie}];$(Oe),n?.(Oe)},children:`Create "${Ue}"`});if(!i&&Ue.length>0||i&&tt.length>0&&!is)return Q},xl=u.useCallback(()=>{if(x)return i&&!g&&Object.keys(ae).length===0?e.jsx(De,{value:"-",disabled:!0,children:x}):e.jsx(qr,{children:x})},[g,x,i,ae]),hl=u.useMemo(()=>Iu(ae,ee),[ae,ee]),fl=u.useCallback(()=>{if(T?.filter)return T.filter;if(g)return(Q,ie)=>Q.toLowerCase().includes(ie.toLowerCase())?1:-1},[g,T?.filter]),pl=u.useCallback(()=>{const Q=ee.filter(ie=>ie.fixed);$(Q),n?.(Q)},[n,ee]);return e.jsxs(Rs,{...T,onKeyDown:Q=>{ml(Q),T?.onKeyDown?.(Q)},className:N("h-auto overflow-visible bg-transparent",T?.className),shouldFilter:T?.shouldFilter!==void 0?T.shouldFilter:!i,filter:fl(),children:[e.jsx("div",{className:N("rounded-md border border-input text-sm ring-offset-background focus-within:ring-1 focus-within:ring-ring ",{"px-3 py-2":ee.length!==0,"cursor-text":!k&&ee.length!==0},f),onClick:()=>{k||G.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[ee.map(Q=>e.jsxs(K,{className:N("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",j),"data-fixed":Q.fixed,"data-disabled":k||void 0,children:[Q.label,e.jsx("button",{className:N("ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",(k||Q.fixed)&&"hidden"),onKeyDown:ie=>{ie.key==="Enter"&&jt(Q)},onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation()},onClick:()=>jt(Q),children:e.jsx(aa,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},Q.value)),e.jsx(Ve.Input,{...S,ref:G,value:Ue,disabled:k,onValueChange:Q=>{st(Q),S?.onValueChange?.(Q)},onBlur:Q=>{Je.current===!1&&X(!1),S?.onBlur?.(Q)},onFocus:Q=>{X(!0),w&&i?.(tt),S?.onFocus?.(Q)},placeholder:p&&ee.length!==0?"":a,className:N("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":p,"px-3 py-2":ee.length===0,"ml-1":ee.length!==0},S?.className)}),e.jsx("button",{type:"button",onClick:pl,className:N((P||k||ee.length<1||ee.filter(Q=>Q.fixed).length===ee.length)&&"hidden"),children:e.jsx(aa,{})})]})}),e.jsx("div",{className:"relative",children:O&&e.jsx(Is,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{Je.current=!1},onMouseEnter:()=>{Je.current=!0},onMouseUp:()=>{G.current?.focus()},children:is?e.jsx(e.Fragment,{children:m}):e.jsxs(e.Fragment,{children:[xl(),ul(),!C&&e.jsx(De,{value:"-",className:"hidden"}),Object.entries(hl).map(([Q,ie])=>e.jsx($e,{heading:Q,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:ie.map(Oe=>e.jsx(De,{value:Oe.value,disabled:Oe.disable,onMouseDown:at=>{at.preventDefault(),at.stopPropagation()},onSelect:()=>{if(ee.length>=o){d?.(ee.length);return}st("");const at=[...ee,Oe];$(at),n?.(at)},className:N("cursor-pointer",Oe.disable&&"cursor-default text-muted-foreground"),children:Oe.label},Oe.value))})},Q))]})})})]})});xt.displayName="MultipleSelector";const Fu=s=>h.object({id:h.number().optional(),name:h.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 Kt({refetch:s,dialogTrigger:n,defaultValues:a={name:""},type:l="add"}){const{t:r}=F("group"),c=he({resolver:ge(Fu(r)),defaultValues:a,mode:"onChange"}),[i,m]=u.useState(!1),[x,o]=u.useState(!1),d=async p=>{o(!0),Jc(p).then(()=>{A.success(r(l==="edit"?"messages.updateSuccess":"messages.createSuccess")),s&&s(),c.reset(),m(!1)}).finally(()=>{o(!1)})};return e.jsxs(ve,{open:i,onOpenChange:m,children:[e.jsx(He,{asChild:!0,children:n||e.jsxs(R,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Pe,{icon:"ion:add"}),e.jsx("span",{children:r("form.add")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:r(l==="edit"?"form.edit":"form.create")}),e.jsx(Ee,{children:r(l==="edit"?"form.editDescription":"form.createDescription")})]}),e.jsx(je,{...c,children:e.jsxs("form",{onSubmit:c.handleSubmit(d),className:"space-y-4",children:[e.jsx(b,{control:c.control,name:"name",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.name")}),e.jsx(_,{children:e.jsx(D,{placeholder:r("form.namePlaceholder"),...p,className:"w-full"})}),e.jsx(M,{children:r("form.nameDescription")}),e.jsx(E,{})]})}),e.jsxs(Ke,{className:"gap-2",children:[e.jsx(gt,{asChild:!0,children:e.jsx(R,{type:"button",variant:"outline",children:r("form.cancel")})}),e.jsxs(R,{type:"submit",disabled:x||!c.formState.isValid,children:[x&&e.jsx(fa,{className:"mr-2 h-4 w-4 animate-spin"}),r(l==="edit"?"form.update":"form.create")]})]})]})})]})]})}const Hr=u.createContext(void 0);function Mu({children:s,refetch:n}){const[a,l]=u.useState(!1),[r,c]=u.useState(null),[i,m]=u.useState(Ce.Shadowsocks);return e.jsx(Hr.Provider,{value:{isOpen:a,setIsOpen:l,editingServer:r,setEditingServer:c,serverType:i,setServerType:m,refetch:n},children:s})}function Kr(){const s=u.useContext(Hr);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function Zt({dialogTrigger:s,value:n,setValue:a,templateType:l}){const{t:r}=F("server");u.useEffect(()=>{console.log(n)},[n]);const[c,i]=u.useState(!1),[m,x]=u.useState(()=>{if(!n||Object.keys(n).length===0)return"";try{return JSON.stringify(n,null,2)}catch{return""}}),[o,d]=u.useState(null),p=g=>{if(!g)return null;try{const w=JSON.parse(g);return typeof w!="object"||w===null?r("network_settings.validation.must_be_object"):null}catch{return r("network_settings.validation.invalid_json")}},k={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"}}}},I=()=>{switch(l){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];default:return[]}},f=()=>{const g=p(m||"");if(g){A.error(g);return}try{if(!m){a(null),i(!1);return}a(JSON.parse(m)),i(!1)}catch{A.error(r("network_settings.errors.save_failed"))}},j=g=>{x(g),d(p(g))},C=g=>{const w=k[g];if(w){const T=JSON.stringify(w.content,null,2);x(T),d(null)}};return u.useEffect(()=>{c&&console.log(n)},[c,n]),u.useEffect(()=>{c&&n&&Object.keys(n).length>0&&x(JSON.stringify(n,null,2))},[c,n]),e.jsxs(ve,{open:c,onOpenChange:g=>{!g&&c&&f(),i(g)},children:[e.jsx(He,{asChild:!0,children:s??e.jsx(B,{variant:"link",children:r("network_settings.edit_protocol")})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsx(Ne,{children:e.jsx(be,{children:r("network_settings.edit_protocol_config")})}),e.jsxs("div",{className:"space-y-4",children:[I().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:I().map(g=>e.jsx(B,{variant:"outline",size:"sm",onClick:()=>C(g),children:r("network_settings.use_template",{template:k[g].label})},g))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_s,{className:`min-h-[200px] font-mono text-sm ${o?"border-red-500 focus-visible:ring-red-500":""}`,value:m,placeholder:I().length>0?r("network_settings.json_config_placeholder_with_template"):r("network_settings.json_config_placeholder"),onChange:g=>j(g.target.value)}),o&&e.jsx("p",{className:"text-sm text-red-500",children:o})]})]}),e.jsxs(Ke,{className:"gap-2",children:[e.jsx(B,{variant:"outline",onClick:()=>i(!1),children:r("common.cancel")}),e.jsx(B,{onClick:f,disabled:!!o,children:r("common.confirm")})]})]})]})}function $h(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 Ou={},zu=Object.freeze(Object.defineProperty({__proto__:null,default:Ou},Symbol.toStringTag,{value:"Module"})),qh=Ai(zu),sn=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Lu=()=>{try{const s=ki.box.keyPair(),n=sn(Ha.encodeBase64(s.secretKey)),a=sn(Ha.encodeBase64(s.publicKey));return{privateKey:n,publicKey:a}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},Au=()=>{try{return Lu()}catch(s){throw console.error("Error generating key pair:",s),s}},$u=s=>{const n=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(n),Array.from(n).map(a=>a.toString(16).padStart(2,"0")).join("").substring(0,s)},qu=()=>{const s=Math.floor(Math.random()*8)*2+2;return $u(s)},Hu=h.object({cipher:h.string().default("aes-128-gcm"),obfs:h.string().default("0"),obfs_settings:h.object({path:h.string().default(""),host:h.string().default("")}).default({})}),Ku=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({})}),Uu=h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({})}),Bu=h.object({version:h.coerce.number().default(2),alpn:h.string().default("h2"),obfs:h.object({open:h.coerce.boolean().default(!1),type:h.string().default("salamander"),password:h.string().default("")}).default({}),tls:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),bandwidth:h.object({up:h.string().default(""),down:h.string().default("")}).default({})}),Gu=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),reality_settings:h.object({server_port:h.coerce.number().default(443),server_name:h.string().default(""),allow_insecure:h.boolean().default(!1),public_key:h.string().default(""),private_key:h.string().default(""),short_id:h.string().default("")}).default({}),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({}),flow:h.string().default("")}),xs={shadowsocks:{schema:Hu,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"]},vmess:{schema:Ku,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:Uu,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Bu,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:Gu,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"]}},Wu=({serverType:s,value:n,onChange:a})=>{const{t:l}=F("server"),r=s?xs[s]:null,c=r?.schema||h.record(h.any()),i=s?c.parse({}):{},m=he({resolver:ge(c),defaultValues:i,mode:"onChange"});if(u.useEffect(()=>{if(!n||Object.keys(n).length===0){if(s){const f=c.parse({});m.reset(f)}}else m.reset(n)},[s,n,a,m,c]),u.useEffect(()=>{const f=m.watch(j=>{a(j)});return()=>f.unsubscribe()},[m,a]),!s||!r)return null;const I={shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(b,{control:m.control,name:"cipher",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.shadowsocks.cipher.label")}),e.jsx(_,{children:e.jsxs(J,{onValueChange:f.onChange,value:f.value,children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.shadowsocks.cipher.placeholder")})}),e.jsx(Y,{children:e.jsx(ws,{children:xs.shadowsocks.ciphers.map(j=>e.jsx(q,{value:j,children:j},j))})})]})})]})}),e.jsx(b,{control:m.control,name:"obfs",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.shadowsocks.obfs.label")}),e.jsx(_,{children:e.jsxs(J,{onValueChange:f.onChange,value:f.value,children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.shadowsocks.obfs.placeholder")})}),e.jsx(Y,{children:e.jsxs(ws,{children:[e.jsx(q,{value:"0",children:l("dynamic_form.shadowsocks.obfs.none")}),e.jsx(q,{value:"http",children:l("dynamic_form.shadowsocks.obfs.http")})]})})]})})]})}),m.watch("obfs")==="http"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"obfs_settings.path",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(_,{children:e.jsx(D,{type:"text",placeholder:l("dynamic_form.shadowsocks.obfs_settings.path"),...f})}),e.jsx(E,{})]})}),e.jsx(b,{control:m.control,name:"obfs_settings.host",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(_,{children:e.jsx(D,{type:"text",placeholder:l("dynamic_form.shadowsocks.obfs_settings.host"),...f})}),e.jsx(E,{})]})})]})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(b,{control:m.control,name:"tls",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vmess.tls.label")}),e.jsx(_,{children:e.jsxs(J,{value:f.value?.toString(),onValueChange:j=>f.onChange(Number(j)),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.vmess.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:l("dynamic_form.vmess.tls.disabled")}),e.jsx(q,{value:"1",children:l("dynamic_form.vmess.tls.enabled")})]})]})})]})}),m.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"tls_settings.server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.vmess.tls_settings.server_name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:l("dynamic_form.vmess.tls_settings.server_name.placeholder"),...f})})]})}),e.jsx(b,{control:m.control,name:"tls_settings.allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vmess.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(U,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),e.jsx(b,{control:m.control,name:"network",render:({field:f})=>e.jsxs(v,{children:[e.jsxs(y,{children:[l("dynamic_form.vmess.network.label"),e.jsx(Zt,{value:m.watch("network_settings"),setValue:j=>m.setValue("network_settings",j),templateType:m.watch("network")})]}),e.jsx(_,{children:e.jsxs(J,{onValueChange:f.onChange,value:f.value,children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.vmess.network.placeholder")})}),e.jsx(Y,{children:e.jsx(ws,{children:xs.vmess.networkOptions.map(j=>e.jsx(q,{value:j.value,className:"cursor-pointer",children:j.label},j.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.trojan.server_name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:l("dynamic_form.trojan.server_name.placeholder"),...f,value:f.value||""})})]})}),e.jsx(b,{control:m.control,name:"allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.trojan.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(U,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})})]}),e.jsx(b,{control:m.control,name:"network",render:({field:f})=>e.jsxs(v,{children:[e.jsxs(y,{children:[l("dynamic_form.trojan.network.label"),e.jsx(Zt,{value:m.watch("network_settings")||{},setValue:j=>m.setValue("network_settings",j),templateType:m.watch("network")||"tcp"})]}),e.jsx(_,{children:e.jsxs(J,{onValueChange:f.onChange,value:f.value||"tcp",children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.trojan.network.placeholder")})}),e.jsx(Y,{children:e.jsx(ws,{children:xs.trojan.networkOptions.map(j=>e.jsx(q,{value:j.value,className:"cursor-pointer",children:j.label},j.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"version",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:l("dynamic_form.hysteria.version.label")}),e.jsx(_,{children:e.jsxs(J,{value:(f.value||2).toString(),onValueChange:j=>f.onChange(Number(j)),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.hysteria.version.placeholder")})}),e.jsx(Y,{children:e.jsx(ws,{children:xs.hysteria.versions.map(j=>e.jsxs(q,{value:j,className:"cursor-pointer",children:["V",j]},j))})})]})})]})}),m.watch("version")==1&&e.jsx(b,{control:m.control,name:"alpn",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.hysteria.alpn.label")}),e.jsx(_,{children:e.jsxs(J,{value:f.value||"h2",onValueChange:f.onChange,children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.hysteria.alpn.placeholder")})}),e.jsx(Y,{children:e.jsx(ws,{children:xs.hysteria.alpnOptions.map(j=>e.jsx(q,{value:j,children:j},j))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"obfs.open",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.hysteria.obfs.label")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(U,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})}),!!m.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[m.watch("version")=="2"&&e.jsx(b,{control:m.control,name:"obfs.type",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:l("dynamic_form.hysteria.obfs.type.label")}),e.jsx(_,{children:e.jsxs(J,{value:f.value||"salamander",onValueChange:f.onChange,children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.hysteria.obfs.type.placeholder")})}),e.jsx(Y,{children:e.jsx(ws,{children:e.jsx(q,{value:"salamander",children:l("dynamic_form.hysteria.obfs.type.salamander")})})})]})})]})}),e.jsx(b,{control:m.control,name:"obfs.password",render:({field:f})=>e.jsxs(v,{className:m.watch("version")==2?"w-full":"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.hysteria.obfs.password.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(_,{children:e.jsx(D,{placeholder:l("dynamic_form.hysteria.obfs.password.placeholder"),...f,value:f.value||"",className:"pr-9"})}),e.jsx(B,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",C=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(g=>j[g%j.length]).join("");m.setValue("obfs.password",C),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(Pe,{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(b,{control:m.control,name:"tls.server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.hysteria.tls.server_name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:l("dynamic_form.hysteria.tls.server_name.placeholder"),...f,value:f.value||""})})]})}),e.jsx(b,{control:m.control,name:"tls.allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.hysteria.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(U,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})})]}),e.jsx(b,{control:m.control,name:"bandwidth.up",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.hysteria.bandwidth.up.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",placeholder:l("dynamic_form.hysteria.bandwidth.up.placeholder")+(m.watch("version")==2?l("dynamic_form.hysteria.bandwidth.up.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...f,value:f.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(b,{control:m.control,name:"bandwidth.down",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.hysteria.bandwidth.down.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",placeholder:l("dynamic_form.hysteria.bandwidth.down.placeholder")+(m.watch("version")==2?l("dynamic_form.hysteria.bandwidth.down.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...f,value:f.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")})})]})]})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(b,{control:m.control,name:"tls",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.tls.label")}),e.jsx(_,{children:e.jsxs(J,{value:f.value?.toString(),onValueChange:j=>f.onChange(Number(j)),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.vless.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:l("dynamic_form.vless.tls.none")}),e.jsx(q,{value:"1",children:l("dynamic_form.vless.tls.tls")}),e.jsx(q,{value:"2",children:l("dynamic_form.vless.tls.reality")})]})]})})]})}),m.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"tls_settings.server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.vless.tls_settings.server_name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:l("dynamic_form.vless.tls_settings.server_name.placeholder"),...f})})]})}),e.jsx(b,{control:m.control,name:"tls_settings.allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(U,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),m.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"reality_settings.server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.server_name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:l("dynamic_form.vless.reality_settings.server_name.placeholder"),...f})})]})}),e.jsx(b,{control:m.control,name:"reality_settings.server_port",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.server_port.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:l("dynamic_form.vless.reality_settings.server_port.placeholder"),...f})})]})}),e.jsx(b,{control:m.control,name:"reality_settings.allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(U,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx(b,{control:m.control,name:"reality_settings.private_key",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.private_key.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(_,{children:e.jsx(D,{...f,className:"pr-9"})}),e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(B,{type:"button",variant:"ghost",size:"icon",onClick:()=>{try{const j=Au();m.setValue("reality_settings.private_key",j.privateKey),m.setValue("reality_settings.public_key",j.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(Pe,{icon:"ion:key-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(Pt,{children:e.jsx(oe,{children:e.jsx("p",{children:l("dynamic_form.vless.reality_settings.key_pair.generate")})})})]})]})]})})}),e.jsx(b,{control:m.control,name:"reality_settings.public_key",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.public_key.label")}),e.jsx(_,{children:e.jsx(D,{...f})})]})}),e.jsx(b,{control:m.control,name:"reality_settings.short_id",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.short_id.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(_,{children:e.jsx(D,{...f,className:"pr-9",placeholder:l("dynamic_form.vless.reality_settings.short_id.placeholder")})}),e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(B,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const j=qu();m.setValue("reality_settings.short_id",j),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(Pe,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(Pt,{children:e.jsx(oe,{children:e.jsx("p",{children:l("dynamic_form.vless.reality_settings.short_id.generate")})})})]})]}),e.jsx(M,{className:"text-xs text-muted-foreground",children:l("dynamic_form.vless.reality_settings.short_id.description")})]})})]}),e.jsx(b,{control:m.control,name:"network",render:({field:f})=>e.jsxs(v,{children:[e.jsxs(y,{children:[l("dynamic_form.vless.network.label"),e.jsx(Zt,{value:m.watch("network_settings"),setValue:j=>m.setValue("network_settings",j),templateType:m.watch("network")})]}),e.jsx(_,{children:e.jsxs(J,{onValueChange:f.onChange,value:f.value,children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.vless.network.placeholder")})}),e.jsx(Y,{children:e.jsx(ws,{children:xs.vless.networkOptions.map(j=>e.jsx(q,{value:j.value,className:"cursor-pointer",children:j.label},j.value))})})]})})]})}),e.jsx(b,{control:m.control,name:"flow",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.flow.label")}),e.jsx(_,{children:e.jsxs(J,{onValueChange:j=>f.onChange(j==="none"?null:j),value:f.value||"none",children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dynamic_form.vless.flow.placeholder")})}),e.jsx(Y,{children:xs.vless.flowOptions.map(j=>e.jsx(q,{value:j,children:j},j))})]})})]})})]})};return e.jsx(xe,{children:I[s]?.()})},Yu=h.object({id:h.number().optional().nullable(),code:h.string().optional(),name:h.string().min(1,"form.name.error"),rate:h.string().min(1,"form.rate.error"),tags:h.array(h.string()).default([]),excludes:h.array(h.string()).default([]),ips:h.array(h.string()).default([]),group_ids:h.array(h.string()).default([]),host:h.string().min(1,"form.host.error"),port:h.string().min(1,"form.port.error"),server_port:h.string().min(1,"form.server_port.error"),parent_id:h.string().default("0").nullable(),route_ids:h.array(h.string()).default([]),protocol_settings:h.record(h.any()).default({}).nullable()}),yt={id:null,code:"",name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null};function Qu(){const{t:s}=F("server"),{isOpen:n,setIsOpen:a,editingServer:l,setEditingServer:r,serverType:c,setServerType:i,refetch:m}=Kr(),[x,o]=u.useState([]),[d,p]=u.useState([]),[k,I]=u.useState([]),f=he({resolver:ge(Yu),defaultValues:yt,mode:"onChange"});u.useEffect(()=>{j()},[n]),u.useEffect(()=>{l?.type&&l.type!==c&&i(l.type)},[l,c,i]),u.useEffect(()=>{l?l.type===c&&f.reset({...yt,...l}):f.reset({...yt,protocol_settings:xs[c].schema.parse({})})},[l,f,c]);const j=async()=>{if(!n)return;const[S,P,L]=await Promise.all([qt(),Er(),Dr()]);o(S.data?.map(G=>({label:G.name,value:G.id.toString()}))||[]),p(P.data?.map(G=>({label:G.remarks,value:G.id.toString()}))||[]),I(L.data||[])},C=u.useMemo(()=>k?.filter(S=>(S.parent_id===0||S.parent_id===null)&&S.type===c&&S.id!==f.watch("id")),[c,k,f]),g=()=>e.jsxs(Ds,{children:[e.jsx(Es,{asChild:!0,children:e.jsxs(R,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Pe,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(gs,{align:"start",children:e.jsx(bc,{children:Ms.map(({type:S,label:P})=>e.jsx(ye,{onClick:()=>{i(S),a(!0)},className:"cursor-pointer",children:e.jsx(K,{variant:"outline",className:"text-white",style:{background:fs[S]},children:P})},S))})})]}),w=()=>{a(!1),r(null),f.reset(yt)},T=async()=>{const S=f.getValues();(await Bc({...S,type:c})).data&&(w(),A.success(s("form.success")),m())};return e.jsxs(ve,{open:n,onOpenChange:w,children:[g(),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:s(l?"form.edit_node":"form.new_node")}),e.jsx(Ee,{})]}),e.jsxs(je,{...f,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:f.control,name:"name",render:({field:S})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:s("form.name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("form.name.placeholder"),...S})}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"rate",render:({field:S})=>e.jsxs(v,{className:"flex-[1]",children:[e.jsx(y,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(_,{children:e.jsx(D,{type:"number",min:"0",step:"0.1",...S})})}),e.jsx(E,{})]})})]}),e.jsx(b,{control:f.control,name:"code",render:({field:S})=>e.jsxs(v,{children:[e.jsxs(y,{children:[s("form.code.label"),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:s("form.code.optional")})]}),e.jsx(_,{children:e.jsx(D,{placeholder:s("form.code.placeholder"),...S,value:S.value||""})}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"tags",render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.tags.label")}),e.jsx(_,{children:e.jsx(Ea,{value:S.value,onChange:S.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"group_ids",render:({field:S})=>e.jsxs(v,{children:[e.jsxs(y,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(Kt,{dialogTrigger:e.jsx(R,{variant:"link",children:s("form.groups.add")}),refetch:j})]}),e.jsx(_,{children:e.jsx(xt,{options:x,onChange:P=>S.onChange(P.map(L=>L.value)),value:x?.filter(P=>S.value.includes(P.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(E,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:f.control,name:"host",render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.host.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("form.host.placeholder"),...S})}),e.jsx(E,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(b,{control:f.control,name:"port",render:({field:S})=>e.jsxs(v,{className:"flex-1",children:[e.jsxs(y,{className:"flex items-center gap-1.5",children:[s("form.port.label"),e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(Pe,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Pt,{children:e.jsx(oe,{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(_,{children:e.jsx(D,{placeholder:s("form.port.placeholder"),...S})}),e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(R,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const P=S.value;P&&f.setValue("server_port",P)},children:e.jsx(Pe,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(oe,{side:"right",children:e.jsx("p",{children:s("form.port.sync")})})]})})]}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"server_port",render:({field:S})=>e.jsxs(v,{className:"flex-1",children:[e.jsxs(y,{className:"flex items-center gap-1.5",children:[s("form.server_port.label"),e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(Pe,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Pt,{children:e.jsx(oe,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.server_port.tooltip")})})})]})})]}),e.jsx(_,{children:e.jsx(D,{placeholder:s("form.server_port.placeholder"),...S})}),e.jsx(E,{})]})})]})]}),n&&e.jsx(Wu,{serverType:c,value:f.watch("protocol_settings"),onChange:S=>f.setValue("protocol_settings",S,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(b,{control:f.control,name:"parent_id",render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.parent.label")}),e.jsxs(J,{onValueChange:S.onChange,value:S.value?.toString()||"0",children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Z,{placeholder:s("form.parent.placeholder")})})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:s("form.parent.none")}),C?.map(P=>e.jsx(q,{value:P.id.toString(),className:"cursor-pointer",children:P.name},P.id))]})]}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"route_ids",render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.route.label")}),e.jsx(_,{children:e.jsx(xt,{options:d,onChange:P=>S.onChange(P.map(L=>L.value)),value:d?.filter(P=>S.value.includes(P.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(E,{})]})})]}),e.jsxs(Ke,{className:"mt-6",children:[e.jsx(R,{type:"button",variant:"outline",onClick:w,children:s("form.cancel")}),e.jsx(R,{type:"submit",onClick:T,children:s("form.submit")})]})]})]})]})}function tn({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsxs(R,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(pt,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(we,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{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(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(c=>r.has(c.value)).map(c=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(ls,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Rs,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Is,{children:[e.jsx(qs,{children:"No results found."}),e.jsx($e,{children:a.map(c=>{const i=r.has(c.value);return e.jsxs(De,{onSelect:()=>{i?r.delete(c.value):r.add(c.value);const m=Array.from(r);s?.setFilterValue(m.length?m:void 0)},className:"cursor-pointer",children:[e.jsx("div",{className:N("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(zs,{className:N("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${c.color}`}),e.jsx("span",{children:c.label}),l?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(c.value)})]},c.value)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(et,{}),e.jsx($e,{children:e.jsx(De,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Ju=[{value:Ce.Shadowsocks,label:Ms.find(s=>s.type===Ce.Shadowsocks)?.label,color:fs[Ce.Shadowsocks]},{value:Ce.Vmess,label:Ms.find(s=>s.type===Ce.Vmess)?.label,color:fs[Ce.Vmess]},{value:Ce.Trojan,label:Ms.find(s=>s.type===Ce.Trojan)?.label,color:fs[Ce.Trojan]},{value:Ce.Hysteria,label:Ms.find(s=>s.type===Ce.Hysteria)?.label,color:fs[Ce.Hysteria]},{value:Ce.Vless,label:Ms.find(s=>s.type===Ce.Vless)?.label,color:fs[Ce.Vless]}];function Zu({table:s,saveOrder:n,isSortMode:a,groups:l}){const r=s.getState().columnFilters.length>0,{t:c}=F("server"),i=l.map(m=>({label:m,value:m}));return e.jsxs("div",{className:"flex items-center justify-between ",children:[e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[!a&&e.jsxs(e.Fragment,{children:[e.jsx(Qu,{}),e.jsx(D,{placeholder:c("toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:m=>s.getColumn("name")?.setFilterValue(m.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(tn,{column:s.getColumn("type"),title:c("toolbar.type"),options:Ju}),s.getColumn("groups")&&e.jsx(tn,{column:s.getColumn("groups"),title:c("columns.groups.title"),options:i})]}),r&&e.jsxs(R,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[c("toolbar.reset"),e.jsx(Be,{className:"ml-2 h-4 w-4"})]})]}),a&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:c("toolbar.sort.tip")})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(R,{variant:a?"default":"outline",onClick:n,size:"sm",children:c(a?"toolbar.sort.save":"toolbar.sort.edit")})})]})}const ht=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"})}),Nt={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"},Xu=s=>{const{t:n}=F("server");return[{id:"drag-handle",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.sort")}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(zt,{className:"size-4 cursor-move text-muted-foreground transition-colors hover:text-primary","aria-hidden":"true"})}),size:50},{accessorKey:"id",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.nodeId")}),cell:({row:a})=>{const l=a.getValue("id"),r=a.original.code;return e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(K,{variant:"outline",className:N("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:fs[a.original.type]},children:[e.jsx(tr,{className:"size-3"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"flex items-center gap-0.5",children:r??l}),a.original.parent?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground/30",children:"→"}),e.jsx("span",{children:a.original.parent?.code||a.original.parent?.id})]}):""]})]}),e.jsx(R,{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:c=>{c.stopPropagation(),Rt(r||l.toString()).then(()=>{A.success(n("common:copy.success"))})},children:e.jsx(Ka,{className:"size-3"})})]})}),e.jsxs(oe,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[Ms.find(c=>c.type===a.original.type)?.label,a.original.parent_id?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:200,enableSorting:!0},{accessorKey:"show",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.show")}),cell:({row:a})=>{const[l,r]=u.useState(!!a.getValue("show"));return e.jsx(U,{checked:l,onCheckedChange:async c=>{r(c),Yc({id:a.original.id,type:a.original.type,show:c?1:0}).catch(()=>{r(!c),s()})},style:{backgroundColor:l?fs[a.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(z,{column:a,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:N("h-2.5 w-2.5 rounded-full",Nt[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:N("h-2.5 w-2.5 rounded-full",Nt[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:N("h-2.5 w-2.5 rounded-full",Nt[2])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.2")})]})]})})}),cell:({row:a})=>e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{children:e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:N("size-2.5 flex-shrink-0 rounded-full transition-all duration-200",Nt[a.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:a.getValue("name")})]})}),e.jsx(oe,{children:e.jsx("p",{className:"font-medium",children:n(`columns.status.${a.original.available_status}`)})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.address")}),cell:({row:a})=>{const l=`${a.original.host}:${a.original.port}`,r=a.original.port!==a.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:[a.original.host,":",a.original.port]})}),r&&e.jsxs("span",{className:"whitespace-nowrap text-[0.7rem] tracking-tight text-muted-foreground/40",children:["(",n("columns.internalPort")," ",a.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(xe,{delayDuration:0,children:e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(R,{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:c=>{c.stopPropagation(),Rt(l).then(()=>{A.success(n("common:copy.success"))})},children:e.jsx(Ka,{className:"size-3"})})}),e.jsx(oe,{side:"top",sideOffset:10,children:n("columns.copyAddress")})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.onlineUsers.title"),tooltip:n("columns.onlineUsers.tooltip")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(ht,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:a.getValue("online")})]}),size:80,enableSorting:!0,enableHiding:!0},{accessorKey:"rate",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.rate.title"),tooltip:n("columns.rate.tooltip")}),cell:({row:a})=>e.jsxs(K,{variant:"secondary",className:"font-medium",children:[a.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"groups",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.groups.title"),tooltip:n("columns.groups.tooltip")}),cell:({row:a})=>{const l=a.getValue("groups")||[];return e.jsx("div",{className:"flex min-w-[300px] max-w-[600px] flex-wrap items-center gap-1.5",children:l.length>0?l.map((r,c)=>e.jsx(K,{variant:"secondary",className:N("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:r.name},c)):e.jsx("span",{className:"text-sm text-muted-foreground",children:n("columns.groups.empty")})})},enableSorting:!1,size:600,filterFn:(a,l,r)=>{const c=a.getValue(l);return c?r.some(i=>c.includes(i)):!1}},{accessorKey:"type",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.type")}),cell:({row:a})=>{const l=a.getValue("type");return e.jsx(K,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:fs[l]},children:l})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:a})=>e.jsx(z,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>{const{setIsOpen:l,setEditingServer:r,setServerType:c}=Kr();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(Ds,{modal:!1,children:[e.jsx(Es,{asChild:!0,children:e.jsx(R,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":n("columns.actions"),children:e.jsx(Dt,{className:"size-4"})})}),e.jsxs(gs,{align:"end",className:"w-40",children:[e.jsx(ye,{className:"cursor-pointer",onClick:()=>{c(a.original.type),r(a.original),l(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(Ti,{className:"mr-2 size-4"}),n("columns.actions_dropdown.edit")]})}),e.jsxs(ye,{className:"cursor-pointer",onClick:async()=>{Wc({id:a.original.id}).then(({data:i})=>{i&&(A.success(n("columns.actions_dropdown.copy_success")),s())})},children:[e.jsx(Pi,{className:"mr-2 size-4"}),n("columns.actions_dropdown.copy")]}),e.jsx(ut,{}),e.jsx(ye,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:i=>i.preventDefault(),children:e.jsx(qe,{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()=>{Gc({id:a.original.id}).then(({data:i})=>{i&&(A.success(n("columns.actions_dropdown.delete_success")),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(ts,{className:"mr-2 size-4"}),n("columns.actions_dropdown.delete.confirm")]})})})]})]})})},size:50}]};function ex(){const[s,n]=u.useState({}),[a,l]=u.useState({"drag-handle":!1}),[r,c]=u.useState([]),[i,m]=u.useState({pageSize:500,pageIndex:0}),[x,o]=u.useState([]),[d,p]=u.useState(!1),[k,I]=u.useState({}),[f,j]=u.useState([]),{refetch:C}=ne({queryKey:["nodeList"],queryFn:async()=>{const{data:L}=await Dr();return j(L),L}}),g=u.useMemo(()=>{const L=new Set;return f.forEach(G=>{G.groups&&G.groups.forEach(O=>L.add(O.name))}),Array.from(L).sort()},[f]);u.useEffect(()=>{l({"drag-handle":d,show:!d,host:!d,online:!d,rate:!d,groups:!d,type:!1,actions:!d}),I({name:d?2e3:200}),m({pageSize:d?99999:500,pageIndex:0})},[d]);const w=(L,G)=>{d&&(L.dataTransfer.setData("text/plain",G.toString()),L.currentTarget.classList.add("opacity-50"))},T=(L,G)=>{if(!d)return;L.preventDefault(),L.currentTarget.classList.remove("bg-muted");const O=parseInt(L.dataTransfer.getData("text/plain"));if(O===G)return;const X=[...f],[Je]=X.splice(O,1);X.splice(G,0,Je),j(X)},S=async()=>{if(!d){p(!0);return}const L=f?.map((G,O)=>({id:G.id,order:O+1}));Qc(L).then(()=>{A.success("排序保存成功"),p(!1),C()}).finally(()=>{p(!1)})},P=Ye({data:f||[],columns:Xu(C),state:{sorting:x,columnVisibility:a,rowSelection:s,columnFilters:r,columnSizing:k,pagination:i},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:o,onColumnFiltersChange:c,onColumnVisibilityChange:l,onColumnSizingChange:I,onPaginationChange:m,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),getSortedRowModel:rs(),getFacetedRowModel:vs(),getFacetedUniqueValues:bs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Mu,{refetch:C,children:e.jsx("div",{className:"space-y-4",children:e.jsx(os,{table:P,toolbar:L=>e.jsx(Zu,{table:L,refetch:C,saveOrder:S,isSortMode:d,groups:g}),draggable:d,onDragStart:w,onDragEnd:L=>L.currentTarget.classList.remove("opacity-50"),onDragOver:L=>{L.preventDefault(),L.currentTarget.classList.add("bg-muted")},onDragLeave:L=>L.currentTarget.classList.remove("bg-muted"),onDrop:T,showPagination:!d})})})}function sx(){const{t:s}=F("server");return e.jsxs(ke,{children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(ex,{})})]})]})}const tx=Object.freeze(Object.defineProperty({__proto__:null,default:sx},Symbol.toStringTag,{value:"Module"}));function ax({table:s,refetch:n}){const a=s.getState().columnFilters.length>0,{t:l}=F("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(Kt,{refetch:n}),e.jsx(D,{placeholder:l("toolbar.searchPlaceholder"),value:s.getColumn("name")?.getFilterValue()??"",onChange:r=>s.getColumn("name")?.setFilterValue(r.target.value),className:N("h-8 w-[150px] lg:w-[250px]",a&&"border-primary/50 ring-primary/20")}),a&&e.jsxs(R,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(Be,{className:"ml-2 h-4 w-4"})]})]})})}const nx=s=>{const{t:n}=F("group");return[{accessorKey:"id",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.id")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(K,{variant:"outline",children:a.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.name")}),cell:({row:a})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium",children:a.getValue("name")})})},{accessorKey:"users_count",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.usersCount")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(ht,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:a.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"server_count",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.serverCount")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(tr,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:a.getValue("server_count")})]}),enableSorting:!0,size:8e3},{id:"actions",header:({column:a})=>e.jsx(z,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Kt,{defaultValues:a.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(qe,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{Zc({id:a.original.id}).then(({data:l})=>{l&&(A.success(n("messages.updateSuccess")),s())})},children:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ts,{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 rx(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,c]=u.useState([]),[i,m]=u.useState([]),{data:x,refetch:o,isLoading:d}=ne({queryKey:["serverGroupList"],queryFn:async()=>{const{data:k}=await qt();return k}}),p=Ye({data:x||[],columns:nx(o),state:{sorting:i,columnVisibility:a,rowSelection:s,columnFilters:r},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),getSortedRowModel:rs(),getFacetedRowModel:vs(),getFacetedUniqueValues:bs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(os,{table:p,toolbar:k=>e.jsx(ax,{table:k,refetch:o}),isLoading:d})}function lx(){const{t:s}=F("group");return e.jsxs(ke,{children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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,{})})]})]})}const ox=Object.freeze(Object.defineProperty({__proto__:null,default:lx},Symbol.toStringTag,{value:"Module"})),ix=s=>h.object({remarks:h.string().min(1,s("form.validation.remarks")),match:h.array(h.string()),action:h.enum(["block","dns"]),action_value:h.string().optional()});function Ur({refetch:s,dialogTrigger:n,defaultValues:a={remarks:"",match:[],action:"block",action_value:""},type:l="add"}){const{t:r}=F("route"),c=he({resolver:ge(ix(r)),defaultValues:a,mode:"onChange"}),[i,m]=u.useState(!1);return e.jsxs(ve,{open:i,onOpenChange:m,children:[e.jsx(He,{asChild:!0,children:n||e.jsxs(R,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Pe,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:r(l==="edit"?"form.edit":"form.create")}),e.jsx(Ee,{})]}),e.jsxs(je,{...c,children:[e.jsx(b,{control:c.control,name:"remarks",render:({field:x})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:r("form.remarks")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(D,{type:"text",placeholder:r("form.remarksPlaceholder"),...x})})}),e.jsx(E,{})]})}),e.jsx(b,{control:c.control,name:"match",render:({field:x})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:r("form.match")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(_s,{className:"min-h-[120px]",placeholder:r("form.matchPlaceholder"),value:x.value.join(` -`),onChange:o=>{x.onChange(o.target.value.split(` -`))}})})}),e.jsx(E,{})]})}),e.jsx(b,{control:c.control,name:"action",render:({field:x})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsxs(J,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(W,{children:e.jsx(Z,{placeholder:r("form.actionPlaceholder")})}),e.jsxs(Y,{children:[e.jsx(q,{value:"block",children:r("actions.block")}),e.jsx(q,{value:"dns",children:r("actions.dns")})]})]})})}),e.jsx(E,{})]})}),c.watch("action")==="dns"&&e.jsx(b,{control:c.control,name:"action_value",render:({field:x})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(D,{type:"text",placeholder:r("form.dnsPlaceholder"),...x})})})]})}),e.jsxs(Ke,{children:[e.jsx(gt,{asChild:!0,children:e.jsx(R,{variant:"outline",children:r("form.cancel")})}),e.jsx(R,{type:"submit",onClick:()=>{Xc(c.getValues()).then(({data:x})=>{x&&(m(!1),s&&s(),toast.success(r(l==="edit"?"messages.updateSuccess":"messages.createSuccess")),c.reset())})},children:r("form.submit")})]})]})]})]})}function cx({table:s,refetch:n}){const a=s.getState().columnFilters.length>0,{t:l}=F("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(Ur,{refetch:n}),e.jsx(D,{placeholder:l("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:r=>s.getColumn("remarks")?.setFilterValue(r.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),a&&e.jsxs(R,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(Be,{className:"ml-2 h-4 w-4"})]})]})})}function dx({columns:s,data:n,refetch:a}){const[l,r]=u.useState({}),[c,i]=u.useState({}),[m,x]=u.useState([]),[o,d]=u.useState([]),p=Ye({data:n,columns:s,state:{sorting:o,columnVisibility:c,rowSelection:l,columnFilters:m},enableRowSelection:!0,onRowSelectionChange:r,onSortingChange:d,onColumnFiltersChange:x,onColumnVisibilityChange:i,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),getSortedRowModel:rs(),getFacetedRowModel:vs(),getFacetedUniqueValues:bs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(os,{table:p,toolbar:k=>e.jsx(cx,{table:k,refetch:a})})}const mx=s=>{const{t:n}=F("route"),a={block:{icon:Di,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:Ei,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:n("columns.id")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(K,{variant:"outline",children:l.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:l})=>e.jsx(z,{column:l,title:n("columns.remarks")}),cell:({row:l})=>{const r=l.original.match?.length||0;return 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:n("columns.matchRules",{count:r})})})},enableHiding:!1,enableSorting:!1},{accessorKey:"action",header:({column:l})=>e.jsx(z,{column:l,title:n("columns.action")}),cell:({row:l})=>{const r=l.getValue("action"),c=a[r]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(K,{variant:a[r]?.variant||"default",className:N("flex items-center gap-1.5 px-3 py-1 capitalize",a[r]?.className),children:[c&&e.jsx(c,{className:"h-3.5 w-3.5"}),n(`actions.${r}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:n("columns.actions")}),cell:({row:l})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Ur,{defaultValues:l.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(qe,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{ed({id:l.original.id}).then(({data:r})=>{r&&(A.success(n("messages.deleteSuccess")),s())})},children:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ts,{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 ux(){const{t:s}=F("route"),[n,a]=u.useState([]);function l(){Er().then(({data:r})=>{a(r)})}return u.useEffect(()=>{l()},[]),e.jsxs(ke,{children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(dx,{data:n,columns:mx(l),refetch:l})})]})]})}const xx=Object.freeze(Object.defineProperty({__proto__:null,default:ux},Symbol.toStringTag,{value:"Module"})),Br=u.createContext(void 0);function hx({children:s,refreshData:n}){const[a,l]=u.useState(!1),[r,c]=u.useState(null);return e.jsx(Br.Provider,{value:{isOpen:a,setIsOpen:l,editingPlan:r,setEditingPlan:c,refreshData:n},children:s})}function Ra(){const s=u.useContext(Br);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function fx({table:s,saveOrder:n,isSortMode:a}){const{setIsOpen:l}=Ra(),{t:r}=F("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(R,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>l(!0),children:[e.jsx(Pe,{icon:"ion:add"}),e.jsx("div",{children:r("plan.add")})]}),e.jsx(D,{placeholder:r("plan.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:c=>s.getColumn("name")?.setFilterValue(c.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(R,{variant:a?"default":"outline",onClick:n,size:"sm",children:r(a?"plan.sort.save":"plan.sort.edit")})})]})}const an={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"}},px=s=>{const{t:n}=F("subscribe");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(zt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(z,{column:a,title:n("plan.columns.id")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(K,{variant:"outline",children:a.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:a})=>e.jsx(z,{column:a,title:n("plan.columns.show")}),cell:({row:a})=>e.jsx(U,{defaultChecked:a.getValue("show"),onCheckedChange:l=>{Gt({id:a.original.id,show:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:a})=>e.jsx(z,{column:a,title:n("plan.columns.sell")}),cell:({row:a})=>e.jsx(U,{defaultChecked:a.getValue("sell"),onCheckedChange:l=>{Gt({id:a.original.id,sell:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:a})=>e.jsx(z,{column:a,title:n("plan.columns.renew"),tooltip:n("plan.columns.renew_tooltip")}),cell:({row:a})=>e.jsx(U,{defaultChecked:a.getValue("renew"),onCheckedChange:l=>{Gt({id:a.original.id,renew:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:a})=>e.jsx(z,{column:a,title:n("plan.columns.name")}),cell:({row:a})=>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:a.getValue("name")})}),enableSorting:!1,enableHiding:!1,size:900},{accessorKey:"users_count",header:({column:a})=>e.jsx(z,{column:a,title:n("plan.columns.stats")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-2",children:[e.jsx(ht,{}),e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:a.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"group",header:({column:a})=>e.jsx(z,{column:a,title:n("plan.columns.group")}),cell:({row:a})=>e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center gap-1.5 text-nowrap",children:e.jsx(K,{variant:"secondary",className:N("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.getValue("group")?.name})}),enableSorting:!1,enableHiding:!1},{accessorKey:"prices",header:({column:a})=>e.jsx(z,{column:a,title:n("plan.columns.price")}),cell:({row:a})=>{const l=a.getValue("prices"),r=[{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:r.map(({period:c,key:i,unit:m})=>l[i]!=null&&e.jsxs(K,{variant:"secondary",className:N("px-2 py-0.5 font-medium transition-colors text-nowrap",an[i].color,an[i].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[c," ¥",l[i],m]},i))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:a})=>e.jsx(z,{className:"justify-end",column:a,title:n("plan.columns.actions")}),cell:({row:a})=>{const{setIsOpen:l,setEditingPlan:r}=Ra();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{r(a.original),l(!0)},children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.edit")})]}),e.jsx(qe,{title:n("plan.columns.delete_confirm.title"),description:n("plan.columns.delete_confirm.description"),confirmText:n("plan.columns.delete"),variant:"destructive",onConfirm:async()=>{jd({id:a.original.id}).then(({data:c})=>{c&&(A.success(n("plan.columns.delete_confirm.success")),s())})},children:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ts,{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")})]})})]})}}]},gx=h.object({id:h.number().nullable(),group_id:h.union([h.number(),h.string()]).nullable().optional(),name:h.string().min(1).max(250),content:h.string().nullable().optional(),transfer_enable:h.union([h.number().min(0),h.string().min(1)]),prices:h.object({monthly:h.union([h.number(),h.string()]).nullable().optional(),quarterly:h.union([h.number(),h.string()]).nullable().optional(),half_yearly:h.union([h.number(),h.string()]).nullable().optional(),yearly:h.union([h.number(),h.string()]).nullable().optional(),two_yearly:h.union([h.number(),h.string()]).nullable().optional(),three_yearly:h.union([h.number(),h.string()]).nullable().optional(),onetime:h.union([h.number(),h.string()]).nullable().optional(),reset_traffic:h.union([h.number(),h.string()]).nullable().optional()}).default({}),speed_limit:h.union([h.number(),h.string()]).nullable().optional(),capacity_limit:h.union([h.number(),h.string()]).nullable().optional(),device_limit:h.union([h.number(),h.string()]).nullable().optional(),force_update:h.boolean().optional(),reset_traffic_method:h.number().nullable(),users_count:h.number().optional()}),Gr=u.forwardRef(({className:s,...n},a)=>e.jsx(ar,{ref:a,className:N("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(Ri,{className:N("flex items-center justify-center text-current"),children:e.jsx(zs,{className:"h-4 w-4"})})}));Gr.displayName=ar.displayName;const _t={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},wt={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}},jx=[{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 vx(){const{isOpen:s,setIsOpen:n,editingPlan:a,setEditingPlan:l,refreshData:r}=Ra(),[c,i]=u.useState(!1),{t:m}=F("subscribe"),x=he({resolver:ge(gx),defaultValues:{..._t,...a||{}},mode:"onChange"});u.useEffect(()=>{a?x.reset({..._t,...a}):x.reset(_t)},[a,x]);const o=new pa({html:!0}),[d,p]=u.useState();async function k(){qt().then(({data:j})=>{p(j)})}u.useEffect(()=>{s&&k()},[s]);const I=j=>{if(isNaN(j))return;const C=Object.entries(wt).reduce((g,[w,T])=>{const S=j*T.months*T.discount;return{...g,[w]:S.toFixed(2)}},{});x.setValue("prices",C,{shouldDirty:!0})},f=()=>{n(!1),l(null),x.reset(_t)};return e.jsx(ve,{open:s,onOpenChange:f,children:e.jsxs(pe,{children:[e.jsxs(Ne,{children:[e.jsx(be,{children:m(a?"plan.form.edit_title":"plan.form.add_title")}),e.jsx(Ee,{})]}),e.jsxs(je,{...x,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:x.control,name:"name",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:m("plan.form.name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:m("plan.form.name.placeholder"),...j})}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"group_id",render:({field:j})=>e.jsxs(v,{children:[e.jsxs(y,{className:"flex items-center justify-between",children:[m("plan.form.group.label"),e.jsx(Kt,{dialogTrigger:e.jsx(R,{variant:"link",children:m("plan.form.group.add")}),refetch:k})]}),e.jsxs(J,{value:j.value?.toString()??"",onValueChange:C=>j.onChange(C?Number(C):null),children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Z,{placeholder:m("plan.form.group.placeholder")})})}),e.jsx(Y,{children:d?.map(C=>e.jsx(q,{value:C.id.toString(),children:C.name},C.id))})]}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"transfer_enable",render:({field:j})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:m("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:m("plan.form.transfer.placeholder"),className:"rounded-r-none",...j})}),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:m("plan.form.transfer.unit")})]}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"speed_limit",render:({field:j})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:m("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:m("plan.form.speed.placeholder"),className:"rounded-r-none",...j,value:j.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:m("plan.form.speed.unit")})]}),e.jsx(E,{})]})}),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:m("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:m("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:j=>{const C=parseFloat(j.target.value);I(C)}})]}),e.jsx(xe,{children:e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(R,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const j=Object.keys(wt).reduce((C,g)=>({...C,[g]:""}),{});x.setValue("prices",j,{shouldDirty:!0})},children:m("plan.form.price.clear.button")})}),e.jsx(oe,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:m("plan.form.price.clear.tooltip")})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(wt).filter(([j])=>!["onetime","reset_traffic"].includes(j)).map(([j,C])=>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(b,{control:x.control,name:`prices.${j}`,render:({field:g})=>e.jsxs(v,{children:[e.jsxs(y,{className:"text-xs font-medium text-muted-foreground",children:[m(`plan.columns.price_period.${j}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",C.months===1?m("plan.form.price.period.monthly"):m("plan.form.price.period.months",{count:C.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(_,{children:e.jsx(D,{type:"number",placeholder:"0.00",min:0,...g,value:g.value??"",onChange:w=>g.onChange(w.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"})})]})]})})},j))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(wt).filter(([j])=>["onetime","reset_traffic"].includes(j)).map(([j,C])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(b,{control:x.control,name:`prices.${j}`,render:({field:g})=>e.jsx(v,{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(y,{className:"text-xs font-medium",children:m(`plan.columns.price_period.${j}`)}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:m(j==="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(_,{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"})})]})]})})})},j))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(b,{control:x.control,name:"device_limit",render:({field:j})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:m("plan.form.device.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:m("plan.form.device.placeholder"),className:"rounded-r-none",...j,value:j.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:m("plan.form.device.unit")})]}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"capacity_limit",render:({field:j})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:m("plan.form.capacity.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:m("plan.form.capacity.placeholder"),className:"rounded-r-none",...j,value:j.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:m("plan.form.capacity.unit")})]}),e.jsx(E,{})]})})]}),e.jsx(b,{control:x.control,name:"reset_traffic_method",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:m("plan.form.reset_method.label")}),e.jsxs(J,{value:j.value?.toString()??"null",onValueChange:C=>j.onChange(C=="null"?null:Number(C)),children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Z,{placeholder:m("plan.form.reset_method.placeholder")})})}),e.jsx(Y,{children:jx.map(C=>e.jsx(q,{value:C.value?.toString()??"null",children:m(`plan.form.reset_method.options.${C.label}`)},C.value))})]}),e.jsx(M,{className:"text-xs",children:m("plan.form.reset_method.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"content",render:({field:j})=>{const[C,g]=u.useState(!1);return e.jsxs(v,{className:"space-y-2",children:[e.jsxs(y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[m("plan.form.content.label"),e.jsx(xe,{children:e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>g(!C),children:C?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(oe,{side:"top",children:e.jsx("p",{className:"text-xs",children:m(C?"plan.form.content.preview_button.hide":"plan.form.content.preview_button.show")})})]})})]}),e.jsx(xe,{children:e.jsxs(me,{children:[e.jsx(ue,{asChild:!0,children:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>{j.onChange(m("plan.form.content.template.content"))},children:m("plan.form.content.template.button")})}),e.jsx(oe,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:m("plan.form.content.template.tooltip")})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${C?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"}`,children:[e.jsx("div",{className:"space-y-2",children:e.jsx(_,{children:e.jsx(ga,{style:{height:"400px"},value:j.value||"",renderHTML:w=>o.render(w),onChange:({text:w})=>j.onChange(w),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:m("plan.form.content.placeholder"),className:"rounded-md border"})})}),C&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:m("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(j.value||"")}})})]})]}),e.jsx(M,{className:"text-xs",children:m("plan.form.content.description")}),e.jsx(E,{})]})}})]}),e.jsx(Ke,{className:"mt-6",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("div",{className:"flex-shrink-0",children:a&&e.jsx(b,{control:x.control,name:"force_update",render:({field:j})=>e.jsxs(v,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(_,{children:e.jsx(Gr,{checked:j.value,onCheckedChange:j.onChange})}),e.jsx("div",{className:"",children:e.jsx(y,{className:"text-sm",children:m("plan.form.force_update.label")})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(R,{type:"button",variant:"outline",onClick:f,children:m("plan.form.submit.cancel")}),e.jsx(R,{type:"submit",disabled:c,onClick:()=>{x.handleSubmit(async j=>{i(!0),(await gd(j)).data&&(A.success(m(a?"plan.form.submit.success.update":"plan.form.submit.success.add")),f(),r()),i(!1)})()},children:m(c?"plan.form.submit.submitting":"plan.form.submit.submit")})]})]})})]})]})})}function bx(){const[s,n]=u.useState({}),[a,l]=u.useState({"drag-handle":!1}),[r,c]=u.useState([]),[i,m]=u.useState([]),[x,o]=u.useState(!1),[d,p]=u.useState({pageSize:20,pageIndex:0}),[k,I]=u.useState([]),{refetch:f}=ne({queryKey:["planList"],queryFn:async()=>{const{data:T}=await Hs();return I(T),T}});u.useEffect(()=>{l({"drag-handle":x}),p({pageSize:x?99999:10,pageIndex:0})},[x]);const j=(T,S)=>{x&&(T.dataTransfer.setData("text/plain",S.toString()),T.currentTarget.classList.add("opacity-50"))},C=(T,S)=>{if(!x)return;T.preventDefault(),T.currentTarget.classList.remove("bg-muted");const P=parseInt(T.dataTransfer.getData("text/plain"));if(P===S)return;const L=[...k],[G]=L.splice(P,1);L.splice(S,0,G),I(L)},g=async()=>{if(!x){o(!0);return}const T=k?.map(S=>S.id);vd(T).then(()=>{A.success("排序保存成功"),o(!1),f()}).finally(()=>{o(!1)})},w=Ye({data:k||[],columns:px(f),state:{sorting:i,columnVisibility:a,rowSelection:s,columnFilters:r,pagination:d},enableRowSelection:!0,onPaginationChange:p,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),getSortedRowModel:rs(),getFacetedRowModel:vs(),getFacetedUniqueValues:bs(),initialState:{columnPinning:{right:["actions"]}},pageCount:x?1:void 0});return e.jsx(hx,{refreshData:f,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(os,{table:w,toolbar:T=>e.jsx(fx,{table:T,refetch:f,saveOrder:g,isSortMode:x}),draggable:x,onDragStart:j,onDragEnd:T=>T.currentTarget.classList.remove("opacity-50"),onDragOver:T=>{T.preventDefault(),T.currentTarget.classList.add("bg-muted")},onDragLeave:T=>T.currentTarget.classList.remove("bg-muted"),onDrop:C,showPagination:!x}),e.jsx(vx,{})]})})}function yx(){const{t:s}=F("subscribe");return e.jsxs(ke,{children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(bx,{})})]})]})}const Nx=Object.freeze(Object.defineProperty({__proto__:null,default:yx},Symbol.toStringTag,{value:"Module"})),Gs=[{value:se.PENDING,label:nt[se.PENDING],icon:Ii,color:rt[se.PENDING]},{value:se.PROCESSING,label:nt[se.PROCESSING],icon:nr,color:rt[se.PROCESSING]},{value:se.COMPLETED,label:nt[se.COMPLETED],icon:na,color:rt[se.COMPLETED]},{value:se.CANCELLED,label:nt[se.CANCELLED],icon:rr,color:rt[se.CANCELLED]},{value:se.DISCOUNTED,label:nt[se.DISCOUNTED],icon:na,color:rt[se.DISCOUNTED]}],ot=[{value:de.PENDING,label:vt[de.PENDING],icon:Vi,color:bt[de.PENDING]},{value:de.PROCESSING,label:vt[de.PROCESSING],icon:nr,color:bt[de.PROCESSING]},{value:de.VALID,label:vt[de.VALID],icon:na,color:bt[de.VALID]},{value:de.INVALID,label:vt[de.INVALID],icon:rr,color:bt[de.INVALID]}];function Ct({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=s?.getFilterValue(),c=Array.isArray(r)?new Set(r):r!==void 0?new Set([r]):new Set;return e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsxs(R,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(pt,{className:"mr-2 h-4 w-4"}),n,c?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(we,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:c.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:c.size>2?e.jsxs(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[c.size," selected"]}):a.filter(i=>c.has(i.value)).map(i=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),e.jsx(ls,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Rs,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Is,{children:[e.jsx(qs,{children:"No results found."}),e.jsx($e,{children:a.map(i=>{const m=c.has(i.value);return e.jsxs(De,{onSelect:()=>{const x=new Set(c);m?x.delete(i.value):x.add(i.value);const o=Array.from(x);s?.setFilterValue(o.length?o:void 0)},children:[e.jsx("div",{className:N("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",m?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(zs,{className:N("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}),l?.get(i.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(i.value)})]},i.value)})}),c.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(et,{}),e.jsx($e,{children:e.jsx(De,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const _x=h.object({email:h.string().min(1),plan_id:h.number(),period:h.string(),total_amount:h.number()}),wx={email:"",plan_id:0,total_amount:0,period:""};function Wr({refetch:s,trigger:n,defaultValues:a}){const{t:l}=F("order"),[r,c]=u.useState(!1),i=he({resolver:ge(_x),defaultValues:{...wx,...a},mode:"onChange"}),[m,x]=u.useState([]);return u.useEffect(()=>{r&&Hs().then(({data:o})=>{x(o)})},[r]),e.jsxs(ve,{open:r,onOpenChange:c,children:[e.jsx(He,{asChild:!0,children:n||e.jsxs(R,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Pe,{icon:"ion:add"}),e.jsx("div",{children:l("dialog.addOrder")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:l("dialog.assignOrder")}),e.jsx(Ee,{})]}),e.jsxs(je,{...i,children:[e.jsx(b,{control:i.control,name:"email",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dialog.fields.userEmail")}),e.jsx(_,{children:e.jsx(D,{placeholder:l("dialog.placeholders.email"),...o})})]})}),e.jsx(b,{control:i.control,name:"plan_id",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dialog.fields.subscriptionPlan")}),e.jsx(_,{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(Z,{placeholder:l("dialog.placeholders.plan")})}),e.jsx(Y,{children:m.map(d=>e.jsx(q,{value:d.id.toString(),children:d.name},d.id))})]})})]})}),e.jsx(b,{control:i.control,name:"period",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dialog.fields.orderPeriod")}),e.jsx(_,{children:e.jsxs(J,{value:o.value,onValueChange:o.onChange,children:[e.jsx(W,{children:e.jsx(Z,{placeholder:l("dialog.placeholders.period")})}),e.jsx(Y,{children:Object.keys(Wd).map(d=>e.jsx(q,{value:d,children:l(`period.${d}`)},d))})]})})]})}),e.jsx(b,{control:i.control,name:"total_amount",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dialog.fields.paymentAmount")}),e.jsx(_,{children:e.jsx(D,{type:"number",placeholder:l("dialog.placeholders.amount"),value:o.value/100,onChange:d=>o.onChange(parseFloat(d.currentTarget.value)*100)})}),e.jsx(E,{})]})}),e.jsxs(Ke,{children:[e.jsx(R,{variant:"outline",onClick:()=>c(!1),children:l("dialog.actions.cancel")}),e.jsx(R,{type:"submit",onClick:()=>{i.handleSubmit(o=>{wd(o).then(({data:d})=>{d&&(s&&s(),i.reset(),c(!1),A.success(l("dialog.messages.addSuccess")))})})()},children:l("dialog.actions.confirm")})]})]})]})]})}function Cx({table:s,refetch:n}){const{t:a}=F("order"),l=s.getState().columnFilters.length>0,r=Object.values(ss).filter(x=>typeof x=="number").map(x=>({label:a(`type.${ss[x]}`),value:x,color:x===ss.NEW?"green-500":x===ss.RENEWAL?"blue-500":x===ss.UPGRADE?"purple-500":"orange-500"})),c=Object.values(Se).map(x=>({label:a(`period.${x}`),value:x,color:x===Se.MONTH_PRICE?"slate-500":x===Se.QUARTER_PRICE?"cyan-500":x===Se.HALF_YEAR_PRICE?"indigo-500":x===Se.YEAR_PRICE?"violet-500":x===Se.TWO_YEAR_PRICE?"fuchsia-500":x===Se.THREE_YEAR_PRICE?"pink-500":x===Se.ONETIME_PRICE?"rose-500":"orange-500"})),i=Object.values(se).filter(x=>typeof x=="number").map(x=>({label:a(`status.${se[x]}`),value:x,icon:x===se.PENDING?Gs[0].icon:x===se.PROCESSING?Gs[1].icon:x===se.COMPLETED?Gs[2].icon:x===se.CANCELLED?Gs[3].icon:Gs[4].icon,color:x===se.PENDING?"yellow-500":x===se.PROCESSING?"blue-500":x===se.COMPLETED?"green-500":x===se.CANCELLED?"red-500":"green-500"})),m=Object.values(de).filter(x=>typeof x=="number").map(x=>({label:a(`commission.${de[x]}`),value:x,icon:x===de.PENDING?ot[0].icon:x===de.PROCESSING?ot[1].icon:x===de.VALID?ot[2].icon:ot[3].icon,color:x===de.PENDING?"yellow-500":x===de.PROCESSING?"blue-500":x===de.VALID?"green-500":"red-500"}));return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wr,{refetch:n}),e.jsx(D,{placeholder:a("search.placeholder"),value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:x=>s.getColumn("trade_no")?.setFilterValue(x.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(Ct,{column:s.getColumn("type"),title:a("table.columns.type"),options:r}),s.getColumn("period")&&e.jsx(Ct,{column:s.getColumn("period"),title:a("table.columns.period"),options:c}),s.getColumn("status")&&e.jsx(Ct,{column:s.getColumn("status"),title:a("table.columns.status"),options:i}),s.getColumn("commission_status")&&e.jsx(Ct,{column:s.getColumn("commission_status"),title:a("table.columns.commissionStatus"),options:m})]}),l&&e.jsxs(R,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[a("actions.reset"),e.jsx(Be,{className:"ml-2 h-4 w-4"})]})]})}function Ze({label:s,value:n,className:a,valueClassName:l}){return e.jsxs("div",{className:N("flex items-center py-1.5",a),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:N("text-sm",l),children:n||"-"})]})}function Sx({status:s}){const{t:n}=F("order"),a={[se.PENDING]:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",[se.PROCESSING]:"bg-blue-100 text-blue-800 hover:bg-blue-100",[se.CANCELLED]:"bg-red-100 text-red-800 hover:bg-red-100",[se.COMPLETED]:"bg-green-100 text-green-800 hover:bg-green-100",[se.DISCOUNTED]:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(K,{variant:"secondary",className:N("font-medium",a[s]),children:n(`status.${se[s]}`)})}function kx({id:s,trigger:n}){const[a,l]=u.useState(!1),[r,c]=u.useState(),{t:i}=F("order");return u.useEffect(()=>{(async()=>{if(a){const{data:x}=await yd({id:s});c(x)}})()},[a,s]),e.jsxs(ve,{onOpenChange:l,open:a,children:[e.jsx(He,{asChild:!0,children:n}),e.jsxs(pe,{className:"max-w-xl",children:[e.jsxs(Ne,{className:"space-y-2",children:[e.jsx(be,{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"),":",r?.trade_no]}),r?.status&&e.jsx(Sx,{status:r.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(Ze,{label:i("dialog.fields.userEmail"),value:r?.user?.email?e.jsxs(Ls,{to:`/user/manage?email=${r.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[r.user.email,e.jsx(lr,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(Ze,{label:i("dialog.fields.orderPeriod"),value:r&&i(`period.${r.period}`)}),e.jsx(Ze,{label:i("dialog.fields.subscriptionPlan"),value:r?.plan?.name,valueClassName:"font-medium"}),e.jsx(Ze,{label:i("dialog.fields.callbackNo"),value:r?.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(Ze,{label:i("dialog.fields.paymentAmount"),value:Fs(r?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(we,{className:"my-2"}),e.jsx(Ze,{label:i("dialog.fields.balancePayment"),value:Fs(r?.balance_amount||0)}),e.jsx(Ze,{label:i("dialog.fields.discountAmount"),value:Fs(r?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(Ze,{label:i("dialog.fields.refundAmount"),value:Fs(r?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(Ze,{label:i("dialog.fields.deductionAmount"),value:Fs(r?.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(Ze,{label:i("dialog.fields.createdAt"),value:fe(r?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(Ze,{label:i("dialog.fields.updatedAt"),value:fe(r?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const Tx={[ss.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ss.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ss.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ss.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Px={[Se.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Se.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Se.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Se.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Se.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Se.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Se.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Se.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Dx=s=>se[s],Ex=s=>de[s],Rx=s=>ss[s],Ix=s=>{const{t:n}=F("order");return[{accessorKey:"trade_no",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.tradeNo")}),cell:({row:a})=>{const l=a.original.trade_no,r=l.length>6?`${l.slice(0,3)}...${l.slice(-3)}`:l;return e.jsx("div",{className:"flex items-center",children:e.jsx(kx,{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:r}),e.jsx(lr,{className:"h-3.5 w-3.5 opacity-70"})]}),id:a.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.type")}),cell:({row:a})=>{const l=a.getValue("type"),r=Tx[l];return e.jsx(K,{variant:"secondary",className:N("font-medium transition-colors text-nowrap",r.color,r.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:n(`type.${Rx(l)}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.plan")}),cell:({row:a})=>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:a.original.plan?.name||"-"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"period",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.period")}),cell:({row:a})=>{const l=a.getValue("period"),r=Px[l];return e.jsx(K,{variant:"secondary",className:N("font-medium transition-colors text-nowrap",r.color,r.bgColor,"hover:bg-opacity-80"),children:n(`period.${l}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.amount")}),cell:({row:a})=>{const l=a.getValue("total_amount"),r=typeof l=="number"?(l/100).toFixed(2):"N/A";return e.jsxs("div",{className:"flex items-center font-mono text-foreground/90",children:["¥",r]})},enableSorting:!0,enableHiding:!1},{accessorKey:"status",header:({column:a})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(z,{column:a,title:n("table.columns.status")}),e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{children:e.jsx(Lr,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(oe,{side:"top",className:"max-w-[200px] text-sm",children:n("status.tooltip")})]})})]}),cell:({row:a})=>{const l=Gs.find(r=>r.value===a.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:n(`status.${Dx(l.value)}`)})]}),l.value===se.PENDING&&e.jsxs(Ds,{modal:!0,children:[e.jsx(Es,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Dt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(gs,{align:"end",className:"w-[140px]",children:[e.jsx(ye,{className:"cursor-pointer",onClick:async()=>{await Nd({trade_no:a.original.trade_no}),s()},children:n("actions.markAsPaid")}),e.jsx(ye,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await _d({trade_no:a.original.trade_no}),s()},children:n("actions.cancel")})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.commission")}),cell:({row:a})=>{const l=a.getValue("commission_balance"),r=l?(l/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:l?`¥${r}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.commissionStatus")}),cell:({row:a})=>{const l=a.original.status,r=a.original.commission_balance,c=ot.find(i=>i.value===a.getValue("commission_status"));return r==0||!c?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:[c.icon&&e.jsx(c.icon,{className:`h-4 w-4 text-${c.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n(`commission.${Ex(c.value)}`)})]}),c.value===de.PENDING&&l===se.COMPLETED&&e.jsxs(Ds,{modal:!0,children:[e.jsx(Es,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Dt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(gs,{align:"end",className:"w-[120px]",children:[e.jsx(ye,{className:"cursor-pointer",onClick:async()=>{await Ya({trade_no:a.original.trade_no,commission_status:de.PROCESSING}),s()},children:n("commission.PROCESSING")}),e.jsx(ye,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ya({trade_no:a.original.trade_no,commission_status:de.INVALID}),s()},children:n("commission.INVALID")})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.createdAt")}),cell:({row:a})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:fe(a.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}]};function Vx(){const[s]=or(),[n,a]=u.useState({}),[l,r]=u.useState({}),[c,i]=u.useState([]),[m,x]=u.useState([]),[o,d]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const C=Object.entries({user_id:"string",order_id:"string",commission_status:"number",status:"number",commission_balance:"string"}).map(([g,w])=>{const T=s.get(g);return T?{id:g,value:w==="number"?parseInt(T):T}:null}).filter(Boolean);C.length>0&&i(C)},[s]);const{refetch:p,data:k,isLoading:I}=ne({queryKey:["orderList",o,c,m],queryFn:()=>bd({pageSize:o.pageSize,current:o.pageIndex+1,filter:c,sort:m})}),f=Ye({data:k?.data??[],columns:Ix(p),state:{sorting:m,columnVisibility:l,rowSelection:n,columnFilters:c,pagination:o},rowCount:k?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:x,onColumnFiltersChange:i,onColumnVisibilityChange:r,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),onPaginationChange:d,getSortedRowModel:rs(),getFacetedRowModel:vs(),getFacetedUniqueValues:bs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(os,{table:f,toolbar:e.jsx(Cx,{table:f,refetch:p}),showPagination:!0})}function Fx(){const{t:s}=F("order");return e.jsxs(ke,{children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(Vx,{})})]})]})}const Mx=Object.freeze(Object.defineProperty({__proto__:null,default:Fx},Symbol.toStringTag,{value:"Module"}));function Ox({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsxs(R,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(pt,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(we,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{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(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(c=>r.has(c.value)).map(c=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(ls,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Rs,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Is,{children:[e.jsx(qs,{children:"No results found."}),e.jsx($e,{children:a.map(c=>{const i=r.has(c.value);return e.jsxs(De,{onSelect:()=>{i?r.delete(c.value):r.add(c.value);const m=Array.from(r);s?.setFilterValue(m.length?m:void 0)},children:[e.jsx("div",{className:N("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(zs,{className:N("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${c.color}`}),e.jsx("span",{children:c.label}),l?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(c.value)})]},c.value)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(et,{}),e.jsx($e,{children:e.jsx(De,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const zx=h.object({id:h.coerce.number().nullable().optional(),name:h.string().min(1,"请输入优惠券名称"),code:h.string().nullable(),type:h.coerce.number(),value:h.coerce.number(),started_at:h.coerce.number(),ended_at:h.coerce.number(),limit_use:h.union([h.string(),h.number()]).nullable(),limit_use_with_user:h.union([h.string(),h.number()]).nullable(),generate_count:h.coerce.number().nullable().optional(),limit_plan_ids:h.array(h.coerce.number()).default([]).nullable(),limit_period:h.array(h.nativeEnum(ct)).default([]).nullable()}).refine(s=>s.ended_at>s.started_at,{message:"结束时间必须晚于开始时间",path:["ended_at"]}),nn={name:"",code:"",type:Le.AMOUNT,value:0,started_at:Math.floor(Date.now()/1e3),ended_at:Math.floor(Date.now()/1e3)+7*24*60*60,limit_use:"",limit_use_with_user:"",limit_plan_ids:[],limit_period:[],generate_count:""};function Yr({defaultValues:s,refetch:n,type:a="create",dialogTrigger:l=null,open:r,onOpenChange:c}){const{t:i}=F("coupon"),[m,x]=u.useState(!1),o=r??m,d=c??x,[p,k]=u.useState([]),I=he({resolver:ge(zx),defaultValues:s||nn});u.useEffect(()=>{s&&I.reset(s)},[s,I]),u.useEffect(()=>{Hs().then(({data:g})=>k(g))},[]);const f=g=>{if(!g)return;const w=(T,S)=>{const P=new Date(S*1e3);return T.setHours(P.getHours(),P.getMinutes(),P.getSeconds()),Math.floor(T.getTime()/1e3)};g.from&&I.setValue("started_at",w(g.from,I.watch("started_at"))),g.to&&I.setValue("ended_at",w(g.to,I.watch("ended_at")))},j=async g=>{Sd(g).then(()=>{d(!1),a==="create"&&I.reset(nn),n()})},C=(g,w)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:w}),e.jsx(D,{type:"datetime-local",step:"1",value:fe(I.watch(g),"YYYY-MM-DDTHH:mm:ss"),onChange:T=>{const S=new Date(T.target.value);I.setValue(g,Math.floor(S.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(ve,{open:o,onOpenChange:d,children:[l&&e.jsx(He,{asChild:!0,children:l}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsx(Ne,{children:e.jsx(be,{children:i(a==="create"?"form.add":"form.edit")})}),e.jsx(je,{...I,children:e.jsxs("form",{onSubmit:I.handleSubmit(j),className:"space-y-4",children:[e.jsx(b,{control:I.control,name:"name",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.name.label")}),e.jsx(D,{placeholder:i("form.name.placeholder"),...g}),e.jsx(E,{})]})}),e.jsx(b,{control:I.control,name:"code",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.code.label")}),e.jsx(D,{placeholder:i("form.code.placeholder"),...g,className:"h-9"}),e.jsx(M,{className:"text-xs",children:i("form.code.description")}),e.jsx(E,{})]})}),e.jsxs(v,{children:[e.jsx(y,{children:i("form.type.label")}),e.jsxs("div",{className:"flex",children:[e.jsx(b,{control:I.control,name:"type",render:({field:g})=>e.jsxs(J,{value:g.value.toString(),onValueChange:w=>{const T=g.value,S=parseInt(w);g.onChange(S);const P=I.getValues("value");P&&(T===Le.AMOUNT&&S===Le.PERCENT?I.setValue("value",P/100):T===Le.PERCENT&&S===Le.AMOUNT&&I.setValue("value",P*100))},children:[e.jsx(W,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(Z,{placeholder:i("form.type.placeholder")})}),e.jsx(Y,{children:Object.entries(Yd).map(([w,T])=>e.jsx(q,{value:w,children:i(`table.toolbar.types.${w}`)},w))})]})}),e.jsx(b,{control:I.control,name:"value",render:({field:g})=>{const w=g.value===""?"":I.watch("type")===Le.AMOUNT&&typeof g.value=="number"?(g.value/100).toString():g.value.toString();return e.jsx(D,{type:"number",placeholder:i("form.value.placeholder"),...g,value:w,onChange:T=>{const S=T.target.value;if(S===""){g.onChange("");return}const P=parseFloat(S);isNaN(P)||g.onChange(I.watch("type")===Le.AMOUNT?Math.round(P*100):P)},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:I.watch("type")==Le.AMOUNT?"¥":"%"})})]})]}),e.jsxs(v,{children:[e.jsx(y,{children:i("form.validity.label")}),e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsxs(R,{variant:"outline",className:N("w-full justify-start text-left font-normal",!I.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(ft,{className:"mr-2 h-4 w-4"}),fe(I.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ",i("form.validity.to")," ",fe(I.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(ls,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(Ks,{mode:"range",selected:{from:new Date(I.watch("started_at")*1e3),to:new Date(I.watch("ended_at")*1e3)},onSelect:f,numberOfMonths:2})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[C("started_at",i("table.validity.startTime")),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:i("form.validity.to")}),C("ended_at",i("table.validity.endTime"))]})})]})]}),e.jsx(E,{})]}),e.jsx(b,{control:I.control,name:"limit_use",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.limitUse.label")}),e.jsx(D,{type:"number",min:0,placeholder:i("form.limitUse.placeholder"),...g,value:g.value===void 0?"":g.value,onChange:w=>g.onChange(w.target.value===""?"":w.target.value),className:"h-9"}),e.jsx(M,{className:"text-xs",children:i("form.limitUse.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:I.control,name:"limit_use_with_user",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.limitUseWithUser.label")}),e.jsx(D,{type:"number",min:0,placeholder:i("form.limitUseWithUser.placeholder"),...g,value:g.value===void 0?"":g.value,onChange:w=>g.onChange(w.target.value===""?"":w.target.value),className:"h-9"}),e.jsx(M,{className:"text-xs",children:i("form.limitUseWithUser.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:I.control,name:"limit_period",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.limitPeriod.label")}),e.jsx(xt,{options:Object.entries(ct).filter(([w])=>isNaN(Number(w))).map(([w,T])=>({label:i(`coupon:period.${T}`),value:w})),onChange:w=>{if(w.length===0){g.onChange([]);return}const T=w.map(S=>ct[S.value]);g.onChange(T)},value:(g.value||[]).map(w=>({label:i(`coupon:period.${w}`),value:Object.entries(ct).find(([T,S])=>S===w)?.[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(M,{className:"text-xs",children:i("form.limitPeriod.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:I.control,name:"limit_plan_ids",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.limitPlan.label")}),e.jsx(xt,{options:p?.map(w=>({label:w.name,value:w.id.toString()}))||[],onChange:w=>g.onChange(w.map(T=>Number(T.value))),value:(p||[]).filter(w=>(g.value||[]).includes(w.id)).map(w=>({label:w.name,value:w.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(E,{})]})}),a==="create"&&e.jsx(e.Fragment,{children:e.jsx(b,{control:I.control,name:"generate_count",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.generateCount.label")}),e.jsx(D,{type:"number",min:0,placeholder:i("form.generateCount.placeholder"),...g,value:g.value===void 0?"":g.value,onChange:w=>g.onChange(w.target.value===""?"":w.target.value),className:"h-9"}),e.jsx(M,{className:"text-xs",children:i("form.generateCount.description")}),e.jsx(E,{})]})})}),e.jsx(Ke,{children:e.jsx(R,{type:"submit",disabled:I.formState.isSubmitting,children:I.formState.isSubmitting?i("form.submit.saving"):i("form.submit.save")})})]})})]})]})}function Lx({table:s,refetch:n}){const a=s.getState().columnFilters.length>0,{t:l}=F("coupon");return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Yr,{refetch:n,dialogTrigger:e.jsxs(R,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Pe,{icon:"ion:add"}),e.jsx("div",{children:l("form.add")})]})}),e.jsx(D,{placeholder:l("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:r=>s.getColumn("name")?.setFilterValue(r.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(Ox,{column:s.getColumn("type"),title:l("table.toolbar.type"),options:[{value:Le.AMOUNT,label:l(`table.toolbar.types.${Le.AMOUNT}`)},{value:Le.PERCENTAGE,label:l(`table.toolbar.types.${Le.PERCENTAGE}`)}]}),a&&e.jsxs(R,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("table.toolbar.reset"),e.jsx(Be,{className:"ml-2 h-4 w-4"})]})]})}const Qr=u.createContext(void 0);function Ax({children:s,refetch:n}){const[a,l]=u.useState(!1),[r,c]=u.useState(null),i=x=>{c(x),l(!0)},m=()=>{l(!1),c(null)};return e.jsxs(Qr.Provider,{value:{isOpen:a,currentCoupon:r,openEdit:i,closeEdit:m},children:[s,r&&e.jsx(Yr,{defaultValues:r,refetch:n,type:"edit",open:a,onOpenChange:l})]})}function $x(){const s=u.useContext(Qr);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const qx=s=>{const{t:n}=F("coupon");return[{accessorKey:"id",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.id")}),cell:({row:a})=>e.jsx(K,{children:a.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.show")}),cell:({row:a})=>e.jsx(U,{defaultChecked:a.original.show,onCheckedChange:l=>{Td({id:a.original.id,show:l}).then(({data:r})=>!r&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.name")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:a.original.name})}),enableSorting:!1,size:800},{accessorKey:"type",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.type")}),cell:({row:a})=>e.jsx(K,{variant:"outline",children:n(`table.toolbar.types.${a.original.type}`)}),enableSorting:!0},{accessorKey:"code",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.code")}),cell:({row:a})=>e.jsx(K,{variant:"secondary",children:a.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.limitUse")}),cell:({row:a})=>e.jsx(K,{variant:"outline",children:a.original.limit_use===null?n("table.validity.unlimited"):a.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.limitUseWithUser")}),cell:({row:a})=>e.jsx(K,{variant:"outline",children:a.original.limit_use_with_user===null?n("table.validity.noLimit"):a.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:a})=>e.jsx(z,{column:a,title:n("table.columns.validity")}),cell:({row:a})=>{const[l,r]=u.useState(!1),c=Date.now(),i=a.original.started_at*1e3,m=a.original.ended_at*1e3,x=c>m,o=ce.jsx(z,{className:"justify-end",column:a,title:n("table.columns.actions")}),cell:({row:a})=>{const{openEdit:l}=$x();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>l(a.original),children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),e.jsx(qe,{title:n("table.actions.deleteConfirm.title"),description:n("table.actions.deleteConfirm.description"),confirmText:n("table.actions.deleteConfirm.confirmText"),variant:"destructive",onConfirm:async()=>{kd({id:a.original.id}).then(({data:r})=>{r&&(A.success("删除成功"),s())})},children:e.jsxs(R,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ts,{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 Hx(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,c]=u.useState([]),[i,m]=u.useState([]),[x,o]=u.useState({pageIndex:0,pageSize:20}),{refetch:d,data:p}=ne({queryKey:["couponList",x,r,i],queryFn:()=>Cd({pageSize:x.pageSize,current:x.pageIndex+1,filter:r,sort:i})}),k=Ye({data:p?.data??[],columns:qx(d),state:{sorting:i,columnVisibility:a,rowSelection:s,columnFilters:r,pagination:x},pageCount:Math.ceil((p?.total??0)/x.pageSize),rowCount:p?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,onPaginationChange:o,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),getSortedRowModel:rs(),getFacetedRowModel:vs(),getFacetedUniqueValues:bs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ax,{refetch:d,children:e.jsx("div",{className:"space-y-4",children:e.jsx(os,{table:k,toolbar:e.jsx(Lx,{table:k,refetch:d})})})})}function Kx(){const{t:s}=F("coupon");return e.jsxs(ke,{children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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(Hx,{})})]})]})}const Ux=Object.freeze(Object.defineProperty({__proto__:null,default:Kx},Symbol.toStringTag,{value:"Module"})),Bx=h.object({email_prefix:h.string().optional(),email_suffix:h.string().min(1),password:h.string().optional(),expired_at:h.number().optional().nullable(),plan_id:h.number().nullable(),generate_count:h.number().optional().nullable()}).refine(s=>s.generate_count===null?s.email_prefix!==void 0&&s.email_prefix!=="":!0,{message:"Email prefix is required when generate_count is null",path:["email_prefix"]}),Gx={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0};function Wx({refetch:s}){const{t:n}=F("user"),[a,l]=u.useState(!1),r=he({resolver:ge(Bx),defaultValues:Gx,mode:"onChange"}),[c,i]=u.useState([]);return u.useEffect(()=>{a&&Hs().then(({data:m})=>{m&&i(m)})},[a]),e.jsxs(ve,{open:a,onOpenChange:l,children:[e.jsx(He,{asChild:!0,children:e.jsxs(B,{size:"sm",variant:"outline",className:"space-x-2 gap-0",children:[e.jsx(Pe,{icon:"ion:add"}),e.jsx("div",{children:n("generate.button")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(Ne,{children:[e.jsx(be,{children:n("generate.title")}),e.jsx(Ee,{})]}),e.jsxs(je,{...r,children:[e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.email")}),e.jsxs("div",{className:"flex",children:[!r.watch("generate_count")&&e.jsx(b,{control:r.control,name:"email_prefix",render:({field:m})=>e.jsx(D,{className:"flex-[5] rounded-r-none",placeholder:n("generate.form.email_prefix"),...m})}),e.jsx("div",{className:`z-[-1] border border-r-0 border-input px-3 py-1 shadow-sm ${r.watch("generate_count")?"rounded-l-md":"border-l-0"}`,children:"@"}),e.jsx(b,{control:r.control,name:"email_suffix",render:({field:m})=>e.jsx(D,{className:"flex-[4] rounded-l-none",placeholder:n("generate.form.email_domain"),...m})})]})]}),e.jsx(b,{control:r.control,name:"password",render:({field:m})=>e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.password")}),e.jsx(D,{placeholder:n("generate.form.password_placeholder"),...m}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"expired_at",render:({field:m})=>e.jsxs(v,{className:"flex flex-col",children:[e.jsx(y,{children:n("generate.form.expire_time")}),e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsx(_,{children:e.jsxs(B,{variant:"outline",className:N("w-full pl-3 text-left font-normal",!m.value&&"text-muted-foreground"),children:[m.value?fe(m.value):e.jsx("span",{children:n("generate.form.expire_time_placeholder")}),e.jsx(ft,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(ls,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(Mi,{asChild:!0,children:e.jsx(B,{variant:"outline",className:"w-full",onClick:()=>{m.onChange(null)},children:n("generate.form.permanent")})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ks,{mode:"single",selected:m.value?new Date(m.value*1e3):void 0,onSelect:x=>{x&&m.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(b,{control:r.control,name:"plan_id",render:({field:m})=>e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.subscription")}),e.jsx(_,{children:e.jsxs(J,{value:m.value?m.value.toString():"null",onValueChange:x=>m.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:n("generate.form.subscription_none")})}),e.jsxs(Y,{children:[e.jsx(q,{value:"null",children:n("generate.form.subscription_none")}),c.map(x=>e.jsx(q,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!r.watch("email_prefix")&&e.jsx(b,{control:r.control,name:"generate_count",render:({field:m})=>e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.generate_count")}),e.jsx(D,{type:"number",placeholder:n("generate.form.generate_count_placeholder"),value:m.value||"",onChange:x=>m.onChange(x.target.value?parseInt(x.target.value):null)})]})})]}),e.jsxs(Ke,{children:[e.jsx(B,{variant:"outline",onClick:()=>l(!1),children:n("generate.form.cancel")}),e.jsx(B,{onClick:()=>r.handleSubmit(m=>{Rd(m).then(({data:x})=>{x&&(A.success(n("generate.form.success")),r.reset(),s(),l(!1))})})(),children:n("generate.form.submit")})]})]})]})}const Jr=cn,Zr=dn,Yx=mn,Xr=u.forwardRef(({className:s,...n},a)=>e.jsx(Vt,{className:N("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:a}));Xr.displayName=Vt.displayName;const Qx=Os("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"}}),Ia=u.forwardRef(({side:s="right",className:n,children:a,...l},r)=>e.jsxs(Yx,{children:[e.jsx(Xr,{}),e.jsxs(Ft,{ref:r,className:N(Qx({side:s}),n),...l,children:[e.jsxs(ma,{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(Be,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),a]})]}));Ia.displayName=Ft.displayName;const Va=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-2 text-center sm:text-left",s),...n});Va.displayName="SheetHeader";const el=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});el.displayName="SheetFooter";const Fa=u.forwardRef(({className:s,...n},a)=>e.jsx(Mt,{ref:a,className:N("text-lg font-semibold text-foreground",s),...n}));Fa.displayName=Mt.displayName;const Ma=u.forwardRef(({className:s,...n},a)=>e.jsx(Ot,{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Ma.displayName=Ot.displayName;function Jx({table:s,refetch:n,permissionGroups:a=[],subscriptionPlans:l=[]}){const{t:r}=F("user"),c=s.getState().columnFilters.length>0,[i,m]=u.useState([]),[x,o]=u.useState(!1),d=[{label:r("filter.fields.email"),value:"email",type:"text",operators:[{label:r("filter.operators.contains"),value:"contains"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.id"),value:"id",type:"number",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.plan_id"),value:"plan_id",type:"select",operators:[{label:r("filter.operators.eq"),value:"eq"}],useOptions:!0},{label:r("filter.fields.transfer_enable"),value:"transfer_enable",type:"number",unit:"GB",operators:[{label:r("filter.operators.gt"),value:"gt"},{label:r("filter.operators.lt"),value:"lt"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.total_used"),value:"total_used",type:"number",unit:"GB",operators:[{label:r("filter.operators.gt"),value:"gt"},{label:r("filter.operators.lt"),value:"lt"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.online_count"),value:"online_count",type:"number",operators:[{label:r("filter.operators.eq"),value:"eq"},{label:r("filter.operators.gt"),value:"gt"},{label:r("filter.operators.lt"),value:"lt"}]},{label:r("filter.fields.expired_at"),value:"expired_at",type:"date",operators:[{label:r("filter.operators.lt"),value:"lt"},{label:r("filter.operators.gt"),value:"gt"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.uuid"),value:"uuid",type:"text",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.token"),value:"token",type:"text",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.banned"),value:"banned",type:"select",operators:[{label:r("filter.operators.eq"),value:"eq"}],options:[{label:r("filter.status.normal"),value:"0"},{label:r("filter.status.banned"),value:"1"}]},{label:r("filter.fields.remark"),value:"remark",type:"text",operators:[{label:r("filter.operators.contains"),value:"contains"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.inviter_email"),value:"inviter_email",type:"text",operators:[{label:r("filter.operators.contains"),value:"contains"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.invite_user_id"),value:"invite_user_id",type:"number",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.is_admin"),value:"is_admin",type:"boolean",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.is_staff"),value:"is_staff",type:"boolean",operators:[{label:r("filter.operators.eq"),value:"eq"}]}],p=w=>w*1024*1024*1024,k=w=>w/(1024*1024*1024),I=()=>{m([...i,{field:"",operator:"",value:""}])},f=w=>{m(i.filter((T,S)=>S!==w))},j=(w,T,S)=>{const P=[...i];if(P[w]={...P[w],[T]:S},T==="field"){const L=d.find(G=>G.value===S);L&&(P[w].operator=L.operators[0].value,P[w].value=L.type==="boolean"?!1:"")}m(P)},C=(w,T)=>{const S=d.find(P=>P.value===w.field);if(!S)return null;switch(S.type){case"text":return e.jsx(D,{placeholder:r("filter.sheet.value"),value:w.value,onChange:P=>j(T,"value",P.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{type:"number",placeholder:r("filter.sheet.value_number",{unit:S.unit}),value:S.unit==="GB"?k(w.value||0):w.value,onChange:P=>{const L=Number(P.target.value);j(T,"value",S.unit==="GB"?p(L):L)}}),S.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:S.unit})]});case"date":return e.jsx(Ks,{mode:"single",selected:w.value,onSelect:P=>j(T,"value",P),className:"rounded-md border"});case"select":return e.jsxs(J,{value:w.value,onValueChange:P=>j(T,"value",P),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:r("filter.sheet.value")})}),e.jsx(Y,{children:S.useOptions?l.map(P=>e.jsx(q,{value:P.value.toString(),children:P.label},P.value)):S.options?.map(P=>e.jsx(q,{value:P.value.toString(),children:P.label},P.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(U,{checked:w.value,onCheckedChange:P=>j(T,"value",P)}),e.jsx(Et,{children:w.value?r("filter.boolean.true"):r("filter.boolean.false")})]});default:return null}},g=()=>{const w=i.filter(T=>T.field&&T.operator&&T.value!=="").map(T=>{const S=d.find(L=>L.value===T.field);let P=T.value;return T.operator==="contains"?{id:T.field,value:P}:(S?.type==="date"&&P instanceof Date&&(P=Math.floor(P.getTime()/1e3)),S?.type==="boolean"&&(P=P?1:0),{id:T.field,value:`${T.operator}:${P}`})});s.setColumnFilters(w),o(!1)};return e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[e.jsx(Wx,{refetch:n}),e.jsx(D,{placeholder:r("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(Jr,{open:x,onOpenChange:o,children:[e.jsx(Zr,{asChild:!0,children:e.jsxs(R,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Oi,{className:"mr-2 h-4 w-4"}),r("filter.advanced"),i.length>0&&e.jsx(K,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:i.length})]})}),e.jsxs(Ia,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(Va,{children:[e.jsx(Fa,{children:r("filter.sheet.title")}),e.jsx(Ma,{children:r("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:r("filter.sheet.conditions")}),e.jsx(R,{variant:"outline",size:"sm",onClick:I,children:r("filter.sheet.add")})]}),e.jsx(Zs,{className:"h-[calc(100vh-280px)] pr-4",children:e.jsx("div",{className:"space-y-4",children:i.map((w,T)=>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(Et,{children:r("filter.sheet.condition",{number:T+1})}),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>f(T),children:e.jsx(Be,{className:"h-4 w-4"})})]}),e.jsxs(J,{value:w.field,onValueChange:S=>j(T,"field",S),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:r("filter.sheet.field")})}),e.jsx(Y,{children:d.map(S=>e.jsx(q,{value:S.value,children:S.label},S.value))})]}),w.field&&e.jsxs(J,{value:w.operator,onValueChange:S=>j(T,"operator",S),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:r("filter.sheet.operator")})}),e.jsx(Y,{children:d.find(S=>S.value===w.field)?.operators.map(S=>e.jsx(q,{value:S.value,children:S.label},S.value))})]}),w.field&&w.operator&&C(w,T)]},T))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(R,{variant:"outline",onClick:()=>{m([]),o(!1)},children:r("filter.sheet.reset")}),e.jsx(R,{onClick:g,children:r("filter.sheet.apply")})]})]})]})]}),c&&e.jsxs(R,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),m([])},className:"h-8 px-2 lg:px-3",children:[r("filter.reset"),e.jsx(Be,{className:"ml-2 h-4 w-4"})]})]})})}const Zx=h.object({id:h.number(),email:h.string().email(),invite_user_email:h.string().email().nullable().optional(),password:h.string().optional().nullable(),balance:h.coerce.number(),commission_balance:h.coerce.number(),u:h.number(),d:h.number(),transfer_enable:h.number(),expired_at:h.number().nullable(),plan_id:h.number().nullable(),banned:h.number(),commission_type:h.number(),commission_rate:h.number().nullable(),discount:h.number().nullable(),speed_limit:h.number().nullable(),device_limit:h.number().nullable(),is_admin:h.number(),is_staff:h.number(),remarks:h.string().nullable()}),sl=u.createContext(void 0);function Xx({children:s,defaultValues:n,open:a,onOpenChange:l}){const[r,c]=u.useState(!1),[i,m]=u.useState(!1),[x,o]=u.useState([]),d=he({resolver:ge(Zx),defaultValues:n,mode:"onChange"});u.useEffect(()=>{a!==void 0&&c(a)},[a]);const p=k=>{c(k),l?.(k)};return e.jsx(sl.Provider,{value:{form:d,formOpen:r,setFormOpen:p,datePickerOpen:i,setDatePickerOpen:m,planList:x,setPlanList:o},children:s})}function eh(){const s=u.useContext(sl);if(!s)throw new Error("useUserForm must be used within a UserFormProvider");return s}function sh({refetch:s}){const{t:n}=F("user"),{form:a,formOpen:l,setFormOpen:r,datePickerOpen:c,setDatePickerOpen:i,planList:m,setPlanList:x}=eh();return u.useEffect(()=>{l&&Hs().then(({data:o})=>{x(o)})},[l,x]),e.jsxs(je,{...a,children:[e.jsx(b,{control:a.control,name:"email",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.email")}),e.jsx(_,{children:e.jsx(D,{...o,placeholder:n("edit.form.email_placeholder")})}),e.jsx(E,{...o})]})}),e.jsx(b,{control:a.control,name:"invite_user_email",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.inviter_email")}),e.jsx(_,{children:e.jsx(D,{value:o.value||"",onChange:d=>o.onChange(d.target.value?d.target.value:null),placeholder:n("edit.form.inviter_email_placeholder")})}),e.jsx(E,{...o})]})}),e.jsx(b,{control:a.control,name:"password",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.password")}),e.jsx(_,{children:e.jsx(D,{value:o.value||"",onChange:o.onChange,placeholder:n("edit.form.password_placeholder")})}),e.jsx(E,{...o})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(b,{control:a.control,name:"balance",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.balance")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:o.value||"",onChange:o.onChange,placeholder:n("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(E,{...o})]})}),e.jsx(b,{control:a.control,name:"commission_balance",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.commission_balance")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:o.value||"",onChange:o.onChange,placeholder:n("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(E,{...o})]})}),e.jsx(b,{control:a.control,name:"u",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.upload")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{value:o.value/1024/1024/1024||"",onChange:d=>o.onChange(parseInt(d.target.value)*1024*1024*1024),placeholder:n("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(E,{...o})]})}),e.jsx(b,{control:a.control,name:"d",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.download")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:o.value/1024/1024/1024||"",onChange:d=>o.onChange(parseInt(d.target.value)*1024*1024*1024),placeholder:n("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(E,{...o})]})})]}),e.jsx(b,{control:a.control,name:"transfer_enable",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.total_traffic")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:o.value/1024/1024/1024||"",onChange:d=>o.onChange(parseInt(d.target.value)*1024*1024*1024),placeholder:n("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(E,{})]})}),e.jsx(b,{control:a.control,name:"expired_at",render:({field:o})=>e.jsxs(v,{className:"flex flex-col",children:[e.jsx(y,{children:n("edit.form.expire_time")}),e.jsxs(ms,{open:c,onOpenChange:i,children:[e.jsx(us,{asChild:!0,children:e.jsx(_,{children:e.jsxs(R,{type:"button",variant:"outline",className:N("w-full pl-3 text-left font-normal",!o.value&&"text-muted-foreground"),onClick:()=>i(!0),children:[o.value?fe(o.value):e.jsx("span",{children:n("edit.form.expire_time_placeholder")}),e.jsx(ft,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(ls,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:d=>{d.preventDefault()},onEscapeKeyDown:d=>{d.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(R,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{o.onChange(null),i(!1)},children:n("edit.form.expire_time_permanent")}),e.jsx(R,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const d=new Date;d.setMonth(d.getMonth()+1),d.setHours(23,59,59,999),o.onChange(Math.floor(d.getTime()/1e3)),i(!1)},children:n("edit.form.expire_time_1month")}),e.jsx(R,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const d=new Date;d.setMonth(d.getMonth()+3),d.setHours(23,59,59,999),o.onChange(Math.floor(d.getTime()/1e3)),i(!1)},children:n("edit.form.expire_time_3months")})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ks,{mode:"single",selected:o.value?new Date(o.value*1e3):void 0,onSelect:d=>{if(d){const p=new Date(o.value?o.value*1e3:Date.now());d.setHours(p.getHours(),p.getMinutes(),p.getSeconds()),o.onChange(Math.floor(d.getTime()/1e3))}},disabled:d=>d{const d=new Date;d.setHours(23,59,59,999),o.onChange(Math.floor(d.getTime()/1e3))},className:"h-6 px-2 text-xs",children:n("edit.form.expire_time_today")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{type:"datetime-local",step:"1",value:fe(o.value,"YYYY-MM-DDTHH:mm:ss"),onChange:d=>{const p=new Date(d.target.value);isNaN(p.getTime())||o.onChange(Math.floor(p.getTime()/1e3))},className:"flex-1"}),e.jsx(R,{type:"button",variant:"outline",onClick:()=>i(!1),children:n("edit.form.expire_time_confirm")})]})]})]})})]}),e.jsx(E,{})]})}),e.jsx(b,{control:a.control,name:"plan_id",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.subscription")}),e.jsx(_,{children:e.jsxs(J,{value:o.value?o.value.toString():"null",onValueChange:d=>o.onChange(d==="null"?null:parseInt(d)),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:n("edit.form.subscription_none")})}),e.jsxs(Y,{children:[e.jsx(q,{value:"null",children:n("edit.form.subscription_none")}),m.map(d=>e.jsx(q,{value:d.id.toString(),children:d.name},d.id))]})]})})]})}),e.jsx(b,{control:a.control,name:"banned",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.account_status")}),e.jsx(_,{children:e.jsxs(J,{value:o.value.toString(),onValueChange:d=>o.onChange(parseInt(d)),children:[e.jsx(W,{children:e.jsx(Z,{})}),e.jsxs(Y,{children:[e.jsx(q,{value:"1",children:n("columns.status_text.banned")}),e.jsx(q,{value:"0",children:n("columns.status_text.normal")})]})]})})]})}),e.jsx(b,{control:a.control,name:"commission_type",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.commission_type")}),e.jsx(_,{children:e.jsxs(J,{value:o.value.toString(),onValueChange:d=>o.onChange(parseInt(d)),children:[e.jsx(W,{children:e.jsx(Z,{placeholder:n("edit.form.subscription_none")})}),e.jsxs(Y,{children:[e.jsx(q,{value:"0",children:n("edit.form.commission_type_system")}),e.jsx(q,{value:"1",children:n("edit.form.commission_type_cycle")}),e.jsx(q,{value:"2",children:n("edit.form.commission_type_onetime")})]})]})})]})}),e.jsx(b,{control:a.control,name:"commission_rate",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.commission_rate")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:o.value||"",onChange:d=>o.onChange(parseInt(d.currentTarget.value)||null),placeholder:n("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(b,{control:a.control,name:"discount",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.discount")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:o.value||"",onChange:d=>o.onChange(parseInt(d.currentTarget.value)||null),placeholder:n("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(E,{})]})}),e.jsx(b,{control:a.control,name:"speed_limit",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.speed_limit")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:o.value||"",onChange:d=>o.onChange(parseInt(d.currentTarget.value)||null),placeholder:n("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(E,{})]})}),e.jsx(b,{control:a.control,name:"device_limit",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.device_limit")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:o.value||"",onChange:d=>o.onChange(parseInt(d.currentTarget.value)||null),placeholder:n("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(E,{})]})}),e.jsx(b,{control:a.control,name:"is_admin",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.is_admin")}),e.jsx("div",{className:"py-2",children:e.jsx(_,{children:e.jsx(U,{checked:o.value===1,onCheckedChange:d=>o.onChange(d?1:0)})})})]})}),e.jsx(b,{control:a.control,name:"is_staff",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.is_staff")}),e.jsx("div",{className:"py-2",children:e.jsx(_,{children:e.jsx(U,{checked:o.value===1,onCheckedChange:d=>o.onChange(d?1:0)})})})]})}),e.jsx(b,{control:a.control,name:"remarks",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.remarks")}),e.jsx(_,{children:e.jsx(_s,{className:"h-24",value:o.value||"",onChange:d=>o.onChange(d.currentTarget.value??null),placeholder:n("edit.form.remarks_placeholder")})}),e.jsx(E,{})]})}),e.jsxs(el,{children:[e.jsx(R,{variant:"outline",onClick:()=>r(!1),children:n("edit.form.cancel")}),e.jsx(R,{type:"submit",onClick:()=>{a.handleSubmit(o=>{Dd(o).then(({data:d})=>{d&&(A.success(n("edit.form.success")),r(!1),s())})})()},children:n("edit.form.submit")})]})]})}function tl({refetch:s,defaultValues:n,dialogTrigger:a=e.jsxs(R,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(pt,{className:"mr-2 h-4 w-4"}),t("edit.button")]})}){const{t:l}=F("user"),[r,c]=u.useState(!1);return e.jsx(Xx,{defaultValues:n,open:r,onOpenChange:c,children:e.jsxs(Jr,{open:r,onOpenChange:c,children:[e.jsx(Zr,{asChild:!0,children:a}),e.jsxs(Ia,{className:"max-w-[90%] space-y-4",children:[e.jsxs(Va,{children:[e.jsx(Fa,{children:l("edit.title")}),e.jsx(Ma,{})]}),e.jsx(sh,{refetch:s})]})]})})}const al=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"})}),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:"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"})}),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 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"})}),ah=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"})}),Xt=[{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(al,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:cs(s.original.u)})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(nl,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:cs(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(K,{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:cs(n)})}}];function rl({user_id:s,dialogTrigger:n}){const{t:a}=F(["traffic"]),[l,r]=u.useState(!1),[c,i]=u.useState({pageIndex:0,pageSize:20}),{data:m,isLoading:x}=ne({queryKey:["userStats",s,c,l],queryFn:()=>l?Id({user_id:s,pageSize:c.pageSize,page:c.pageIndex+1}):null}),o=Ye({data:m?.data??[],columns:Xt,pageCount:Math.ceil((m?.total??0)/c.pageSize),state:{pagination:c},manualPagination:!0,getCoreRowModel:Qe(),onPaginationChange:i});return e.jsxs(ve,{open:l,onOpenChange:r,children:[e.jsx(He,{asChild:!0,children:n}),e.jsxs(pe,{className:"sm:max-w-[700px]",children:[e.jsx(Ne,{children:e.jsx(be,{children:a("trafficRecord.title")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(ba,{children:[e.jsx(ya,{children:o.getHeaderGroups().map(d=>e.jsx(ks,{children:d.headers.map(p=>e.jsx(_a,{className:N("h-10 px-2 text-xs",p.id==="total"&&"text-right"),children:p.isPlaceholder?null:Tt(p.column.columnDef.header,p.getContext())},p.id))},d.id))}),e.jsx(Na,{children:x?Array.from({length:c.pageSize}).map((d,p)=>e.jsx(ks,{children:Array.from({length:Xt.length}).map((k,I)=>e.jsx(Ys,{className:"p-2",children:e.jsx(re,{className:"h-6 w-full"})},I))},p)):o.getRowModel().rows?.length?o.getRowModel().rows.map(d=>e.jsx(ks,{"data-state":d.getIsSelected()&&"selected",className:"h-10",children:d.getVisibleCells().map(p=>e.jsx(Ys,{className:"px-2",children:Tt(p.column.columnDef.cell,p.getContext())},p.id))},d.id)):e.jsx(ks,{children:e.jsx(Ys,{colSpan:Xt.length,className:"h-24 text-center",children:a("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:a("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(Z,{placeholder:o.getState().pagination.pageSize})}),e.jsx(Y,{side:"top",children:[10,20,30,40,50].map(d=>e.jsx(q,{value:`${d}`,children:d},d))})]}),e.jsx("p",{className:"text-sm font-medium",children:a("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:a("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()||x,children:e.jsx(th,{className:"h-4 w-4"})}),e.jsx(B,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>o.nextPage(),disabled:!o.getCanNextPage()||x,children:e.jsx(ah,{className:"h-4 w-4"})})]})]})]})]})]})]})}function nh({onConfirm:s,children:n,title:a="确认操作",description:l="确定要执行此操作吗?",cancelText:r="取消",confirmText:c="确认",variant:i="default",className:m}){return e.jsxs(Mr,{children:[e.jsx(Or,{asChild:!0,children:n}),e.jsxs(wa,{className:N("sm:max-w-[425px]",m),children:[e.jsxs(Ca,{children:[e.jsx(ka,{children:a}),e.jsx(Ta,{children:l})]}),e.jsxs(Sa,{children:[e.jsx(Da,{asChild:!0,children:e.jsx(R,{variant:"outline",children:r})}),e.jsx(Pa,{asChild:!0,children:e.jsx(R,{variant:i,onClick:s,children:c})})]})]})]})}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:"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"})}),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:"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"})}),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:"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"})}),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.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"})}),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:"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"})}),uh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"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"})}),xh=(s,n)=>{const{t:a}=F("user");return[{accessorKey:"is_admin",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.is_admin")}),enableSorting:!1,enableHiding:!0,filterFn:(l,r,c)=>c.includes(l.getValue(r)),size:0},{accessorKey:"is_staff",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.is_staff")}),enableSorting:!1,enableHiding:!0,filterFn:(l,r,c)=>c.includes(l.getValue(r)),size:0},{accessorKey:"id",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx(K,{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 r=l.original.t||0,c=Date.now()/1e3-r<120,i=Math.floor(Date.now()/1e3-r);let m=c?a("columns.online_status.online"):r===0?a("columns.online_status.never"):a("columns.online_status.last_online",{time:fe(r)});if(!c&&r!==0){const x=Math.floor(i/60),o=Math.floor(x/60),d=Math.floor(o/24);d>0?m+=` -`+a("columns.online_status.offline_duration.days",{count:d}):o>0?m+=` -`+a("columns.online_status.offline_duration.hours",{count:o}):x>0?m+=` +`).filter(Boolean);i.onChange(p),x(r.getValues())}})}),e.jsx(z,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"recaptcha_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.recaptcha.enable.label")}),e.jsx(z,{children:s("safe.form.recaptcha.enable.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),r.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:r.control,name:"recaptcha_key",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.recaptcha.key.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.recaptcha.key.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),x(r.getValues())}})}),e.jsx(z,{children:s("safe.form.recaptcha.key.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"recaptcha_site_key",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.recaptcha.siteKey.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.recaptcha.siteKey.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),x(r.getValues())}})}),e.jsx(z,{children:s("safe.form.recaptcha.siteKey.description")}),e.jsx(T,{})]})})]}),e.jsx(b,{control:r.control,name:"register_limit_by_ip_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(z,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),r.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:r.control,name:"register_limit_count",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.registerLimit.count.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.registerLimit.count.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),x(r.getValues())}})}),e.jsx(z,{children:s("safe.form.registerLimit.count.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"register_limit_expire",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.registerLimit.expire.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.registerLimit.expire.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),x(r.getValues())}})}),e.jsx(z,{children:s("safe.form.registerLimit.expire.description")}),e.jsx(T,{})]})})]}),e.jsx(b,{control:r.control,name:"password_limit_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.passwordLimit.enable.label")}),e.jsx(z,{children:s("safe.form.passwordLimit.enable.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),r.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:r.control,name:"password_limit_count",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.passwordLimit.count.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.passwordLimit.count.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),x(r.getValues())}})}),e.jsx(z,{children:s("safe.form.passwordLimit.count.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"password_limit_expire",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.passwordLimit.expire.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.passwordLimit.expire.placeholder"),...i,value:i.value||"",onChange:d=>{i.onChange(d),x(r.getValues())}})}),e.jsx(z,{children:s("safe.form.passwordLimit.expire.description")}),e.jsx(T,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("safe.form.saving")})]})})}function wm(){const{t:s}=M("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(Se,{}),e.jsx(_m,{})]})}const Cm=Object.freeze(Object.defineProperty({__proto__:null,default:wm},Symbol.toStringTag,{value:"Module"})),Sm=h.object({plan_change_enable:h.boolean().nullable().default(!1),reset_traffic_method:h.coerce.number().nullable().default(0),surplus_enable:h.boolean().nullable().default(!1),new_order_event_id:h.coerce.number().nullable().default(0),renew_order_event_id:h.coerce.number().nullable().default(0),change_order_event_id:h.coerce.number().nullable().default(0),show_info_to_server_enable:h.boolean().nullable().default(!1),show_protocol_to_server_enable:h.boolean().nullable().default(!1),default_remind_expire:h.boolean().nullable().default(!1),default_remind_traffic:h.boolean().nullable().default(!1),subscribe_path:h.string().nullable().default("s")}),km={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}=M("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=je({resolver:Ne(Sm),defaultValues:km,mode:"onBlur"}),{data:c}=ie({queryKey:["settings","subscribe"],queryFn:()=>Cs("subscribe")}),{mutateAsync:o}=ms({mutationFn:Ss,onSuccess:i=>{i.data&&$.success(s("common.autoSaved"))}});u.useEffect(()=>{if(c?.data?.subscribe){const i=c?.data?.subscribe;Object.entries(i).forEach(([d,p])=>{r.setValue(d,p)}),l.current=i}},[c]);const m=u.useCallback(Ce.debounce(async i=>{if(!Ce.isEqual(i,l.current)){a(!0);try{await o(i),l.current=i}finally{a(!1)}}},1e3),[o]),x=u.useCallback(i=>{m(i)},[m]);return u.useEffect(()=>{const i=r.watch(d=>{x(d)});return()=>i.unsubscribe()},[r.watch,x]),e.jsx(_e,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"plan_change_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.plan_change_enable.title")}),e.jsx(z,{children:s("subscribe.plan_change_enable.description")}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"reset_traffic_method",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.reset_traffic_method.title")}),e.jsxs(X,{onValueChange:i.onChange,value:i.value?.toString()||"0",children:[e.jsx(_,{children:e.jsx(Q,{children:e.jsx(ee,{placeholder:"请选择重置方式"})})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:s("subscribe.reset_traffic_method.options.monthly_first")}),e.jsx(U,{value:"1",children:s("subscribe.reset_traffic_method.options.monthly_reset")}),e.jsx(U,{value:"2",children:s("subscribe.reset_traffic_method.options.no_reset")}),e.jsx(U,{value:"3",children:s("subscribe.reset_traffic_method.options.yearly_first")}),e.jsx(U,{value:"4",children:s("subscribe.reset_traffic_method.options.yearly_reset")})]})]}),e.jsx(z,{children:s("subscribe.reset_traffic_method.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"surplus_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.surplus_enable.title")}),e.jsx(z,{children:s("subscribe.surplus_enable.description")}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"new_order_event_id",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.new_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(_,{children:e.jsxs(X,{onValueChange:i.onChange,value:i.value?.toString(),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:"请选择"})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:s("subscribe.new_order_event.options.no_action")}),e.jsx(U,{value:"1",children:s("subscribe.new_order_event.options.reset_traffic")})]})]})})}),e.jsx(z,{children:s("subscribe.new_order_event.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"renew_order_event_id",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.renew_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(_,{children:e.jsxs(X,{onValueChange:i.onChange,value:i.value?.toString(),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:"请选择"})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:s("subscribe.renew_order_event.options.no_action")}),e.jsx(U,{value:"1",children:s("subscribe.renew_order_event.options.reset_traffic")})]})]})})}),e.jsx(z,{children:s("renew_order_event.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"change_order_event_id",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.change_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(_,{children:e.jsxs(X,{onValueChange:i.onChange,value:i.value?.toString(),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:"请选择"})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:s("subscribe.change_order_event.options.no_action")}),e.jsx(U,{value:"1",children:s("subscribe.change_order_event.options.reset_traffic")})]})]})})}),e.jsx(z,{children:s("subscribe.change_order_event.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"subscribe_path",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("subscribe.subscribe_path.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:"subscribe",...i,value:i.value||"",onChange:d=>{i.onChange(d),x(r.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(T,{})]})}),e.jsx(b,{control:r.control,name:"show_info_to_server_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("subscribe.show_info_to_server.title")}),e.jsx(z,{children:s("subscribe.show_info_to_server.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"show_protocol_to_server_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("subscribe.show_protocol_to_server.title")}),e.jsx(z,{children:s("subscribe.show_protocol_to_server.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value||!1,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Dm(){const{t:s}=M("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(Se,{}),e.jsx(Tm,{})]})}const Pm=Object.freeze(Object.defineProperty({__proto__:null,default:Dm},Symbol.toStringTag,{value:"Module"})),Em=h.object({invite_force:h.boolean().default(!1),invite_commission:h.coerce.string().default("0"),invite_gen_limit:h.coerce.string().default("0"),invite_never_expire:h.boolean().default(!1),commission_first_time_enable:h.boolean().default(!1),commission_auto_check_enable:h.boolean().default(!1),commission_withdraw_limit:h.coerce.string().default("0"),commission_withdraw_method:h.array(h.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:h.boolean().default(!1),commission_distribution_enable:h.boolean().default(!1),commission_distribution_l1:h.coerce.number().default(0),commission_distribution_l2:h.coerce.number().default(0),commission_distribution_l3:h.coerce.number().default(0)}),Rm={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}=M("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=je({resolver:Ne(Em),defaultValues:Rm,mode:"onBlur"}),{data:c}=ie({queryKey:["settings","invite"],queryFn:()=>Cs("invite")}),{mutateAsync:o}=ms({mutationFn:Ss,onSuccess:i=>{i.data&&$.success(s("common.autoSaved"))}});u.useEffect(()=>{if(c?.data?.invite){const i=c?.data?.invite;Object.entries(i).forEach(([d,p])=>{typeof p=="number"?r.setValue(d,String(p)):r.setValue(d,p)}),l.current=i}},[c]);const m=u.useCallback(Ce.debounce(async i=>{if(!Ce.isEqual(i,l.current)){a(!0);try{await o(i),l.current=i}finally{a(!1)}}},1e3),[o]),x=u.useCallback(i=>{m(i)},[m]);return u.useEffect(()=>{const i=r.watch(d=>{x(d)});return()=>i.unsubscribe()},[r.watch,x]),e.jsx(_e,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"invite_force",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.invite_force.title")}),e.jsx(z,{children:s("invite.invite_force.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"invite_commission",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("invite.invite_commission.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("invite.invite_commission.placeholder"),...i,value:i.value||""})}),e.jsx(z,{children:s("invite.invite_commission.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"invite_gen_limit",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("invite.invite_gen_limit.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("invite.invite_gen_limit.placeholder"),...i,value:i.value||""})}),e.jsx(z,{children:s("invite.invite_gen_limit.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"invite_never_expire",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.invite_never_expire.title")}),e.jsx(z,{children:s("invite.invite_never_expire.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"commission_first_time_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.commission_first_time.title")}),e.jsx(z,{children:s("invite.commission_first_time.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"commission_auto_check_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.commission_auto_check.title")}),e.jsx(z,{children:s("invite.commission_auto_check.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"commission_withdraw_limit",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("invite.commission_withdraw_limit.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("invite.commission_withdraw_limit.placeholder"),...i,value:i.value||""})}),e.jsx(z,{children:s("invite.commission_withdraw_limit.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"commission_withdraw_method",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("invite.commission_withdraw_method.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("invite.commission_withdraw_method.placeholder"),...i,value:Array.isArray(i.value)?i.value.join(","):"",onChange:d=>{const p=d.target.value.split(",").filter(Boolean);i.onChange(p),x(r.getValues())}})}),e.jsx(z,{children:s("invite.commission_withdraw_method.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"withdraw_close_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.withdraw_close.title")}),e.jsx(z,{children:s("invite.withdraw_close.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),e.jsx(b,{control:r.control,name:"commission_distribution_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("invite.commission_distribution.title")}),e.jsx(z,{children:s("invite.commission_distribution.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:i.value,onCheckedChange:d=>{i.onChange(d),x(r.getValues())}})})]})}),r.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:r.control,name:"commission_distribution_l1",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:s("invite.commission_distribution.l1")}),e.jsx(_,{children:e.jsx(k,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...i,value:i.value||"",onChange:d=>{const p=d.target.value?Number(d.target.value):0;i.onChange(p),x(r.getValues())}})}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"commission_distribution_l2",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:s("invite.commission_distribution.l2")}),e.jsx(_,{children:e.jsx(k,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...i,value:i.value||"",onChange:d=>{const p=d.target.value?Number(d.target.value):0;i.onChange(p),x(r.getValues())}})}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"commission_distribution_l3",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:s("invite.commission_distribution.l3")}),e.jsx(_,{children:e.jsx(k,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...i,value:i.value||"",onChange:d=>{const p=d.target.value?Number(d.target.value):0;i.onChange(p),x(r.getValues())}})}),e.jsx(T,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("invite.saving")})]})})}function Vm(){const{t:s}=M("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(Se,{}),e.jsx(Im,{})]})}const Om=Object.freeze(Object.defineProperty({__proto__:null,default:Vm},Symbol.toStringTag,{value:"Module"})),Mm=h.object({frontend_theme:h.string().nullable(),frontend_theme_sidebar:h.string().nullable(),frontend_theme_header:h.string().nullable(),frontend_theme_color:h.string().nullable(),frontend_background_url:h.string().url().nullable()}),Fm={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function zm(){const{data:s}=ie({queryKey:["settings","frontend"],queryFn:()=>Cs("frontend")}),n=je({resolver:Ne(Mm),defaultValues:Fm,mode:"onChange"});u.useEffect(()=>{if(s?.data?.frontend){const l=s?.data?.frontend;Object.entries(l).forEach(([r,c])=>{n.setValue(r,c)})}},[s]);function a(l){Ss(l).then(({data:r})=>{r&&$.success("更新成功")})}return e.jsx(_e,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(a),className:"space-y-8",children:[e.jsx(b,{control:n.control,name:"frontend_theme_sidebar",render:({field:l})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:"边栏风格"}),e.jsx(z,{children:"边栏风格"})]}),e.jsx(_,{children:e.jsx(W,{checked:l.value,onCheckedChange:l.onChange})})]})}),e.jsx(b,{control:n.control,name:"frontend_theme_header",render:({field:l})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:"头部风格"}),e.jsx(z,{children:"边栏风格"})]}),e.jsx(_,{children:e.jsx(W,{checked:l.value,onCheckedChange:l.onChange})})]})}),e.jsx(b,{control:n.control,name:"frontend_theme_color",render:({field:l})=>e.jsxs(v,{children:[e.jsx(y,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(_,{children:e.jsxs("select",{className:N(et({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(ka,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(z,{children:"主题色"}),e.jsx(T,{})]})}),e.jsx(b,{control:n.control,name:"frontend_background_url",render:({field:l})=>e.jsxs(v,{children:[e.jsx(y,{children:"背景"}),e.jsx(_,{children:e.jsx(k,{placeholder:"请输入图片地址",...l})}),e.jsx(z,{children:"将会在后台登录页面进行展示。"}),e.jsx(T,{})]})}),e.jsx(D,{type:"submit",children:"保存设置"})]})})}function Lm(){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(Se,{}),e.jsx(zm,{})]})}const Am=Object.freeze(Object.defineProperty({__proto__:null,default:Lm},Symbol.toStringTag,{value:"Module"})),$m=h.object({server_pull_interval:h.coerce.number().nullable(),server_push_interval:h.coerce.number().nullable(),server_token:h.string().nullable(),device_limit_mode:h.coerce.number().nullable()}),qm={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function Um(){const{t:s}=M("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=je({resolver:Ne($m),defaultValues:qm,mode:"onBlur"}),{data:c}=ie({queryKey:["settings","server"],queryFn:()=>Cs("server")}),{mutateAsync:o}=ms({mutationFn:Ss,onSuccess:d=>{d.data&&$.success(s("common.AutoSaved"))}});u.useEffect(()=>{if(c?.data.server){const d=c.data.server;Object.entries(d).forEach(([p,C])=>{r.setValue(p,C)}),l.current=d}},[c]);const m=u.useCallback(Ce.debounce(async d=>{if(!Ce.isEqual(d,l.current)){a(!0);try{await o(d),l.current=d}finally{a(!1)}}},1e3),[o]),x=u.useCallback(d=>{m(d)},[m]);u.useEffect(()=>{const d=r.watch(p=>{x(p)});return()=>d.unsubscribe()},[r.watch,x]);const i=()=>{const d=Math.floor(Math.random()*17)+16,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let C="";for(let P=0;Pe.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("server.server_token.title")}),e.jsx(_,{children:e.jsxs("div",{className:"relative",children:[e.jsx(k,{placeholder:s("server.server_token.placeholder"),...d,value:d.value||"",className:"pr-10"}),e.jsx(pe,{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:p=>{p.preventDefault(),i()},children:e.jsx(go,{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(z,{children:s("server.server_token.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"server_pull_interval",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("server.server_pull_interval.title")}),e.jsx(_,{children:e.jsx(k,{type:"number",placeholder:s("server.server_pull_interval.placeholder"),...d,value:d.value||"",onChange:p=>{const C=p.target.value?Number(p.target.value):null;d.onChange(C)}})}),e.jsx(z,{children:s("server.server_pull_interval.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"server_push_interval",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("server.server_push_interval.title")}),e.jsx(_,{children:e.jsx(k,{type:"number",placeholder:s("server.server_push_interval.placeholder"),...d,value:d.value||"",onChange:p=>{const C=p.target.value?Number(p.target.value):null;d.onChange(C)}})}),e.jsx(z,{children:s("server.server_push_interval.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"device_limit_mode",render:({field:d})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("server.device_limit_mode.title")}),e.jsxs(X,{onValueChange:d.onChange,value:d.value?.toString()||"0",children:[e.jsx(_,{children:e.jsx(Q,{children:e.jsx(ee,{placeholder:s("server.device_limit_mode.placeholder")})})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:s("server.device_limit_mode.strict")}),e.jsx(U,{value:"1",children:s("server.device_limit_mode.relaxed")})]})]}),e.jsx(z,{children:s("server.device_limit_mode.description")}),e.jsx(T,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("server.saving")})]})})}function Hm(){const{t:s}=M("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(Se,{}),e.jsx(Um,{})]})}const Km=Object.freeze(Object.defineProperty({__proto__:null,default:Hm},Symbol.toStringTag,{value:"Module"}));function Bm({open:s,onOpenChange:n,result:a}){const l=!a.error;return e.jsx(be,{open:s,onOpenChange:n,children:e.jsxs(ge,{className:"sm:max-w-[425px]",children:[e.jsxs(we,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l?e.jsx(er,{className:"h-5 w-5 text-green-500"}):e.jsx(sr,{className:"h-5 w-5 text-destructive"}),e.jsx(ye,{children:l?"邮件发送成功":"邮件发送失败"})]}),e.jsx(De,{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:a.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:a.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:a.template_name})]})]}),a.error&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium text-destructive",children:"错误信息"}),e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive break-all",children:a.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(Xs,{className:"h-[200px] rounded-md border p-4",children:e.jsx("div",{className:"grid gap-2 text-sm",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2",children:[e.jsx("div",{className:"text-muted-foreground",children:"驱动"}),e.jsx("div",{children:a.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:a.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:a.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:a.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:a.config.from.address?`${a.config.from.address}${a.config.from.name?` (${a.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:a.config.username||"未设置"})]})})})]})]})]})})}const Gm=h.object({email_template:h.string().nullable().default("classic"),email_host:h.string().nullable().default(""),email_port:h.coerce.number().nullable().default(465),email_username:h.string().nullable().default(""),email_password:h.string().nullable().default(""),email_encryption:h.string().nullable().default(""),email_from_address:h.string().email().nullable().default(""),remind_mail_enable:h.boolean().nullable().default(!1)});function Wm(){const{t:s}=M("settings"),[n,a]=u.useState(null),[l,r]=u.useState(!1),c=u.useRef(null),[o,m]=u.useState(!1),x=je({resolver:Ne(Gm),defaultValues:{},mode:"onBlur"}),{data:i}=ie({queryKey:["settings","email"],queryFn:()=>Cs("email")}),{data:d}=ie({queryKey:["emailTemplate"],queryFn:()=>Kd()}),{mutateAsync:p}=ms({mutationFn:Ss,onSuccess:w=>{w.data&&$.success(s("common.autoSaved"))}}),{mutate:C,isPending:P}=ms({mutationFn:Bd,onMutate:()=>{a(null),r(!1)},onSuccess:w=>{a(w.data),r(!0),w.data.error?$.error(s("email.test.error")):$.success(s("email.test.success"))}});u.useEffect(()=>{if(i?.data.email){const w=i.data.email;Object.entries(w).forEach(([g,S])=>{x.setValue(g,S)}),c.current=w}},[i]);const f=u.useCallback(Ce.debounce(async w=>{if(!Ce.isEqual(w,c.current)){m(!0);try{await p(w),c.current=w}finally{m(!1)}}},1e3),[p]),j=u.useCallback(w=>{f(w)},[f]);return u.useEffect(()=>{const w=x.watch(g=>{j(g)});return()=>w.unsubscribe()},[x.watch,j]),e.jsxs(e.Fragment,{children:[e.jsx(_e,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:x.control,name:"email_host",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_host.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("common.placeholder"),...w,value:w.value||""})}),e.jsx(z,{children:s("email.email_host.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"email_port",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_port.title")}),e.jsx(_,{children:e.jsx(k,{type:"number",placeholder:s("common.placeholder"),...w,value:w.value||"",onChange:g=>{const S=g.target.value?Number(g.target.value):null;w.onChange(S)}})}),e.jsx(z,{children:s("email.email_port.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"email_encryption",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_encryption.title")}),e.jsxs(X,{onValueChange:w.onChange,value:w.value||"none",children:[e.jsx(_,{children:e.jsx(Q,{children:e.jsx(ee,{placeholder:"请选择加密方式"})})}),e.jsxs(J,{children:[e.jsx(U,{value:"none",children:s("email.email_encryption.none")}),e.jsx(U,{value:"ssl",children:s("email.email_encryption.ssl")}),e.jsx(U,{value:"tls",children:s("email.email_encryption.tls")})]})]}),e.jsx(z,{children:s("email.email_encryption.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"email_username",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_username.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("common.placeholder"),...w,value:w.value||""})}),e.jsx(z,{children:s("email.email_username.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"email_password",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_password.title")}),e.jsx(_,{children:e.jsx(k,{type:"password",placeholder:s("common.placeholder"),...w,value:w.value||""})}),e.jsx(z,{children:s("email.email_password.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"email_from_address",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_from.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("common.placeholder"),...w,value:w.value||""})}),e.jsx(z,{children:s("email.email_from.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"email_template",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_template.title")}),e.jsxs(X,{onValueChange:g=>{w.onChange(g),j(x.getValues())},value:w.value||void 0,children:[e.jsx(_,{children:e.jsx(Q,{className:"w-[200px]",children:e.jsx(ee,{placeholder:s("email.email_template.placeholder")})})}),e.jsx(J,{children:d?.data?.map(g=>e.jsx(U,{value:g,children:g},g))})]}),e.jsx(z,{children:s("email.email_template.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"remind_mail_enable",render:({field:w})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("email.remind_mail.title")}),e.jsx(z,{children:s("email.remind_mail.description")})]}),e.jsx(_,{children:e.jsx(W,{checked:w.value||!1,onCheckedChange:g=>{w.onChange(g),j(x.getValues())}})})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(D,{onClick:()=>C(),loading:P,disabled:P,children:s(P?"test.sending":"test.title")})})]})}),o&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("saving")}),n&&e.jsx(Bm,{open:l,onOpenChange:r,result:n})]})}function Ym(){const{t:s}=M("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(Se,{}),e.jsx(Wm,{})]})}const Qm=Object.freeze(Object.defineProperty({__proto__:null,default:Ym},Symbol.toStringTag,{value:"Module"})),Jm=h.object({telegram_bot_enable:h.boolean().nullable(),telegram_bot_token:h.string().nullable(),telegram_discuss_link:h.string().nullable()}),Zm={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function Xm(){const{t:s}=M("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=je({resolver:Ne(Jm),defaultValues:Zm,mode:"onBlur"}),{data:c}=ie({queryKey:["settings","telegram"],queryFn:()=>Cs("telegram")}),{mutateAsync:o}=ms({mutationFn:Ss,onSuccess:p=>{p.data&&$.success(s("common.autoSaved"))}}),{mutate:m,isPending:x}=ms({mutationFn:Gd,onSuccess:p=>{p.data&&$.success(s("telegram.webhook.success"))}});u.useEffect(()=>{if(c?.data.telegram){const p=c.data.telegram;Object.entries(p).forEach(([C,P])=>{r.setValue(C,P)}),l.current=p}},[c]);const i=u.useCallback(Ce.debounce(async p=>{if(!Ce.isEqual(p,l.current)){a(!0);try{await o(p),l.current=p}finally{a(!1)}}},1e3),[o]),d=u.useCallback(p=>{i(p)},[i]);return u.useEffect(()=>{const p=r.watch(C=>{d(C)});return()=>p.unsubscribe()},[r.watch,d]),e.jsx(_e,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"telegram_bot_token",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("telegram.bot_token.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("telegram.bot_token.placeholder"),...p,value:p.value||""})}),e.jsx(z,{children:s("telegram.bot_token.description")}),e.jsx(T,{})]})}),r.watch("telegram_bot_token")&&e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("telegram.webhook.title")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(D,{loading:x,disabled:x,onClick:()=>m(),children:s(x?"telegram.webhook.setting":"telegram.webhook.button")}),n&&e.jsx("span",{className:"text-sm text-muted-foreground",children:s("common.saving")})]}),e.jsx(z,{children:s("telegram.webhook.description")}),e.jsx(T,{})]}),e.jsx(b,{control:r.control,name:"telegram_bot_enable",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("telegram.bot_enable.title")}),e.jsx(z,{children:s("telegram.bot_enable.description")}),e.jsx(_,{children:e.jsx(W,{checked:p.value||!1,onCheckedChange:C=>{p.onChange(C),d(r.getValues())}})}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"telegram_discuss_link",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("telegram.discuss_link.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("telegram.discuss_link.placeholder"),...p,value:p.value||""})}),e.jsx(z,{children:s("telegram.discuss_link.description")}),e.jsx(T,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function eu(){const{t:s}=M("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(Se,{}),e.jsx(Xm,{})]})}const su=Object.freeze(Object.defineProperty({__proto__:null,default:eu},Symbol.toStringTag,{value:"Module"})),tu=h.object({windows_version:h.string().nullable(),windows_download_url:h.string().nullable(),macos_version:h.string().nullable(),macos_download_url:h.string().nullable(),android_version:h.string().nullable(),android_download_url:h.string().nullable()}),au={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function nu(){const{t:s}=M("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=je({resolver:Ne(tu),defaultValues:au,mode:"onBlur"}),{data:c}=ie({queryKey:["settings","app"],queryFn:()=>Cs("app")}),{mutateAsync:o}=ms({mutationFn:Ss,onSuccess:i=>{i.data&&$.success(s("app.save_success"))}});u.useEffect(()=>{if(c?.data.app){const i=c.data.app;Object.entries(i).forEach(([d,p])=>{r.setValue(d,p)}),l.current=i}},[c]);const m=u.useCallback(Ce.debounce(async i=>{if(!Ce.isEqual(i,l.current)){a(!0);try{await o(i),l.current=i}finally{a(!1)}}},1e3),[o]),x=u.useCallback(i=>{m(i)},[m]);return u.useEffect(()=>{const i=r.watch(d=>{x(d)});return()=>i.unsubscribe()},[r.watch,x]),e.jsx(_e,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:r.control,name:"windows_version",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.windows.version.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(z,{children:s("app.windows.version.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"windows_download_url",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.windows.download.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(z,{children:s("app.windows.download.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"macos_version",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.macos.version.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(z,{children:s("app.macos.version.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"macos_download_url",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.macos.download.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(z,{children:s("app.macos.download.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"android_version",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.android.version.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(z,{children:s("app.android.version.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"android_download_url",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("app.android.download.title")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("common.placeholder"),...i,value:i.value||""})}),e.jsx(z,{children:s("app.android.download.description")}),e.jsx(T,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function ru(){const{t:s}=M("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(Se,{}),e.jsx(nu,{})]})}const lu=Object.freeze(Object.defineProperty({__proto__:null,default:ru},Symbol.toStringTag,{value:"Module"})),Ia=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:N("w-full caption-bottom text-sm",s),...n})}));Ia.displayName="Table";const Va=u.forwardRef(({className:s,...n},a)=>e.jsx("thead",{ref:a,className:N("[&_tr]:border-b",s),...n}));Va.displayName="TableHeader";const Oa=u.forwardRef(({className:s,...n},a)=>e.jsx("tbody",{ref:a,className:N("[&_tr:last-child]:border-0",s),...n}));Oa.displayName="TableBody";const iu=u.forwardRef(({className:s,...n},a)=>e.jsx("tfoot",{ref:a,className:N("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...n}));iu.displayName="TableFooter";const Ps=u.forwardRef(({className:s,...n},a)=>e.jsx("tr",{ref:a,className:N("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...n}));Ps.displayName="TableRow";const Ma=u.forwardRef(({className:s,...n},a)=>e.jsx("th",{ref:a,className:N("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}));Ma.displayName="TableHead";const Ys=u.forwardRef(({className:s,...n},a)=>e.jsx("td",{ref:a,className:N("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...n}));Ys.displayName="TableCell";const ou=u.forwardRef(({className:s,...n},a)=>e.jsx("caption",{ref:a,className:N("mt-4 text-sm text-muted-foreground",s),...n}));ou.displayName="TableCaption";function cu({table:s}){const[n,a]=u.useState(""),{t:l}=M("common");u.useEffect(()=>{a((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const r=c=>{const o=parseInt(c);!isNaN(o)&&o>=1&&o<=s.getPageCount()?s.setPageIndex(o-1):a((s.getState().pagination.pageIndex+1).toString())};return e.jsxs("div",{className:"flex flex-col-reverse gap-4 px-2 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.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:c=>{s.setPageSize(Number(c))},children:[e.jsx(Q,{className:"h-8 w-[70px]",children:e.jsx(ee,{placeholder:s.getState().pagination.pageSize})}),e.jsx(J,{side:"top",children:[10,20,30,40,50,100,500].map(c=>e.jsx(U,{value:`${c}`,children:c},c))})]})]}),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(k,{type:"text",value:n,onChange:c=>a(c.target.value),onBlur:c=>r(c.target.value),onKeyDown:c=>{c.key==="Enter"&&r(c.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(D,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(0),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:l("table.pagination.firstPage")}),e.jsx(jo,{className:"h-4 w-4"})]}),e.jsxs(D,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.previousPage(),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:l("table.pagination.previousPage")}),e.jsx(Yn,{className:"h-4 w-4"})]}),e.jsxs(D,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.nextPage(),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:l("table.pagination.nextPage")}),e.jsx(Ca,{className:"h-4 w-4"})]}),e.jsxs(D,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(s.getPageCount()-1),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:l("table.pagination.lastPage")}),e.jsx(vo,{className:"h-4 w-4"})]})]})]})]})}function cs({table:s,toolbar:n,draggable:a=!1,onDragStart:l,onDragEnd:r,onDragOver:c,onDragLeave:o,onDrop:m,showPagination:x=!0,isLoading:i=!1}){const{t:d}=M("common"),p=u.useRef(null),C=s.getAllColumns().filter(w=>w.getIsPinned()==="left"),P=s.getAllColumns().filter(w=>w.getIsPinned()==="right"),f=w=>C.slice(0,w).reduce((g,S)=>g+(S.getSize()??0),0),j=w=>P.slice(w+1).reduce((g,S)=>g+(S.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof n=="function"?n(s):n,e.jsx("div",{ref:p,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs(Ia,{children:[e.jsx(Va,{children:s.getHeaderGroups().map(w=>e.jsx(Ps,{className:"hover:bg-transparent",children:w.headers.map((g,S)=>{const R=g.column.getIsPinned()==="left",E=g.column.getIsPinned()==="right",O=R?f(C.indexOf(g.column)):void 0,q=E?j(P.indexOf(g.column)):void 0;return e.jsx(Ma,{colSpan:g.colSpan,style:{width:g.getSize(),...R&&{left:O},...E&&{right:q}},className:N("h-11 bg-card px-4 text-muted-foreground",(R||E)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",R&&"before:right-0",E&&"before:left-0"]),children:g.isPlaceholder?null:Rt(g.column.columnDef.header,g.getContext())},g.id)})},w.id))}),e.jsx(Oa,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((w,g)=>e.jsx(Ps,{"data-state":w.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:a,onDragStart:S=>l?.(S,g),onDragEnd:r,onDragOver:c,onDragLeave:o,onDrop:S=>m?.(S,g),children:w.getVisibleCells().map((S,R)=>{const E=S.column.getIsPinned()==="left",O=S.column.getIsPinned()==="right",q=E?f(C.indexOf(S.column)):void 0,te=O?j(P.indexOf(S.column)):void 0;return e.jsx(Ys,{style:{width:S.column.getSize(),...E&&{left:q},...O&&{right:te}},className:N("bg-card",(E||O)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",E&&"before:right-0",O&&"before:left-0"]),children:Rt(S.column.columnDef.cell,S.getContext())},S.id)})},w.id)):e.jsx(Ps,{children:e.jsx(Ys,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:d("table.noData")})})})]})})}),x&&e.jsx(cu,{table:s})]})}const du=s=>h.object({id:h.number().nullable(),name:h.string().min(2,s("form.validation.name.min")).max(30,s("form.validation.name.max")),icon:h.string().optional().nullable(),notify_domain:h.string().refine(a=>!a||/^https?:\/\/\S+/.test(a),s("form.validation.notify_domain.url")).optional().nullable(),handling_fee_fixed:h.coerce.number().min(0).optional().nullable(),handling_fee_percent:h.coerce.number().min(0).max(100).optional().nullable(),payment:h.string().min(1,s("form.validation.payment.required")),config:h.record(h.string(),h.string())}),ln={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function Ur({refetch:s,dialogTrigger:n,type:a="add",defaultFormValues:l=ln}){const{t:r}=M("payment"),[c,o]=u.useState(!1),[m,x]=u.useState(!1),[i,d]=u.useState([]),[p,C]=u.useState([]),P=du(r),f=je({resolver:Ne(P),defaultValues:l,mode:"onChange"}),j=f.watch("payment");u.useEffect(()=>{c&&(async()=>{const{data:S}=await dd();d(S)})()},[c]),u.useEffect(()=>{if(!j||!c)return;(async()=>{const S={payment:j,...a==="edit"&&{id:Number(f.getValues("id"))}};md(S).then(({data:R})=>{C(R);const E=R.reduce((O,q)=>(q.field_name&&(O[q.field_name]=q.value??""),O),{});f.setValue("config",E)})})()},[j,c,f,a]);const w=async g=>{x(!0);try{(await ud(g)).data&&($.success(r("form.messages.success")),f.reset(ln),s(),o(!1))}finally{x(!1)}};return e.jsxs(be,{open:c,onOpenChange:o,children:[e.jsx(Ge,{asChild:!0,children:n||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Re,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add.button")})]})}),e.jsxs(ge,{className:"sm:max-w-[425px]",children:[e.jsx(we,{children:e.jsx(ye,{children:r(a==="add"?"form.add.title":"form.edit.title")})}),e.jsx(_e,{...f,children:e.jsxs("form",{onSubmit:f.handleSubmit(w),className:"space-y-4",children:[e.jsx(b,{control:f.control,name:"name",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:r("form.fields.name.placeholder"),...g})}),e.jsx(z,{children:r("form.fields.name.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:f.control,name:"icon",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.icon.label")}),e.jsx(_,{children:e.jsx(k,{...g,value:g.value||"",placeholder:r("form.fields.icon.placeholder")})}),e.jsx(z,{children:r("form.fields.icon.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:f.control,name:"notify_domain",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.notify_domain.label")}),e.jsx(_,{children:e.jsx(k,{...g,value:g.value||"",placeholder:r("form.fields.notify_domain.placeholder")})}),e.jsx(z,{children:r("form.fields.notify_domain.description")}),e.jsx(T,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(b,{control:f.control,name:"handling_fee_percent",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.handling_fee_percent.label")}),e.jsx(_,{children:e.jsx(k,{type:"number",...g,value:g.value||"",placeholder:r("form.fields.handling_fee_percent.placeholder")})}),e.jsx(T,{})]})}),e.jsx(b,{control:f.control,name:"handling_fee_fixed",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.handling_fee_fixed.label")}),e.jsx(_,{children:e.jsx(k,{type:"number",...g,value:g.value||"",placeholder:r("form.fields.handling_fee_fixed.placeholder")})}),e.jsx(T,{})]})})]}),e.jsx(b,{control:f.control,name:"payment",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.payment.label")}),e.jsxs(X,{onValueChange:g.onChange,defaultValue:g.value,children:[e.jsx(_,{children:e.jsx(Q,{children:e.jsx(ee,{placeholder:r("form.fields.payment.placeholder")})})}),e.jsx(J,{children:i.map(S=>e.jsx(U,{value:S,children:S},S))})]}),e.jsx(z,{children:r("form.fields.payment.description")}),e.jsx(T,{})]})}),p.length>0&&e.jsx("div",{className:"space-y-4",children:p.map(g=>e.jsx(b,{control:f.control,name:`config.${g.field_name}`,render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{children:g.label}),e.jsx(_,{children:e.jsx(k,{...S,value:S.value||""})}),e.jsx(T,{})]})},g.field_name))}),e.jsxs(Ae,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(D,{type:"button",variant:"outline",children:r("form.buttons.cancel")})}),e.jsx(D,{type:"submit",disabled:m,children:r("form.buttons.submit")})]})]})})]})]})}function L({column:s,title:n,tooltip:a,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(D,{variant:"ghost",size:"default",className:N("-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:n}),a&&e.jsx(pe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(Ya,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(ce,{children:a})]})}),s.getIsSorted()==="asc"?e.jsx(ha,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(fa,{className:"h-4 w-4 text-foreground/70"}):e.jsx(bo,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-foreground/70"})]})})}):e.jsxs("div",{className:N("flex items-center space-x-1 text-nowrap py-2 font-medium text-muted-foreground",l),children:[e.jsx("span",{children:n}),a&&e.jsx(pe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx(Ya,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(ce,{children:a})]})})]})}const Fa=yo,Hr=No,mu=_o,Kr=u.forwardRef(({className:s,...n},a)=>e.jsx(nr,{className:N("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:a}));Kr.displayName=nr.displayName;const Wt=u.forwardRef(({className:s,...n},a)=>e.jsxs(mu,{children:[e.jsx(Kr,{}),e.jsx(rr,{ref:a,className:N("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})]}));Wt.displayName=rr.displayName;const Yt=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-2 text-center sm:text-left",s),...n});Yt.displayName="AlertDialogHeader";const Qt=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Qt.displayName="AlertDialogFooter";const Jt=u.forwardRef(({className:s,...n},a)=>e.jsx(lr,{ref:a,className:N("text-lg font-semibold",s),...n}));Jt.displayName=lr.displayName;const Zt=u.forwardRef(({className:s,...n},a)=>e.jsx(ir,{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Zt.displayName=ir.displayName;const Xt=u.forwardRef(({className:s,...n},a)=>e.jsx(or,{ref:a,className:N(Js(),s),...n}));Xt.displayName=or.displayName;const ea=u.forwardRef(({className:s,...n},a)=>e.jsx(cr,{ref:a,className:N(Js({variant:"outline"}),"mt-2 sm:mt-0",s),...n}));ea.displayName=cr.displayName;function Be({onConfirm:s,children:n,title:a="确认操作",description:l="确定要执行此操作吗?",cancelText:r="取消",confirmText:c="确认",variant:o="default",className:m}){return e.jsxs(Fa,{children:[e.jsx(Hr,{asChild:!0,children:n}),e.jsxs(Wt,{className:N("sm:max-w-[425px]",m),children:[e.jsxs(Yt,{children:[e.jsx(Jt,{children:a}),e.jsx(Zt,{children:l})]}),e.jsxs(Qt,{children:[e.jsx(ea,{asChild:!0,children:e.jsx(D,{variant:"outline",children:r})}),e.jsx(Xt,{asChild:!0,children:e.jsx(D,{variant:o,onClick:s,children:c})})]})]})]})}const 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:"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"})}),uu=({refetch:s,isSortMode:n=!1})=>{const{t:a}=M("payment");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(Ut,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(L,{column:l,title:a("table.columns.id")}),cell:({row:l})=>e.jsx(K,{variant:"outline",children:l.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:l})=>e.jsx(L,{column:l,title:a("table.columns.enable")}),cell:({row:l})=>e.jsx(W,{defaultChecked:l.getValue("enable"),onCheckedChange:async()=>{const{data:r}=await hd({id:l.original.id});r||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:l})=>e.jsx(L,{column:l,title:a("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(L,{column:l,title:a("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(L,{column:l,title:a("table.columns.notify_url")}),e.jsx(pe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{className:"ml-1",children:e.jsx(Br,{className:"h-4 w-4"})}),e.jsx(ce,{children:a("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(L,{className:"justify-end",column:l,title:a("table.columns.actions")}),cell:({row:l})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Ur,{refetch:s,dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{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:l.original}),e.jsx(Be,{title:a("table.actions.delete.title"),description:a("table.actions.delete.description"),onConfirm:async()=>{const{data:r}=await xd({id:l.original.id});r&&s()},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:a("table.actions.delete.title")})]})})]}),size:100}]};function xu({table:s,refetch:n,saveOrder:a,isSortMode:l}){const{t:r}=M("payment"),c=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:r("table.toolbar.sort.hint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ur,{refetch:n}),e.jsx(k,{placeholder:r("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:o=>s.getColumn("name")?.setFilterValue(o.target.value),className:"h-8 w-[250px]"}),c&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[r("table.toolbar.reset"),e.jsx(Ye,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(D,{variant:l?"default":"outline",onClick:a,size:"sm",children:r(l?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}function hu(){const[s,n]=u.useState([]),[a,l]=u.useState([]),[r,c]=u.useState(!1),[o,m]=u.useState([]),[x,i]=u.useState({"drag-handle":!1}),[d,p]=u.useState({pageSize:20,pageIndex:0}),{refetch:C}=ie({queryKey:["paymentList"],queryFn:async()=>{const{data:g}=await cd();return m(g?.map(S=>({...S,enable:!!S.enable}))||[]),g}});u.useEffect(()=>{i({"drag-handle":r,actions:!r}),p({pageSize:r?99999:10,pageIndex:0})},[r]);const P=(g,S)=>{r&&(g.dataTransfer.setData("text/plain",S.toString()),g.currentTarget.classList.add("opacity-50"))},f=(g,S)=>{if(!r)return;g.preventDefault(),g.currentTarget.classList.remove("bg-muted");const R=parseInt(g.dataTransfer.getData("text/plain"));if(R===S)return;const E=[...o],[O]=E.splice(R,1);E.splice(S,0,O),m(E)},j=async()=>{r?fd({ids:o.map(g=>g.id)}).then(()=>{C(),c(!1),$.success("排序保存成功")}):c(!0)},w=Ze({data:o,columns:uu({refetch:C,isSortMode:r}),state:{sorting:a,columnFilters:s,columnVisibility:x,pagination:d},onSortingChange:l,onColumnFiltersChange:n,onColumnVisibilityChange:i,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),getSortedRowModel:is(),initialState:{columnPinning:{right:["actions"]}},pageCount:r?1:void 0});return e.jsx(cs,{table:w,toolbar:g=>e.jsx(xu,{table:g,refetch:C,saveOrder:j,isSortMode:r}),draggable:r,onDragStart:P,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:f,showPagination:!r})}function fu(){const{t:s}=M("payment");return e.jsxs(Pe,{children:[e.jsxs(Ee,{className:"flex items-center justify-between",children:[e.jsx($e,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(hu,{})})]})]})}const pu=Object.freeze(Object.defineProperty({__proto__:null,default:fu},Symbol.toStringTag,{value:"Module"}));function gu({pluginName:s,onClose:n,onSuccess:a}){const{t:l}=M("plugin"),[r,c]=u.useState(!0),[o,m]=u.useState(!1),[x,i]=u.useState(null),d=wo({config:Co(So())}),p=je({resolver:Ne(d),defaultValues:{config:{}}});u.useEffect(()=>{(async()=>{try{const{data:j}=await gs.getPluginConfig(s);i(j),p.reset({config:Object.fromEntries(Object.entries(j).map(([w,g])=>[w,g.value]))})}catch{$.error(l("messages.configLoadError"))}finally{c(!1)}})()},[s]);const C=async f=>{m(!0);try{await gs.updatePluginConfig(s,f.config),$.success(l("messages.configSaveSuccess")),a()}catch{$.error(l("messages.configSaveError"))}finally{m(!1)}},P=(f,j)=>{switch(j.type){case"string":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{children:j.label||j.description}),e.jsx(_,{children:e.jsx(k,{placeholder:j.placeholder,...w})}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description}),e.jsx(T,{})]})},f);case"number":case"percentage":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{children:j.label||j.description}),e.jsx(_,{children:e.jsxs("div",{className:"relative",children:[e.jsx(k,{type:"number",placeholder:j.placeholder,...w,onChange:g=>{const S=Number(g.target.value);j.type==="percentage"?w.onChange(Math.min(100,Math.max(0,S))):w.onChange(S)},className:j.type==="percentage"?"pr-8":"",min:j.type==="percentage"?0:void 0,max:j.type==="percentage"?100:void 0,step:j.type==="percentage"?1:void 0}),j.type==="percentage"&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(ko,{className:"h-4 w-4 text-muted-foreground"})})]})}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description}),e.jsx(T,{})]})},f);case"select":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{children:j.label||j.description}),e.jsxs(X,{onValueChange:w.onChange,defaultValue:w.value,children:[e.jsx(_,{children:e.jsx(Q,{children:e.jsx(ee,{placeholder:j.placeholder})})}),e.jsx(J,{children:j.options?.map(g=>e.jsx(U,{value:g.value,children:g.label},g.value))})]}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description}),e.jsx(T,{})]})},f);case"boolean":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:w})=>e.jsxs(v,{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(y,{className:"text-base",children:j.label||j.description}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description})]}),e.jsx(_,{children:e.jsx(W,{checked:w.value,onCheckedChange:w.onChange})})]})},f);case"text":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{children:j.label||j.description}),e.jsx(_,{children:e.jsx(fs,{placeholder:j.placeholder,...w})}),j.description&&j.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.description}),e.jsx(T,{})]})},f);default:return null}};return r?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(_e,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(C),className:"space-y-4",children:[x&&Object.entries(x).map(([f,j])=>P(f,j)),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(D,{type:"button",variant:"outline",onClick:n,disabled:o,children:l("config.cancel")}),e.jsx(D,{type:"submit",loading:o,disabled:o,children:l("config.save")})]})]})})}function ju(){const{t:s}=M("plugin"),[n,a]=u.useState(null),[l,r]=u.useState(!1),[c,o]=u.useState(null),[m,x]=u.useState(""),[i,d]=u.useState("all"),[p,C]=u.useState(!1),[P,f]=u.useState(!1),[j,w]=u.useState(!1),g=u.useRef(null),{data:S,isLoading:R,refetch:E}=ie({queryKey:["pluginList"],queryFn:async()=>{const{data:I}=await gs.getPluginList();return I}});S&&[...new Set(S.map(I=>I.category||"other"))];const O=S?.filter(I=>{const Y=I.name.toLowerCase().includes(m.toLowerCase())||I.description.toLowerCase().includes(m.toLowerCase())||I.code.toLowerCase().includes(m.toLowerCase()),ne=i==="all"||I.category===i;return Y&&ne}),q=async I=>{a(I),gs.installPlugin(I).then(()=>{$.success(s("messages.installSuccess")),E()}).catch(Y=>{$.error(Y.message||s("messages.installError"))}).finally(()=>{a(null)})},te=async I=>{a(I),gs.uninstallPlugin(I).then(()=>{$.success(s("messages.uninstallSuccess")),E()}).catch(Y=>{$.error(Y.message||s("messages.uninstallError"))}).finally(()=>{a(null)})},F=async(I,Y)=>{a(I),(Y?gs.disablePlugin:gs.enablePlugin)(I).then(()=>{$.success(s(Y?"messages.disableSuccess":"messages.enableSuccess")),E()}).catch(We=>{$.error(We.message||s(Y?"messages.disableError":"messages.enableError"))}).finally(()=>{a(null)})},se=I=>{S?.find(Y=>Y.code===I),o(I),r(!0)},qe=async I=>{if(!I.name.endsWith(".zip")){$.error(s("upload.error.format"));return}C(!0),gs.uploadPlugin(I).then(()=>{$.success(s("messages.uploadSuccess")),f(!1),E()}).catch(Y=>{$.error(Y.message||s("messages.uploadError"))}).finally(()=>{C(!1),g.current&&(g.current.value="")})},B=I=>{I.preventDefault(),I.stopPropagation(),I.type==="dragenter"||I.type==="dragover"?w(!0):I.type==="dragleave"&&w(!1)},ae=I=>{I.preventDefault(),I.stopPropagation(),w(!1),I.dataTransfer.files&&I.dataTransfer.files[0]&&qe(I.dataTransfer.files[0])},A=async I=>{a(I),gs.deletePlugin(I).then(()=>{$.success(s("messages.deleteSuccess")),E()}).catch(Y=>{$.error(Y.message||s("messages.deleteError"))}).finally(()=>{a(null)})};return e.jsxs(Pe,{children:[e.jsxs(Ee,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Sa,{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(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(On,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(k,{placeholder:s("search.placeholder"),value:m,onChange:I=>x(I.target.value),className:"pl-9"})]}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs(D,{onClick:()=>f(!0),variant:"outline",className:"shrink-0",size:"sm",children:[e.jsx(ut,{className:"mr-2 h-4 w-4"}),s("upload.button")]})})]}),e.jsxs(Ra,{defaultValue:"all",className:"w-full",children:[e.jsxs(Gt,{children:[e.jsx(Es,{value:"all",children:s("tabs.all")}),e.jsx(Es,{value:"installed",children:s("tabs.installed")}),e.jsx(Es,{value:"available",children:s("tabs.available")})]}),e.jsx(Tt,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:R?e.jsxs(e.Fragment,{children:[e.jsx(ia,{}),e.jsx(ia,{}),e.jsx(ia,{})]}):O?.map(I=>e.jsx(la,{plugin:I,onInstall:q,onUninstall:te,onToggleEnable:F,onOpenConfig:se,onDelete:A,isLoading:n===I.name},I.name))})}),e.jsx(Tt,{value:"installed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:O?.filter(I=>I.is_installed).map(I=>e.jsx(la,{plugin:I,onInstall:q,onUninstall:te,onToggleEnable:F,onOpenConfig:se,onDelete:A,isLoading:n===I.name},I.name))})}),e.jsx(Tt,{value:"available",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:O?.filter(I=>!I.is_installed).map(I=>e.jsx(la,{plugin:I,onInstall:q,onUninstall:te,onToggleEnable:F,onOpenConfig:se,onDelete:A,isLoading:n===I.name},I.code))})})]})]}),e.jsx(be,{open:l,onOpenChange:r,children:e.jsxs(ge,{className:"sm:max-w-lg",children:[e.jsxs(we,{children:[e.jsxs(ye,{children:[S?.find(I=>I.code===c)?.name," ",s("config.title")]}),e.jsx(De,{children:s("config.description")})]}),c&&e.jsx(gu,{pluginName:c,onClose:()=>r(!1),onSuccess:()=>{r(!1),E()}})]})}),e.jsx(be,{open:P,onOpenChange:f,children:e.jsxs(ge,{className:"sm:max-w-md",children:[e.jsxs(we,{children:[e.jsx(ye,{children:s("upload.title")}),e.jsx(De,{children:s("upload.description")})]}),e.jsxs("div",{className:N("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",j&&"border-primary/50 bg-muted/50"),onDragEnter:B,onDragLeave:B,onDragOver:B,onDrop:ae,children:[e.jsx("input",{type:"file",ref:g,className:"hidden",accept:".zip",onChange:I=>{const Y=I.target.files?.[0];Y&&qe(Y)}}),p?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(ut,{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 la({plugin:s,onInstall:n,onUninstall:a,onToggleEnable:l,onOpenConfig:r,onDelete:c,isLoading:o}){const{t:m}=M("plugin");return e.jsxs(He,{className:"group relative overflow-hidden transition-all hover:shadow-md",children:[e.jsxs(Qe,{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(vs,{children:s.name}),s.is_installed&&e.jsx(K,{variant:s.is_enabled?"success":"secondary",children:s.is_enabled?m("status.enabled"):m("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(Sa,{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(Qs,{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:[m("author"),": ",s.author]})})]})})]}),e.jsx(Je,{children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.is_installed?e.jsxs(e.Fragment,{children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>r(s.code),disabled:!s.is_enabled||o,children:[e.jsx(To,{className:"mr-2 h-4 w-4"}),m("button.config")]}),e.jsxs(D,{variant:s.is_enabled?"destructive":"default",size:"sm",onClick:()=>l(s.code,s.is_enabled),disabled:o,children:[e.jsx(Do,{className:"mr-2 h-4 w-4"}),s.is_enabled?m("button.disable"):m("button.enable")]}),e.jsx(Be,{title:m("uninstall.title"),description:m("uninstall.description"),cancelText:m("common:cancel"),confirmText:m("uninstall.button"),variant:"destructive",onConfirm:()=>a(s.code),children:e.jsxs(D,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",disabled:o,children:[e.jsx(ns,{className:"mr-2 h-4 w-4"}),m("button.uninstall")]})})]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{onClick:()=>n(s.code),disabled:o,loading:o,children:m("button.install")}),e.jsx(Be,{title:m("delete.title"),description:m("delete.description"),cancelText:m("common:cancel"),confirmText:m("delete.button"),variant:"destructive",onConfirm:()=>c(s.code),children:e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",disabled:o,children:e.jsx(ns,{className:"h-4 w-4"})})})]})})})]})}function ia(){return e.jsxs(He,{children:[e.jsxs(Qe,{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(Je,{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 vu=Object.freeze(Object.defineProperty({__proto__:null,default:ju},Symbol.toStringTag,{value:"Module"})),bu=(s,n)=>{let a=null;switch(s.field_type){case"input":a=e.jsx(k,{placeholder:s.placeholder,...n});break;case"textarea":a=e.jsx(fs,{placeholder:s.placeholder,...n});break;case"select":a=e.jsx("select",{className:N(Js({variant:"outline"}),"w-full appearance-none font-normal"),...n,children:s.select_options&&Object.keys(s.select_options).map(l=>e.jsx("option",{value:l,children:s.select_options?.[l]},l))});break;default:a=null;break}return a};function yu({themeKey:s,themeInfo:n}){const{t:a}=M("theme"),[l,r]=u.useState(!1),[c,o]=u.useState(!1),[m,x]=u.useState(!1),i=je({defaultValues:n.configs.reduce((C,P)=>(C[P.field_name]="",C),{})}),d=async()=>{o(!0),Yc(s).then(({data:C})=>{Object.entries(C).forEach(([P,f])=>{i.setValue(P,f)})}).finally(()=>{o(!1)})},p=async C=>{x(!0),Qc(s,C).then(()=>{$.success(a("config.success")),r(!1)}).finally(()=>{x(!1)})};return e.jsxs(be,{open:l,onOpenChange:C=>{r(C),C?d():i.reset()},children:[e.jsx(Ge,{asChild:!0,children:e.jsx(D,{variant:"outline",children:a("card.configureTheme")})}),e.jsxs(ge,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(we,{children:[e.jsx(ye,{children:a("config.title",{name:n.name})}),e.jsx(De,{children:a("config.description")})]}),c?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(Ta,{className:"h-6 w-6 animate-spin"})}):e.jsx(_e,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(p),className:"space-y-4",children:[n.configs.map(C=>e.jsx(b,{control:i.control,name:C.field_name,render:({field:P})=>e.jsxs(v,{children:[e.jsx(y,{children:C.label}),e.jsx(_,{children:bu(C,P)}),e.jsx(T,{})]})},C.field_name)),e.jsxs(Ae,{className:"mt-6 gap-2",children:[e.jsx(D,{type:"button",variant:"secondary",onClick:()=>r(!1),children:a("config.cancel")}),e.jsx(D,{type:"submit",loading:m,children:a("config.save")})]})]})})]})]})}function Nu(){const{t:s}=M("theme"),[n,a]=u.useState(null),[l,r]=u.useState(!1),[c,o]=u.useState(!1),[m,x]=u.useState(!1),[i,d]=u.useState(null),p=u.useRef(null),[C,P]=u.useState(0),{data:f,isLoading:j,refetch:w}=ie({queryKey:["themeList"],queryFn:async()=>{const{data:F}=await Wc();return F}}),g=async F=>{a(F),Xc({frontend_theme:F}).then(()=>{$.success("主题切换成功"),w()}).finally(()=>{a(null)})},S=async F=>{if(!F.name.endsWith(".zip")){$.error(s("upload.error.format"));return}r(!0),Jc(F).then(()=>{$.success("主题上传成功"),o(!1),w()}).finally(()=>{r(!1),p.current&&(p.current.value="")})},R=F=>{F.preventDefault(),F.stopPropagation(),F.type==="dragenter"||F.type==="dragover"?x(!0):F.type==="dragleave"&&x(!1)},E=F=>{F.preventDefault(),F.stopPropagation(),x(!1),F.dataTransfer.files&&F.dataTransfer.files[0]&&S(F.dataTransfer.files[0])},O=()=>{i&&P(F=>F===0?i.images.length-1:F-1)},q=()=>{i&&P(F=>F===i.images.length-1?0:F+1)},te=(F,se)=>{P(0),d({name:F,images:se})};return e.jsxs(Pe,{children:[e.jsxs(Ee,{className:"flex items-center justify-between",children:[e.jsx($e,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(D,{onClick:()=>o(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(ut,{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:j?e.jsxs(e.Fragment,{children:[e.jsx(on,{}),e.jsx(on,{})]}):f?.themes&&Object.entries(f.themes).map(([F,se])=>e.jsx(He,{className:"group relative overflow-hidden transition-all hover:shadow-md",style:{backgroundImage:se.background_url?`url(${se.background_url})`:"none",backgroundSize:"cover",backgroundPosition:"center"},children:e.jsxs("div",{className:N("relative z-10 h-full transition-colors",se.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:[!!se.can_delete&&e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(Be,{title:s("card.delete.title"),description:s("card.delete.description"),confirmText:s("card.delete.button"),variant:"destructive",onConfirm:async()=>{if(F===f?.active){$.error(s("card.delete.error.active"));return}a(F),Zc(F).then(()=>{$.success("主题删除成功"),w()}).finally(()=>{a(null)})},children:e.jsx(D,{disabled:n===F,loading:n===F,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(ns,{className:"h-4 w-4"})})})}),e.jsxs(Qe,{children:[e.jsx(vs,{children:se.name}),e.jsx(Qs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{children:se.description}),se.version&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("card.version",{version:se.version})})]})})]}),e.jsxs(Je,{className:"flex items-center justify-end space-x-3",children:[se.images&&Array.isArray(se.images)&&se.images.length>0&&e.jsx(D,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>te(se.name,se.images),children:e.jsx(Po,{className:"h-4 w-4"})}),e.jsx(yu,{themeKey:F,themeInfo:se}),e.jsx(D,{onClick:()=>g(F),disabled:n===F||F===f.active,loading:n===F,variant:F===f.active?"secondary":"default",children:F===f.active?s("card.currentTheme"):s("card.activateTheme")})]})]})},F))}),e.jsx(be,{open:c,onOpenChange:o,children:e.jsxs(ge,{className:"sm:max-w-md",children:[e.jsxs(we,{children:[e.jsx(ye,{children:s("upload.title")}),e.jsx(De,{children:s("upload.description")})]}),e.jsxs("div",{className:N("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",m&&"border-primary/50 bg-muted/50"),onDragEnter:R,onDragLeave:R,onDragOver:R,onDrop:E,children:[e.jsx("input",{type:"file",ref:p,className:"hidden",accept:".zip",onChange:F=>{const se=F.target.files?.[0];se&&S(se)}}),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(ut,{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")})]})]})})]})]})}),e.jsx(be,{open:!!i,onOpenChange:F=>{F||(d(null),P(0))},children:e.jsxs(ge,{className:"max-w-4xl",children:[e.jsxs(we,{children:[e.jsxs(ye,{children:[i?.name," ",s("preview.title")]}),e.jsx(De,{className:"text-center",children:i&&s("preview.imageCount",{current:C+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[C]&&e.jsx("img",{src:i.images[C],alt:`${i.name} 预览图 ${C+1}`,className:"h-full w-full object-contain"})}),i&&i.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(D,{variant:"outline",size:"icon",className:"absolute left-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:O,children:e.jsx(Eo,{className:"h-4 w-4"})}),e.jsx(D,{variant:"outline",size:"icon",className:"absolute right-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:q,children:e.jsx(Ro,{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((F,se)=>e.jsx("button",{onClick:()=>P(se),className:N("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",C===se?"border-primary":"border-transparent"),children:e.jsx("img",{src:F,alt:`缩略图 ${se+1}`,className:"h-full w-full object-cover"})},se))})]})})]})]})}function on(){return e.jsxs(He,{children:[e.jsxs(Qe,{children:[e.jsx(oe,{className:"h-6 w-[200px]"}),e.jsx(oe,{className:"h-4 w-[300px]"})]}),e.jsxs(Je,{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 _u=Object.freeze(Object.defineProperty({__proto__:null,default:Nu},Symbol.toStringTag,{value:"Module"})),za=u.forwardRef(({className:s,value:n,onChange:a,...l},r)=>{const[c,o]=u.useState("");u.useEffect(()=>{if(c.includes(",")){const x=new Set([...n,...c.split(",").map(i=>i.trim())]);a(Array.from(x)),o("")}},[c,a,n]);const m=()=>{if(c){const x=new Set([...n,c]);a(Array.from(x)),o("")}};return e.jsxs("div",{className:N(" 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(x=>e.jsxs(K,{variant:"secondary",children:[x,e.jsx(G,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{a(n.filter(i=>i!==x))},children:e.jsx(pa,{className:"w-3"})})]},x)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:c,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"||x.key===","?(x.preventDefault(),m()):x.key==="Backspace"&&c.length===0&&n.length>0&&(x.preventDefault(),a(n.slice(0,-1)))},...l,ref:r})]})});za.displayName="InputTags";const wu=h.object({id:h.number().nullable(),title:h.string().min(1).max(250),content:h.string().min(1),show:h.boolean(),tags:h.array(h.string()),img_url:h.string().nullable()}),Cu={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function Gr({refetch:s,dialogTrigger:n,type:a="add",defaultFormValues:l=Cu}){const{t:r}=M("notice"),[c,o]=u.useState(!1),m=je({resolver:Ne(wu),defaultValues:l,mode:"onChange",shouldFocusError:!0}),x=new Da({html:!0});return e.jsx(_e,{...m,children:e.jsxs(be,{onOpenChange:o,open:c,children:[e.jsx(Ge,{asChild:!0,children:n||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Re,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add.button")})]})}),e.jsxs(ge,{className:"sm:max-w-[1025px]",children:[e.jsxs(we,{children:[e.jsx(ye,{children:r(a==="add"?"form.add.title":"form.edit.title")}),e.jsx(De,{})]}),e.jsx(b,{control:m.control,name:"title",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.title.label")}),e.jsx("div",{className:"relative ",children:e.jsx(_,{children:e.jsx(k,{placeholder:r("form.fields.title.placeholder"),...i})})}),e.jsx(T,{})]})}),e.jsx(b,{control:m.control,name:"content",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.content.label")}),e.jsx(_,{children:e.jsx(Pa,{style:{height:"500px"},value:i.value,renderHTML:d=>x.render(d),onChange:({text:d})=>{i.onChange(d)}})}),e.jsx(T,{})]})}),e.jsx(b,{control:m.control,name:"img_url",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.img_url.label")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(k,{type:"text",placeholder:r("form.fields.img_url.placeholder"),...i,value:i.value||""})})}),e.jsx(T,{})]})}),e.jsx(b,{control:m.control,name:"show",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.show.label")}),e.jsx("div",{className:"relative py-2",children:e.jsx(_,{children:e.jsx(W,{checked:i.value,onCheckedChange:i.onChange})})}),e.jsx(T,{})]})}),e.jsx(b,{control:m.control,name:"tags",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.tags.label")}),e.jsx(_,{children:e.jsx(za,{value:i.value,onChange:i.onChange,placeholder:r("form.fields.tags.placeholder"),className:"w-full"})}),e.jsx(T,{})]})}),e.jsxs(Ae,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(D,{type:"button",variant:"outline",children:r("form.buttons.cancel")})}),e.jsx(D,{type:"submit",onClick:i=>{i.preventDefault(),m.handleSubmit(async d=>{pd(d).then(({data:p})=>{p&&($.success(r("form.buttons.success")),s(),o(!1))})})()},children:r("form.buttons.submit")})]})]})]})})}function Su({table:s,refetch:n,saveOrder:a,isSortMode:l}){const{t:r}=M("notice"),c=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(Gr,{refetch:n}),!l&&e.jsx(k,{placeholder:r("table.toolbar.search"),value:s.getColumn("title")?.getFilterValue()??"",onChange:o=>s.getColumn("title")?.setFilterValue(o.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),c&&!l&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:[r("table.toolbar.reset"),e.jsx(Ye,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(D,{variant:l?"default":"outline",onClick:a,className:"h-8",size:"sm",children:r(l?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}const ku=s=>{const{t:n}=M("notice");return[{id:"drag-handle",header:"",cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Io,{className:"h-4 w-4 text-muted-foreground cursor-move"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.id")}),cell:({row:a})=>e.jsx(K,{variant:"outline",className:"font-mono",children:a.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.show")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(W,{defaultChecked:a.getValue("show"),onCheckedChange:async()=>{const{data:l}=await jd({id:a.original.id});l||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.title")}),cell:({row:a})=>e.jsx("div",{className:"flex max-w-[500px] items-center",children:e.jsx("span",{className:"truncate font-medium",children:a.getValue("title")})}),enableSorting:!1,size:6e3},{id:"actions",header:({column:a})=>e.jsx(L,{className:"justify-end",column:a,title:n("table.columns.actions")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Gr,{refetch:s,dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{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:a.original}),e.jsx(Be,{title:n("table.actions.delete.title"),description:n("table.actions.delete.description"),onConfirm:async()=>{gd({id:a.original.id}).then(()=>{$.success(n("table.actions.delete.success")),s()})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{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 Tu(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,c]=u.useState([]),[o,m]=u.useState([]),[x,i]=u.useState(!1),[d,p]=u.useState({}),[C,P]=u.useState({pageSize:50,pageIndex:0}),[f,j]=u.useState([]),{refetch:w}=ie({queryKey:["notices"],queryFn:async()=>{const{data:O}=await nn.getList();return j(O),O}});u.useEffect(()=>{l({"drag-handle":x,content:!x,created_at:!x,actions:!x}),P({pageSize:x?99999:50,pageIndex:0})},[x]);const g=(O,q)=>{x&&(O.dataTransfer.setData("text/plain",q.toString()),O.currentTarget.classList.add("opacity-50"))},S=(O,q)=>{if(!x)return;O.preventDefault(),O.currentTarget.classList.remove("bg-muted");const te=parseInt(O.dataTransfer.getData("text/plain"));if(te===q)return;const F=[...f],[se]=F.splice(te,1);F.splice(q,0,se),j(F)},R=async()=>{if(!x){i(!0);return}nn.sort(f.map(O=>O.id)).then(()=>{$.success("排序保存成功"),i(!1),w()}).finally(()=>{i(!1)})},E=Ze({data:f??[],columns:ku(w),state:{sorting:o,columnVisibility:a,rowSelection:s,columnFilters:r,columnSizing:d,pagination:C},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,onColumnSizingChange:p,onPaginationChange:P,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),getSortedRowModel:is(),getFacetedRowModel:_s(),getFacetedUniqueValues:ws(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(cs,{table:E,toolbar:O=>e.jsx(Su,{table:O,refetch:w,saveOrder:R,isSortMode:x}),draggable:x,onDragStart:g,onDragEnd:O=>O.currentTarget.classList.remove("opacity-50"),onDragOver:O=>{O.preventDefault(),O.currentTarget.classList.add("bg-muted")},onDragLeave:O=>O.currentTarget.classList.remove("bg-muted"),onDrop:S,showPagination:!x})})}function Du(){const{t:s}=M("notice");return e.jsxs(Pe,{children:[e.jsxs(Ee,{className:"flex items-center justify-between",children:[e.jsx($e,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(Tu,{})})]})]})}const Pu=Object.freeze(Object.defineProperty({__proto__:null,default:Du},Symbol.toStringTag,{value:"Module"})),Eu=h.object({id:h.number().nullable(),language:h.string().max(250),category:h.string().max(250),title:h.string().min(1).max(250),body:h.string().min(1),show:h.boolean()}),Ru={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function Wr({refreshData:s,dialogTrigger:n,type:a="add",defaultFormValues:l=Ru}){const{t:r}=M("knowledge"),[c,o]=u.useState(!1),m=je({resolver:Ne(Eu),defaultValues:l,mode:"onChange",shouldFocusError:!0}),x=new Da({html:!0});return u.useEffect(()=>{c&&l.id&&bd(l.id).then(({data:i})=>{m.reset(i)})},[l.id,m,c]),e.jsxs(be,{onOpenChange:o,open:c,children:[e.jsx(Ge,{asChild:!0,children:n||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Re,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add")})]})}),e.jsxs(ge,{className:"sm:max-w-[1025px]",children:[e.jsxs(we,{children:[e.jsx(ye,{children:r(a==="add"?"form.add":"form.edit")}),e.jsx(De,{})]}),e.jsxs(_e,{...m,children:[e.jsx(b,{control:m.control,name:"title",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.title")}),e.jsx("div",{className:"relative ",children:e.jsx(_,{children:e.jsx(k,{placeholder:r("form.titlePlaceholder"),...i})})}),e.jsx(T,{})]})}),e.jsx(b,{control:m.control,name:"category",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.category")}),e.jsx("div",{className:"relative ",children:e.jsx(_,{children:e.jsx(k,{placeholder:r("form.categoryPlaceholder"),...i})})}),e.jsx(T,{})]})}),e.jsx(b,{control:m.control,name:"language",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.language")}),e.jsx(_,{children:e.jsxs(X,{value:i.value,onValueChange:i.onChange,children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:r("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(U,{value:d.value,className:"cursor-pointer",children:r(`languages.${d.value}`)},d.value))})]})})]})}),e.jsx(b,{control:m.control,name:"body",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.content")}),e.jsx(_,{children:e.jsx(Pa,{style:{height:"500px"},value:i.value,renderHTML:d=>x.render(d),onChange:({text:d})=>{i.onChange(d)}})}),e.jsx(T,{})]})}),e.jsx(b,{control:m.control,name:"show",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.show")}),e.jsx("div",{className:"relative py-2",children:e.jsx(_,{children:e.jsx(W,{checked:i.value,onCheckedChange:i.onChange})})}),e.jsx(T,{})]})}),e.jsxs(Ae,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(D,{type:"button",variant:"outline",children:r("form.cancel")})}),e.jsx(D,{type:"submit",onClick:()=>{m.handleSubmit(i=>{yd(i).then(({data:d})=>{d&&(m.reset(),$.success(r("messages.operationSuccess")),o(!1),s())})})()},children:r("form.submit")})]})]})]})]})}function Iu({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(gt,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Se,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{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(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(c=>r.has(c.value)).map(c=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(os,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Is,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Vs,{children:[e.jsx(qs,{children:"No results found."}),e.jsx(Ke,{children:a.map(c=>{const o=r.has(c.value);return e.jsxs(Ie,{onSelect:()=>{o?r.delete(c.value):r.add(c.value);const m=Array.from(r);s?.setFilterValue(m.length?m:void 0)},children:[e.jsx("div",{className:N("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(zs,{className:N("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:c.label}),l?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(c.value)})]},c.value)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(st,{}),e.jsx(Ke,{children:e.jsx(Ie,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function Vu({table:s,refetch:n,saveOrder:a,isSortMode:l}){const r=s.getState().columnFilters.length>0,{t:c}=M("knowledge");return e.jsxs("div",{className:"flex items-center justify-between",children:[l?e.jsx("p",{className:"text-sm text-muted-foreground",children:c("toolbar.sortModeHint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wr,{refreshData:n}),e.jsx(k,{placeholder:c("toolbar.searchPlaceholder"),value:s.getColumn("title")?.getFilterValue()??"",onChange:o=>s.getColumn("title")?.setFilterValue(o.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(Iu,{column:s.getColumn("category"),title:c("columns.category"),options:Array.from(new Set(s.getCoreRowModel().rows.map(o=>o.getValue("category")))).map(o=>({label:o,value:o}))}),r&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[c("toolbar.reset"),e.jsx(Ye,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(D,{variant:l?"default":"outline",onClick:a,size:"sm",children:c(l?"toolbar.saveSort":"toolbar.editSort")})})]})}const Ou=({refetch:s,isSortMode:n=!1})=>{const{t:a}=M("knowledge");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(Ut,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx(K,{variant:"outline",className:"justify-center",children:l.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.status")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center",children:e.jsx(W,{defaultChecked:l.getValue("show"),onCheckedChange:async()=>{_d({id:l.original.id}).then(({data:r})=>{r||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:l})=>e.jsx(L,{column:l,title:a("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(L,{column:l,title:a("columns.category")}),cell:({row:l})=>e.jsx(K,{variant:"secondary",className:"max-w-[180px] truncate",children:l.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:l})=>e.jsx(L,{className:"justify-end",column:l,title:a("columns.actions")}),cell:({row:l})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx(Wr,{refreshData:s,dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:a("form.edit")})]}),type:"edit",defaultFormValues:l.original}),e.jsx(Be,{title:a("messages.deleteConfirm"),description:a("messages.deleteDescription"),confirmText:a("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{Nd({id:l.original.id}).then(({data:r})=>{r&&($.success(a("messages.operationSuccess")),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{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")})]})})]}),size:100}]};function Mu(){const[s,n]=u.useState([]),[a,l]=u.useState([]),[r,c]=u.useState(!1),[o,m]=u.useState([]),[x,i]=u.useState({"drag-handle":!1}),[d,p]=u.useState({pageSize:20,pageIndex:0}),{refetch:C,isLoading:P,data:f}=ie({queryKey:["knowledge"],queryFn:async()=>{const{data:R}=await vd();return m(R||[]),R}});u.useEffect(()=>{i({"drag-handle":r,actions:!r}),p({pageSize:r?99999:10,pageIndex:0})},[r]);const j=(R,E)=>{r&&(R.dataTransfer.setData("text/plain",E.toString()),R.currentTarget.classList.add("opacity-50"))},w=(R,E)=>{if(!r)return;R.preventDefault(),R.currentTarget.classList.remove("bg-muted");const O=parseInt(R.dataTransfer.getData("text/plain"));if(O===E)return;const q=[...o],[te]=q.splice(O,1);q.splice(E,0,te),m(q)},g=async()=>{r?wd({ids:o.map(R=>R.id)}).then(()=>{C(),c(!1),$.success("排序保存成功")}):c(!0)},S=Ze({data:o,columns:Ou({refetch:C,isSortMode:r}),state:{sorting:a,columnFilters:s,columnVisibility:x,pagination:d},onSortingChange:l,onColumnFiltersChange:n,onColumnVisibilityChange:i,onPaginationChange:p,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),getSortedRowModel:is(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(cs,{table:S,toolbar:R=>e.jsx(Vu,{table:R,refetch:C,saveOrder:g,isSortMode:r}),draggable:r,onDragStart:j,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:w,showPagination:!r})}function Fu(){const{t:s}=M("knowledge");return e.jsxs(Pe,{children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(Mu,{})})]})]})}const zu=Object.freeze(Object.defineProperty({__proto__:null,default:Fu},Symbol.toStringTag,{value:"Module"}));function Lu(s,n){const[a,l]=u.useState(s);return u.useEffect(()=>{const r=setTimeout(()=>l(s),n);return()=>{clearTimeout(r)}},[s,n]),a}function oa(s,n){if(s.length===0)return{};if(!n)return{"":s};const a={};return s.forEach(l=>{const r=l[n]||"";a[r]||(a[r]=[]),a[r].push(l)}),a}function Au(s,n){const a=JSON.parse(JSON.stringify(s));for(const[l,r]of Object.entries(a))a[l]=r.filter(c=>!n.find(o=>o.value===c.value));return a}function $u(s,n){for(const[,a]of Object.entries(s))if(a.some(l=>n.find(r=>r.value===l.value)))return!0;return!1}const Yr=u.forwardRef(({className:s,...n},a)=>Vo(r=>r.filtered.count===0)?e.jsx("div",{ref:a,className:N("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...n}):null);Yr.displayName="CommandEmpty";const ht=u.forwardRef(({value:s,onChange:n,placeholder:a,defaultOptions:l=[],options:r,delay:c,onSearch:o,loadingIndicator:m,emptyIndicator:x,maxSelected:i=Number.MAX_SAFE_INTEGER,onMaxSelected:d,hidePlaceholderWhenSelected:p,disabled:C,groupBy:P,className:f,badgeClassName:j,selectFirstItem:w=!0,creatable:g=!1,triggerSearchOnFocus:S=!1,commandProps:R,inputProps:E,hideClearAllButton:O=!1},q)=>{const te=u.useRef(null),[F,se]=u.useState(!1),qe=u.useRef(!1),[B,ae]=u.useState(!1),[A,I]=u.useState(s||[]),[Y,ne]=u.useState(oa(l,P)),[We,tt]=u.useState(""),at=Lu(We,c||500);u.useImperativeHandle(q,()=>({selectedValue:[...A],input:te.current,focus:()=>te.current?.focus()}),[A]);const bt=u.useCallback(Z=>{const de=A.filter(Le=>Le.value!==Z.value);I(de),n?.(de)},[n,A]),vl=u.useCallback(Z=>{const de=te.current;de&&((Z.key==="Delete"||Z.key==="Backspace")&&de.value===""&&A.length>0&&(A[A.length-1].fixed||bt(A[A.length-1])),Z.key==="Escape"&&de.blur())},[bt,A]);u.useEffect(()=>{s&&I(s)},[s]),u.useEffect(()=>{if(!r||o)return;const Z=oa(r||[],P);JSON.stringify(Z)!==JSON.stringify(Y)&&ne(Z)},[l,r,P,o,Y]),u.useEffect(()=>{const Z=async()=>{ae(!0);const Le=await o?.(at);ne(oa(Le||[],P)),ae(!1)};(async()=>{!o||!F||(S&&await Z(),at&&await Z())})()},[at,P,F,S]);const bl=()=>{if(!g||$u(Y,[{value:We,label:We}])||A.find(de=>de.value===We))return;const Z=e.jsx(Ie,{value:We,className:"cursor-pointer",onMouseDown:de=>{de.preventDefault(),de.stopPropagation()},onSelect:de=>{if(A.length>=i){d?.(A.length);return}tt("");const Le=[...A,{value:de,label:de}];I(Le),n?.(Le)},children:`Create "${We}"`});if(!o&&We.length>0||o&&at.length>0&&!B)return Z},yl=u.useCallback(()=>{if(x)return o&&!g&&Object.keys(Y).length===0?e.jsx(Ie,{value:"-",disabled:!0,children:x}):e.jsx(Yr,{children:x})},[g,x,o,Y]),Nl=u.useMemo(()=>Au(Y,A),[Y,A]),_l=u.useCallback(()=>{if(R?.filter)return R.filter;if(g)return(Z,de)=>Z.toLowerCase().includes(de.toLowerCase())?1:-1},[g,R?.filter]),wl=u.useCallback(()=>{const Z=A.filter(de=>de.fixed);I(Z),n?.(Z)},[n,A]);return e.jsxs(Is,{...R,onKeyDown:Z=>{vl(Z),R?.onKeyDown?.(Z)},className:N("h-auto overflow-visible bg-transparent",R?.className),shouldFilter:R?.shouldFilter!==void 0?R.shouldFilter:!o,filter:_l(),children:[e.jsx("div",{className:N("rounded-md border border-input text-sm ring-offset-background focus-within:ring-1 focus-within:ring-ring ",{"px-3 py-2":A.length!==0,"cursor-text":!C&&A.length!==0},f),onClick:()=>{C||te.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[A.map(Z=>e.jsxs(K,{className:N("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",j),"data-fixed":Z.fixed,"data-disabled":C||void 0,children:[Z.label,e.jsx("button",{className:N("ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",(C||Z.fixed)&&"hidden"),onKeyDown:de=>{de.key==="Enter"&&bt(Z)},onMouseDown:de=>{de.preventDefault(),de.stopPropagation()},onClick:()=>bt(Z),children:e.jsx(pa,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},Z.value)),e.jsx(Me.Input,{...E,ref:te,value:We,disabled:C,onValueChange:Z=>{tt(Z),E?.onValueChange?.(Z)},onBlur:Z=>{qe.current===!1&&se(!1),E?.onBlur?.(Z)},onFocus:Z=>{se(!0),S&&o?.(at),E?.onFocus?.(Z)},placeholder:p&&A.length!==0?"":a,className:N("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":p,"px-3 py-2":A.length===0,"ml-1":A.length!==0},E?.className)}),e.jsx("button",{type:"button",onClick:wl,className:N((O||C||A.length<1||A.filter(Z=>Z.fixed).length===A.length)&&"hidden"),children:e.jsx(pa,{})})]})}),e.jsx("div",{className:"relative",children:F&&e.jsx(Vs,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{qe.current=!1},onMouseEnter:()=>{qe.current=!0},onMouseUp:()=>{te.current?.focus()},children:B?e.jsx(e.Fragment,{children:m}):e.jsxs(e.Fragment,{children:[yl(),bl(),!w&&e.jsx(Ie,{value:"-",className:"hidden"}),Object.entries(Nl).map(([Z,de])=>e.jsx(Ke,{heading:Z,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:de.map(Le=>e.jsx(Ie,{value:Le.value,disabled:Le.disable,onMouseDown:nt=>{nt.preventDefault(),nt.stopPropagation()},onSelect:()=>{if(A.length>=i){d?.(A.length);return}tt("");const nt=[...A,Le];I(nt),n?.(nt)},className:N("cursor-pointer",Le.disable&&"cursor-default text-muted-foreground"),children:Le.label},Le.value))})},Z))]})})})]})});ht.displayName="MultipleSelector";const qu=s=>h.object({id:h.number().optional(),name:h.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 sa({refetch:s,dialogTrigger:n,defaultValues:a={name:""},type:l="add"}){const{t:r}=M("group"),c=je({resolver:Ne(qu(r)),defaultValues:a,mode:"onChange"}),[o,m]=u.useState(!1),[x,i]=u.useState(!1),d=async p=>{i(!0),rd(p).then(()=>{$.success(r(l==="edit"?"messages.updateSuccess":"messages.createSuccess")),s&&s(),c.reset(),m(!1)}).finally(()=>{i(!1)})};return e.jsxs(be,{open:o,onOpenChange:m,children:[e.jsx(Ge,{asChild:!0,children:n||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Re,{icon:"ion:add"}),e.jsx("span",{children:r("form.add")})]})}),e.jsxs(ge,{className:"sm:max-w-[425px]",children:[e.jsxs(we,{children:[e.jsx(ye,{children:r(l==="edit"?"form.edit":"form.create")}),e.jsx(De,{children:r(l==="edit"?"form.editDescription":"form.createDescription")})]}),e.jsx(_e,{...c,children:e.jsxs("form",{onSubmit:c.handleSubmit(d),className:"space-y-4",children:[e.jsx(b,{control:c.control,name:"name",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.name")}),e.jsx(_,{children:e.jsx(k,{placeholder:r("form.namePlaceholder"),...p,className:"w-full"})}),e.jsx(z,{children:r("form.nameDescription")}),e.jsx(T,{})]})}),e.jsxs(Ae,{className:"gap-2",children:[e.jsx(jt,{asChild:!0,children:e.jsx(D,{type:"button",variant:"outline",children:r("form.cancel")})}),e.jsxs(D,{type:"submit",disabled:x||!c.formState.isValid,children:[x&&e.jsx(Ta,{className:"mr-2 h-4 w-4 animate-spin"}),r(l==="edit"?"form.update":"form.create")]})]})]})})]})]})}const Qr=u.createContext(void 0);function Uu({children:s,refetch:n}){const[a,l]=u.useState(!1),[r,c]=u.useState(null),[o,m]=u.useState(ke.Shadowsocks);return e.jsx(Qr.Provider,{value:{isOpen:a,setIsOpen:l,editingServer:r,setEditingServer:c,serverType:o,setServerType:m,refetch:n},children:s})}function Jr(){const s=u.useContext(Qr);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function ca({dialogTrigger:s,value:n,setValue:a,templateType:l}){const{t:r}=M("server");u.useEffect(()=>{console.log(n)},[n]);const[c,o]=u.useState(!1),[m,x]=u.useState(()=>{if(!n||Object.keys(n).length===0)return"";try{return JSON.stringify(n,null,2)}catch{return""}}),[i,d]=u.useState(null),p=g=>{if(!g)return null;try{const S=JSON.parse(g);return typeof S!="object"||S===null?r("network_settings.validation.must_be_object"):null}catch{return r("network_settings.validation.invalid_json")}},C={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"}}}},P=()=>{switch(l){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];default:return[]}},f=()=>{const g=p(m||"");if(g){$.error(g);return}try{if(!m){a(null),o(!1);return}a(JSON.parse(m)),o(!1)}catch{$.error(r("network_settings.errors.save_failed"))}},j=g=>{x(g),d(p(g))},w=g=>{const S=C[g];if(S){const R=JSON.stringify(S.content,null,2);x(R),d(null)}};return u.useEffect(()=>{c&&console.log(n)},[c,n]),u.useEffect(()=>{c&&n&&Object.keys(n).length>0&&x(JSON.stringify(n,null,2))},[c,n]),e.jsxs(be,{open:c,onOpenChange:g=>{!g&&c&&f(),o(g)},children:[e.jsx(Ge,{asChild:!0,children:s??e.jsx(G,{variant:"link",children:r("network_settings.edit_protocol")})}),e.jsxs(ge,{className:"sm:max-w-[425px]",children:[e.jsx(we,{children:e.jsx(ye,{children:r("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(g=>e.jsx(G,{variant:"outline",size:"sm",onClick:()=>w(g),children:r("network_settings.use_template",{template:C[g].label})},g))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(fs,{className:`min-h-[200px] font-mono text-sm ${i?"border-red-500 focus-visible:ring-red-500":""}`,value:m,placeholder:P().length>0?r("network_settings.json_config_placeholder_with_template"):r("network_settings.json_config_placeholder"),onChange:g=>j(g.target.value)}),i&&e.jsx("p",{className:"text-sm text-red-500",children:i})]})]}),e.jsxs(Ae,{className:"gap-2",children:[e.jsx(G,{variant:"outline",onClick:()=>o(!1),children:r("common.cancel")}),e.jsx(G,{onClick:f,disabled:!!i,children:r("common.confirm")})]})]})]})}function ef(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 Hu={},Ku=Object.freeze(Object.defineProperty({__proto__:null,default:Hu},Symbol.toStringTag,{value:"Module"})),sf=Wo(Ku),cn=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Bu=()=>{try{const s=Oo.box.keyPair(),n=cn(Qa.encodeBase64(s.secretKey)),a=cn(Qa.encodeBase64(s.publicKey));return{privateKey:n,publicKey:a}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},Gu=()=>{try{return Bu()}catch(s){throw console.error("Error generating key pair:",s),s}},Wu=s=>{const n=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(n),Array.from(n).map(a=>a.toString(16).padStart(2,"0")).join("").substring(0,s)},Yu=()=>{const s=Math.floor(Math.random()*8)*2+2;return Wu(s)},Qu=h.object({cipher:h.string().default("aes-128-gcm"),obfs:h.string().default("0"),obfs_settings:h.object({path:h.string().default(""),host:h.string().default("")}).default({})}),Ju=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({})}),Zu=h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({})}),Xu=h.object({version:h.coerce.number().default(2),alpn:h.string().default("h2"),obfs:h.object({open:h.coerce.boolean().default(!1),type:h.string().default("salamander"),password:h.string().default("")}).default({}),tls:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),bandwidth:h.object({up:h.string().default(""),down:h.string().default("")}).default({})}),ex=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),reality_settings:h.object({server_port:h.coerce.number().default(443),server_name:h.string().default(""),allow_insecure:h.boolean().default(!1),public_key:h.string().default(""),private_key:h.string().default(""),short_id:h.string().default("")}).default({}),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({}),flow:h.string().default("")}),ps={shadowsocks:{schema:Qu,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"]},vmess:{schema:Ju,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:Zu,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Xu,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:ex,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"]}},sx=({serverType:s,value:n,onChange:a})=>{const{t:l}=M("server"),r=s?ps[s]:null,c=r?.schema||h.record(h.any()),o=s?c.parse({}):{},m=je({resolver:Ne(c),defaultValues:o,mode:"onChange"});if(u.useEffect(()=>{if(!n||Object.keys(n).length===0){if(s){const f=c.parse({});m.reset(f)}}else m.reset(n)},[s,n,a,m,c]),u.useEffect(()=>{const f=m.watch(j=>{a(j)});return()=>f.unsubscribe()},[m,a]),!s||!r)return null;const P={shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(b,{control:m.control,name:"cipher",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.shadowsocks.cipher.label")}),e.jsx(_,{children:e.jsxs(X,{onValueChange:f.onChange,value:f.value,children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.shadowsocks.cipher.placeholder")})}),e.jsx(J,{children:e.jsx(ks,{children:ps.shadowsocks.ciphers.map(j=>e.jsx(U,{value:j,children:j},j))})})]})})]})}),e.jsx(b,{control:m.control,name:"obfs",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.shadowsocks.obfs.label")}),e.jsx(_,{children:e.jsxs(X,{onValueChange:f.onChange,value:f.value,children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.shadowsocks.obfs.placeholder")})}),e.jsx(J,{children:e.jsxs(ks,{children:[e.jsx(U,{value:"0",children:l("dynamic_form.shadowsocks.obfs.none")}),e.jsx(U,{value:"http",children:l("dynamic_form.shadowsocks.obfs.http")})]})})]})})]})}),m.watch("obfs")==="http"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"obfs_settings.path",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(_,{children:e.jsx(k,{type:"text",placeholder:l("dynamic_form.shadowsocks.obfs_settings.path"),...f})}),e.jsx(T,{})]})}),e.jsx(b,{control:m.control,name:"obfs_settings.host",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(_,{children:e.jsx(k,{type:"text",placeholder:l("dynamic_form.shadowsocks.obfs_settings.host"),...f})}),e.jsx(T,{})]})})]})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(b,{control:m.control,name:"tls",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vmess.tls.label")}),e.jsx(_,{children:e.jsxs(X,{value:f.value?.toString(),onValueChange:j=>f.onChange(Number(j)),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.vmess.tls.placeholder")})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:l("dynamic_form.vmess.tls.disabled")}),e.jsx(U,{value:"1",children:l("dynamic_form.vmess.tls.enabled")})]})]})})]})}),m.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"tls_settings.server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.vmess.tls_settings.server_name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:l("dynamic_form.vmess.tls_settings.server_name.placeholder"),...f})})]})}),e.jsx(b,{control:m.control,name:"tls_settings.allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vmess.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(W,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),e.jsx(b,{control:m.control,name:"network",render:({field:f})=>e.jsxs(v,{children:[e.jsxs(y,{children:[l("dynamic_form.vmess.network.label"),e.jsx(ca,{value:m.watch("network_settings"),setValue:j=>m.setValue("network_settings",j),templateType:m.watch("network")})]}),e.jsx(_,{children:e.jsxs(X,{onValueChange:f.onChange,value:f.value,children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.vmess.network.placeholder")})}),e.jsx(J,{children:e.jsx(ks,{children:ps.vmess.networkOptions.map(j=>e.jsx(U,{value:j.value,className:"cursor-pointer",children:j.label},j.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.trojan.server_name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:l("dynamic_form.trojan.server_name.placeholder"),...f,value:f.value||""})})]})}),e.jsx(b,{control:m.control,name:"allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.trojan.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(W,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})})]}),e.jsx(b,{control:m.control,name:"network",render:({field:f})=>e.jsxs(v,{children:[e.jsxs(y,{children:[l("dynamic_form.trojan.network.label"),e.jsx(ca,{value:m.watch("network_settings")||{},setValue:j=>m.setValue("network_settings",j),templateType:m.watch("network")||"tcp"})]}),e.jsx(_,{children:e.jsxs(X,{onValueChange:f.onChange,value:f.value||"tcp",children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.trojan.network.placeholder")})}),e.jsx(J,{children:e.jsx(ks,{children:ps.trojan.networkOptions.map(j=>e.jsx(U,{value:j.value,className:"cursor-pointer",children:j.label},j.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"version",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:l("dynamic_form.hysteria.version.label")}),e.jsx(_,{children:e.jsxs(X,{value:(f.value||2).toString(),onValueChange:j=>f.onChange(Number(j)),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.hysteria.version.placeholder")})}),e.jsx(J,{children:e.jsx(ks,{children:ps.hysteria.versions.map(j=>e.jsxs(U,{value:j,className:"cursor-pointer",children:["V",j]},j))})})]})})]})}),m.watch("version")==1&&e.jsx(b,{control:m.control,name:"alpn",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.hysteria.alpn.label")}),e.jsx(_,{children:e.jsxs(X,{value:f.value||"h2",onValueChange:f.onChange,children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.hysteria.alpn.placeholder")})}),e.jsx(J,{children:e.jsx(ks,{children:ps.hysteria.alpnOptions.map(j=>e.jsx(U,{value:j,children:j},j))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"obfs.open",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.hysteria.obfs.label")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(W,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})}),!!m.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[m.watch("version")=="2"&&e.jsx(b,{control:m.control,name:"obfs.type",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:l("dynamic_form.hysteria.obfs.type.label")}),e.jsx(_,{children:e.jsxs(X,{value:f.value||"salamander",onValueChange:f.onChange,children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.hysteria.obfs.type.placeholder")})}),e.jsx(J,{children:e.jsx(ks,{children:e.jsx(U,{value:"salamander",children:l("dynamic_form.hysteria.obfs.type.salamander")})})})]})})]})}),e.jsx(b,{control:m.control,name:"obfs.password",render:({field:f})=>e.jsxs(v,{className:m.watch("version")==2?"w-full":"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.hysteria.obfs.password.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(_,{children:e.jsx(k,{placeholder:l("dynamic_form.hysteria.obfs.password.placeholder"),...f,value:f.value||"",className:"pr-9"})}),e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",w=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(g=>j[g%j.length]).join("");m.setValue("obfs.password",w),$.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(Re,{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(b,{control:m.control,name:"tls.server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.hysteria.tls.server_name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:l("dynamic_form.hysteria.tls.server_name.placeholder"),...f,value:f.value||""})})]})}),e.jsx(b,{control:m.control,name:"tls.allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.hysteria.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(W,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})})]}),e.jsx(b,{control:m.control,name:"bandwidth.up",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.hysteria.bandwidth.up.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(k,{type:"number",placeholder:l("dynamic_form.hysteria.bandwidth.up.placeholder")+(m.watch("version")==2?l("dynamic_form.hysteria.bandwidth.up.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...f,value:f.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(b,{control:m.control,name:"bandwidth.down",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.hysteria.bandwidth.down.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(k,{type:"number",placeholder:l("dynamic_form.hysteria.bandwidth.down.placeholder")+(m.watch("version")==2?l("dynamic_form.hysteria.bandwidth.down.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...f,value:f.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")})})]})]})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(b,{control:m.control,name:"tls",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.tls.label")}),e.jsx(_,{children:e.jsxs(X,{value:f.value?.toString(),onValueChange:j=>f.onChange(Number(j)),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.vless.tls.placeholder")})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:l("dynamic_form.vless.tls.none")}),e.jsx(U,{value:"1",children:l("dynamic_form.vless.tls.tls")}),e.jsx(U,{value:"2",children:l("dynamic_form.vless.tls.reality")})]})]})})]})}),m.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"tls_settings.server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.vless.tls_settings.server_name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:l("dynamic_form.vless.tls_settings.server_name.placeholder"),...f})})]})}),e.jsx(b,{control:m.control,name:"tls_settings.allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(W,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),m.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:m.control,name:"reality_settings.server_name",render:({field:f})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.server_name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:l("dynamic_form.vless.reality_settings.server_name.placeholder"),...f})})]})}),e.jsx(b,{control:m.control,name:"reality_settings.server_port",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.server_port.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:l("dynamic_form.vless.reality_settings.server_port.placeholder"),...f})})]})}),e.jsx(b,{control:m.control,name:"reality_settings.allow_insecure",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(W,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx(b,{control:m.control,name:"reality_settings.private_key",render:({field:f})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.private_key.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(_,{children:e.jsx(k,{...f,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 j=Gu();m.setValue("reality_settings.private_key",j.privateKey),m.setValue("reality_settings.public_key",j.publicKey),$.success(l("dynamic_form.vless.reality_settings.key_pair.success"))}catch{$.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(Re,{icon:"ion:key-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(It,{children:e.jsx(ce,{children:e.jsx("p",{children:l("dynamic_form.vless.reality_settings.key_pair.generate")})})})]})]})]})})}),e.jsx(b,{control:m.control,name:"reality_settings.public_key",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.public_key.label")}),e.jsx(_,{children:e.jsx(k,{...f})})]})}),e.jsx(b,{control:m.control,name:"reality_settings.short_id",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.reality_settings.short_id.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(_,{children:e.jsx(k,{...f,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 j=Yu();m.setValue("reality_settings.short_id",j),$.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(Re,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(It,{children:e.jsx(ce,{children:e.jsx("p",{children:l("dynamic_form.vless.reality_settings.short_id.generate")})})})]})]}),e.jsx(z,{className:"text-xs text-muted-foreground",children:l("dynamic_form.vless.reality_settings.short_id.description")})]})})]}),e.jsx(b,{control:m.control,name:"network",render:({field:f})=>e.jsxs(v,{children:[e.jsxs(y,{children:[l("dynamic_form.vless.network.label"),e.jsx(ca,{value:m.watch("network_settings"),setValue:j=>m.setValue("network_settings",j),templateType:m.watch("network")})]}),e.jsx(_,{children:e.jsxs(X,{onValueChange:f.onChange,value:f.value,children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.vless.network.placeholder")})}),e.jsx(J,{children:e.jsx(ks,{children:ps.vless.networkOptions.map(j=>e.jsx(U,{value:j.value,className:"cursor-pointer",children:j.label},j.value))})})]})})]})}),e.jsx(b,{control:m.control,name:"flow",render:({field:f})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dynamic_form.vless.flow.label")}),e.jsx(_,{children:e.jsxs(X,{onValueChange:j=>f.onChange(j==="none"?null:j),value:f.value||"none",children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dynamic_form.vless.flow.placeholder")})}),e.jsx(J,{children:ps.vless.flowOptions.map(j=>e.jsx(U,{value:j,children:j},j))})]})})]})})]})};return e.jsx(pe,{children:P[s]?.()})},tx=h.object({id:h.number().optional().nullable(),code:h.string().optional(),name:h.string().min(1,"form.name.error"),rate:h.string().min(1,"form.rate.error"),tags:h.array(h.string()).default([]),excludes:h.array(h.string()).default([]),ips:h.array(h.string()).default([]),group_ids:h.array(h.string()).default([]),host:h.string().min(1,"form.host.error"),port:h.string().min(1,"form.port.error"),server_port:h.string().min(1,"form.server_port.error"),parent_id:h.string().default("0").nullable(),route_ids:h.array(h.string()).default([]),protocol_settings:h.record(h.any()).default({}).nullable()}),_t={id:null,code:"",name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null};function ax(){const{t:s}=M("server"),{isOpen:n,setIsOpen:a,editingServer:l,setEditingServer:r,serverType:c,setServerType:o,refetch:m}=Jr(),[x,i]=u.useState([]),[d,p]=u.useState([]),[C,P]=u.useState([]),f=je({resolver:Ne(tx),defaultValues:_t,mode:"onChange"});u.useEffect(()=>{j()},[n]),u.useEffect(()=>{l?.type&&l.type!==c&&o(l.type)},[l,c,o]),u.useEffect(()=>{l?l.type===c&&f.reset({..._t,...l}):f.reset({..._t,protocol_settings:ps[c].schema.parse({})})},[l,f,c]);const j=async()=>{if(!n)return;const[E,O,q]=await Promise.all([vt(),Lr(),zr()]);i(E.data?.map(te=>({label:te.name,value:te.id.toString()}))||[]),p(O.data?.map(te=>({label:te.remarks,value:te.id.toString()}))||[]),P(q.data||[])},w=u.useMemo(()=>C?.filter(E=>(E.parent_id===0||E.parent_id===null)&&E.type===c&&E.id!==f.watch("id")),[c,C,f]),g=()=>e.jsxs(bs,{children:[e.jsx(ys,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Re,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(us,{align:"start",children:e.jsx(Tc,{children:Ms.map(({type:E,label:O})=>e.jsx(fe,{onClick:()=>{o(E),a(!0)},className:"cursor-pointer",children:e.jsx(K,{variant:"outline",className:"text-white",style:{background:js[E]},children:O})},E))})})]}),S=()=>{a(!1),r(null),f.reset(_t)},R=async()=>{const E=f.getValues();(await ed({...E,type:c})).data&&(S(),$.success(s("form.success")),m())};return e.jsxs(be,{open:n,onOpenChange:S,children:[g(),e.jsxs(ge,{className:"sm:max-w-[425px]",children:[e.jsxs(we,{children:[e.jsx(ye,{children:s(l?"form.edit_node":"form.new_node")}),e.jsx(De,{})]}),e.jsxs(_e,{...f,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:f.control,name:"name",render:({field:E})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:s("form.name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("form.name.placeholder"),...E})}),e.jsx(T,{})]})}),e.jsx(b,{control:f.control,name:"rate",render:({field:E})=>e.jsxs(v,{className:"flex-[1]",children:[e.jsx(y,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(_,{children:e.jsx(k,{type:"number",min:"0",step:"0.1",...E})})}),e.jsx(T,{})]})})]}),e.jsx(b,{control:f.control,name:"code",render:({field:E})=>e.jsxs(v,{children:[e.jsxs(y,{children:[s("form.code.label"),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:s("form.code.optional")})]}),e.jsx(_,{children:e.jsx(k,{placeholder:s("form.code.placeholder"),...E,value:E.value||""})}),e.jsx(T,{})]})}),e.jsx(b,{control:f.control,name:"tags",render:({field:E})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.tags.label")}),e.jsx(_,{children:e.jsx(za,{value:E.value,onChange:E.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(T,{})]})}),e.jsx(b,{control:f.control,name:"group_ids",render:({field:E})=>e.jsxs(v,{children:[e.jsxs(y,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(sa,{dialogTrigger:e.jsx(D,{variant:"link",children:s("form.groups.add")}),refetch:j})]}),e.jsx(_,{children:e.jsx(ht,{options:x,onChange:O=>E.onChange(O.map(q=>q.value)),value:x?.filter(O=>E.value.includes(O.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(T,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:f.control,name:"host",render:({field:E})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.host.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("form.host.placeholder"),...E})}),e.jsx(T,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(b,{control:f.control,name:"port",render:({field:E})=>e.jsxs(v,{className:"flex-1",children:[e.jsxs(y,{className:"flex items-center gap-1.5",children:[s("form.port.label"),e.jsx(pe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(Re,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(It,{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(_,{children:e.jsx(k,{placeholder:s("form.port.placeholder"),...E})}),e.jsx(pe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(D,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const O=E.value;O&&f.setValue("server_port",O)},children:e.jsx(Re,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(ce,{side:"right",children:e.jsx("p",{children:s("form.port.sync")})})]})})]}),e.jsx(T,{})]})}),e.jsx(b,{control:f.control,name:"server_port",render:({field:E})=>e.jsxs(v,{className:"flex-1",children:[e.jsxs(y,{className:"flex items-center gap-1.5",children:[s("form.server_port.label"),e.jsx(pe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(Re,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(It,{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(_,{children:e.jsx(k,{placeholder:s("form.server_port.placeholder"),...E})}),e.jsx(T,{})]})})]})]}),n&&e.jsx(sx,{serverType:c,value:f.watch("protocol_settings"),onChange:E=>f.setValue("protocol_settings",E,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(b,{control:f.control,name:"parent_id",render:({field:E})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.parent.label")}),e.jsxs(X,{onValueChange:E.onChange,value:E.value?.toString()||"0",children:[e.jsx(_,{children:e.jsx(Q,{children:e.jsx(ee,{placeholder:s("form.parent.placeholder")})})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:s("form.parent.none")}),w?.map(O=>e.jsx(U,{value:O.id.toString(),className:"cursor-pointer",children:O.name},O.id))]})]}),e.jsx(T,{})]})}),e.jsx(b,{control:f.control,name:"route_ids",render:({field:E})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.route.label")}),e.jsx(_,{children:e.jsx(ht,{options:d,onChange:O=>E.onChange(O.map(q=>q.value)),value:d?.filter(O=>E.value.includes(O.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(T,{})]})})]}),e.jsxs(Ae,{className:"mt-6",children:[e.jsx(D,{type:"button",variant:"outline",onClick:S,children:s("form.cancel")}),e.jsx(D,{type:"submit",onClick:R,children:s("form.submit")})]})]})]})]})}function dn({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(gt,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Se,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{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(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(c=>r.has(c.value)).map(c=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(os,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Is,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Vs,{children:[e.jsx(qs,{children:"No results found."}),e.jsx(Ke,{children:a.map(c=>{const o=r.has(c.value);return e.jsxs(Ie,{onSelect:()=>{o?r.delete(c.value):r.add(c.value);const m=Array.from(r);s?.setFilterValue(m.length?m:void 0)},className:"cursor-pointer",children:[e.jsx("div",{className:N("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(zs,{className:N("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${c.color}`}),e.jsx("span",{children:c.label}),l?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(c.value)})]},c.value)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(st,{}),e.jsx(Ke,{children:e.jsx(Ie,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const nx=[{value:ke.Shadowsocks,label:Ms.find(s=>s.type===ke.Shadowsocks)?.label,color:js[ke.Shadowsocks]},{value:ke.Vmess,label:Ms.find(s=>s.type===ke.Vmess)?.label,color:js[ke.Vmess]},{value:ke.Trojan,label:Ms.find(s=>s.type===ke.Trojan)?.label,color:js[ke.Trojan]},{value:ke.Hysteria,label:Ms.find(s=>s.type===ke.Hysteria)?.label,color:js[ke.Hysteria]},{value:ke.Vless,label:Ms.find(s=>s.type===ke.Vless)?.label,color:js[ke.Vless]}];function rx({table:s,saveOrder:n,isSortMode:a,groups:l}){const r=s.getState().columnFilters.length>0,{t:c}=M("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:[!a&&e.jsxs(e.Fragment,{children:[e.jsx(ax,{}),e.jsx(k,{placeholder:c("toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:o=>s.getColumn("name")?.setFilterValue(o.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(dn,{column:s.getColumn("type"),title:c("toolbar.type"),options:nx}),s.getColumn("group_ids")&&e.jsx(dn,{column:s.getColumn("group_ids"),title:c("columns.groups.title"),options:l.map(o=>({label:o.name,value:o.id.toString()}))})]}),r&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[c("toolbar.reset"),e.jsx(Ye,{className:"ml-2 h-4 w-4"})]})]}),a&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:c("toolbar.sort.tip")})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(D,{variant:a?"default":"outline",onClick:n,size:"sm",children:c(a?"toolbar.sort.save":"toolbar.sort.edit")})})]})}const ft=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"})}),wt={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"},lx=s=>{const{t:n}=M("server");return[{id:"drag-handle",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.sort")}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Ut,{className:"size-4 cursor-move text-muted-foreground transition-colors hover:text-primary","aria-hidden":"true"})}),size:50},{accessorKey:"id",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.nodeId")}),cell:({row:a})=>{const l=a.getValue("id"),r=a.original.code;return e.jsx(pe,{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(K,{variant:"outline",className:N("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:js[a.original.type]},children:[e.jsx(dr,{className:"size-3"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"flex items-center gap-0.5",children:r??l}),a.original.parent?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground/30",children:"→"}),e.jsx("span",{children:a.original.parent?.code||a.original.parent?.id})]}):""]})]}),e.jsx(D,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:text-muted-foreground group-hover/id:opacity-100",onClick:c=>{c.stopPropagation(),Mt(r||l.toString()).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(Ja,{className:"size-3"})})]})}),e.jsxs(ce,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[Ms.find(c=>c.type===a.original.type)?.label,a.original.parent_id?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:200,enableSorting:!0},{accessorKey:"show",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.show")}),cell:({row:a})=>{const[l,r]=u.useState(!!a.getValue("show"));return e.jsx(W,{checked:l,onCheckedChange:async c=>{r(c),ad({id:a.original.id,type:a.original.type,show:c?1:0}).catch(()=>{r(!c),s()})},style:{backgroundColor:l?js[a.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(L,{column:a,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:N("h-2.5 w-2.5 rounded-full",wt[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:N("h-2.5 w-2.5 rounded-full",wt[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:N("h-2.5 w-2.5 rounded-full",wt[2])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.2")})]})]})})}),cell:({row:a})=>e.jsx(pe,{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:N("size-2.5 flex-shrink-0 rounded-full transition-all duration-200",wt[a.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:a.getValue("name")})]})}),e.jsx(ce,{children:e.jsx("p",{className:"font-medium",children:n(`columns.status.${a.original.available_status}`)})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.address")}),cell:({row:a})=>{const l=`${a.original.host}:${a.original.port}`,r=a.original.port!==a.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:[a.original.host,":",a.original.port]})}),r&&e.jsxs("span",{className:"whitespace-nowrap text-[0.7rem] tracking-tight text-muted-foreground/40",children:["(",n("columns.internalPort")," ",a.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(pe,{delayDuration:0,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(D,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:bg-muted/50 hover:text-muted-foreground group-hover:opacity-100",onClick:c=>{c.stopPropagation(),Mt(l).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(Ja,{className:"size-3"})})}),e.jsx(ce,{side:"top",sideOffset:10,children:n("columns.copyAddress")})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.onlineUsers.title"),tooltip:n("columns.onlineUsers.tooltip")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(ft,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:a.getValue("online")})]}),size:80,enableSorting:!0,enableHiding:!0},{accessorKey:"rate",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.rate.title"),tooltip:n("columns.rate.tooltip")}),cell:({row:a})=>e.jsxs(K,{variant:"secondary",className:"font-medium",children:[a.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"group_ids",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.groups.title"),tooltip:n("columns.groups.tooltip")}),cell:({row:a})=>{const l=a.original.groups||[];return e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map((r,c)=>e.jsx(K,{variant:"secondary",className:N("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:r.name},c)),l.length===0&&e.jsx("span",{className:"text-sm text-muted-foreground",children:n("columns.groups.empty")})]})},enableSorting:!1,filterFn:(a,l,r)=>{const c=a.getValue(l);return c?r.some(o=>c.includes(o)):!1}},{accessorKey:"type",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.type")}),cell:({row:a})=>{const l=a.getValue("type");return e.jsx(K,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:js[l]},children:l})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:a})=>e.jsx(L,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>{const{setIsOpen:l,setEditingServer:r,setServerType:c}=Jr();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(bs,{modal:!1,children:[e.jsx(ys,{asChild:!0,children:e.jsx(D,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":n("columns.actions"),children:e.jsx(Vt,{className:"size-4"})})}),e.jsxs(us,{align:"end",className:"w-40",children:[e.jsx(fe,{className:"cursor-pointer",onClick:()=>{c(a.original.type),r(a.original),l(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(Mo,{className:"mr-2 size-4"}),n("columns.actions_dropdown.edit")]})}),e.jsxs(fe,{className:"cursor-pointer",onClick:async()=>{td({id:a.original.id}).then(({data:o})=>{o&&($.success(n("columns.actions_dropdown.copy_success")),s())})},children:[e.jsx(Fo,{className:"mr-2 size-4"}),n("columns.actions_dropdown.copy")]}),e.jsx(Zs,{}),e.jsx(fe,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:o=>o.preventDefault(),children:e.jsx(Be,{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()=>{sd({id:a.original.id}).then(({data:o})=>{o&&($.success(n("columns.actions_dropdown.delete_success")),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(ns,{className:"mr-2 size-4"}),n("columns.actions_dropdown.delete.confirm")]})})})]})]})})},size:50}]};function ix(){const[s,n]=u.useState({}),[a,l]=u.useState({"drag-handle":!1}),[r,c]=u.useState([]),[o,m]=u.useState({pageSize:500,pageIndex:0}),[x,i]=u.useState([]),[d,p]=u.useState(!1),[C,P]=u.useState({}),[f,j]=u.useState([]),{refetch:w}=ie({queryKey:["nodeList"],queryFn:async()=>{const{data:q}=await zr();return j(q),q}}),{data:g}=ie({queryKey:["groups"],queryFn:async()=>{const{data:q}=await vt();return q}});u.useEffect(()=>{l({"drag-handle":d,show:!d,host:!d,online:!d,rate:!d,groups:!d,type:!1,actions:!d}),P({name:d?2e3:200}),m({pageSize:d?99999:500,pageIndex:0})},[d]);const S=(q,te)=>{d&&(q.dataTransfer.setData("text/plain",te.toString()),q.currentTarget.classList.add("opacity-50"))},R=(q,te)=>{if(!d)return;q.preventDefault(),q.currentTarget.classList.remove("bg-muted");const F=parseInt(q.dataTransfer.getData("text/plain"));if(F===te)return;const se=[...f],[qe]=se.splice(F,1);se.splice(te,0,qe),j(se)},E=async()=>{if(!d){p(!0);return}const q=f?.map((te,F)=>({id:te.id,order:F+1}));nd(q).then(()=>{$.success("排序保存成功"),p(!1),w()}).finally(()=>{p(!1)})},O=Ze({data:f||[],columns:lx(w),state:{sorting:x,columnVisibility:a,rowSelection:s,columnFilters:r,columnSizing:C,pagination:o},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:i,onColumnFiltersChange:c,onColumnVisibilityChange:l,onColumnSizingChange:P,onPaginationChange:m,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),getSortedRowModel:is(),getFacetedRowModel:_s(),getFacetedUniqueValues:ws(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Uu,{refetch:w,children:e.jsx("div",{className:"space-y-4",children:e.jsx(cs,{table:O,toolbar:q=>e.jsx(rx,{table:q,refetch:w,saveOrder:E,isSortMode:d,groups:g||[]}),draggable:d,onDragStart:S,onDragEnd:q=>q.currentTarget.classList.remove("opacity-50"),onDragOver:q=>{q.preventDefault(),q.currentTarget.classList.add("bg-muted")},onDragLeave:q=>q.currentTarget.classList.remove("bg-muted"),onDrop:R,showPagination:!d})})})}function ox(){const{t:s}=M("server");return e.jsxs(Pe,{children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(ix,{})})]})]})}const cx=Object.freeze(Object.defineProperty({__proto__:null,default:ox},Symbol.toStringTag,{value:"Module"}));function dx({table:s,refetch:n}){const a=s.getState().columnFilters.length>0,{t:l}=M("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(sa,{refetch:n}),e.jsx(k,{placeholder:l("toolbar.searchPlaceholder"),value:s.getColumn("name")?.getFilterValue()??"",onChange:r=>s.getColumn("name")?.setFilterValue(r.target.value),className:N("h-8 w-[150px] lg:w-[250px]",a&&"border-primary/50 ring-primary/20")}),a&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(Ye,{className:"ml-2 h-4 w-4"})]})]})})}const mx=s=>{const{t:n}=M("group");return[{accessorKey:"id",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.id")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(K,{variant:"outline",children:a.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.name")}),cell:({row:a})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium",children:a.getValue("name")})})},{accessorKey:"users_count",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.usersCount")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(ft,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:a.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"server_count",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.serverCount")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(dr,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:a.getValue("server_count")})]}),enableSorting:!0,size:8e3},{id:"actions",header:({column:a})=>e.jsx(L,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(sa,{defaultValues:a.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(Be,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{ld({id:a.original.id}).then(({data:l})=>{l&&($.success(n("messages.updateSuccess")),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{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 ux(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,c]=u.useState([]),[o,m]=u.useState([]),{data:x,refetch:i,isLoading:d}=ie({queryKey:["serverGroupList"],queryFn:async()=>{const{data:C}=await vt();return C}}),p=Ze({data:x||[],columns:mx(i),state:{sorting:o,columnVisibility:a,rowSelection:s,columnFilters:r},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),getSortedRowModel:is(),getFacetedRowModel:_s(),getFacetedUniqueValues:ws(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(cs,{table:p,toolbar:C=>e.jsx(dx,{table:C,refetch:i}),isLoading:d})}function xx(){const{t:s}=M("group");return e.jsxs(Pe,{children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(ux,{})})]})]})}const hx=Object.freeze(Object.defineProperty({__proto__:null,default:xx},Symbol.toStringTag,{value:"Module"})),fx=s=>h.object({remarks:h.string().min(1,s("form.validation.remarks")),match:h.array(h.string()),action:h.enum(["block","dns"]),action_value:h.string().optional()});function Zr({refetch:s,dialogTrigger:n,defaultValues:a={remarks:"",match:[],action:"block",action_value:""},type:l="add"}){const{t:r}=M("route"),c=je({resolver:Ne(fx(r)),defaultValues:a,mode:"onChange"}),[o,m]=u.useState(!1);return e.jsxs(be,{open:o,onOpenChange:m,children:[e.jsx(Ge,{asChild:!0,children:n||e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Re,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add")})]})}),e.jsxs(ge,{className:"sm:max-w-[425px]",children:[e.jsxs(we,{children:[e.jsx(ye,{children:r(l==="edit"?"form.edit":"form.create")}),e.jsx(De,{})]}),e.jsxs(_e,{...c,children:[e.jsx(b,{control:c.control,name:"remarks",render:({field:x})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:r("form.remarks")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(k,{type:"text",placeholder:r("form.remarksPlaceholder"),...x})})}),e.jsx(T,{})]})}),e.jsx(b,{control:c.control,name:"match",render:({field:x})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:r("form.match")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(fs,{className:"min-h-[120px]",placeholder:r("form.matchPlaceholder"),value:x.value.join(` +`),onChange:i=>{x.onChange(i.target.value.split(` +`))}})})}),e.jsx(T,{})]})}),e.jsx(b,{control:c.control,name:"action",render:({field:x})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsxs(X,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:r("form.actionPlaceholder")})}),e.jsxs(J,{children:[e.jsx(U,{value:"block",children:r("actions.block")}),e.jsx(U,{value:"dns",children:r("actions.dns")})]})]})})}),e.jsx(T,{})]})}),c.watch("action")==="dns"&&e.jsx(b,{control:c.control,name:"action_value",render:({field:x})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(k,{type:"text",placeholder:r("form.dnsPlaceholder"),...x})})})]})}),e.jsxs(Ae,{children:[e.jsx(jt,{asChild:!0,children:e.jsx(D,{variant:"outline",children:r("form.cancel")})}),e.jsx(D,{type:"submit",onClick:()=>{id(c.getValues()).then(({data:x})=>{x&&(m(!1),s&&s(),toast.success(r(l==="edit"?"messages.updateSuccess":"messages.createSuccess")),c.reset())})},children:r("form.submit")})]})]})]})]})}function px({table:s,refetch:n}){const a=s.getState().columnFilters.length>0,{t:l}=M("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(Zr,{refetch:n}),e.jsx(k,{placeholder:l("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:r=>s.getColumn("remarks")?.setFilterValue(r.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),a&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(Ye,{className:"ml-2 h-4 w-4"})]})]})})}function gx({columns:s,data:n,refetch:a}){const[l,r]=u.useState({}),[c,o]=u.useState({}),[m,x]=u.useState([]),[i,d]=u.useState([]),p=Ze({data:n,columns:s,state:{sorting:i,columnVisibility:c,rowSelection:l,columnFilters:m},enableRowSelection:!0,onRowSelectionChange:r,onSortingChange:d,onColumnFiltersChange:x,onColumnVisibilityChange:o,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),getSortedRowModel:is(),getFacetedRowModel:_s(),getFacetedUniqueValues:ws(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(cs,{table:p,toolbar:C=>e.jsx(px,{table:C,refetch:a})})}const jx=s=>{const{t:n}=M("route"),a={block:{icon:zo,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:Lo,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(L,{column:l,title:n("columns.id")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(K,{variant:"outline",children:l.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:l})=>e.jsx(L,{column:l,title:n("columns.remarks")}),cell:({row:l})=>{const r=l.original.match?.length||0;return 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:n("columns.matchRules",{count:r})})})},enableHiding:!1,enableSorting:!1},{accessorKey:"action",header:({column:l})=>e.jsx(L,{column:l,title:n("columns.action")}),cell:({row:l})=>{const r=l.getValue("action"),c=a[r]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(K,{variant:a[r]?.variant||"default",className:N("flex items-center gap-1.5 px-3 py-1 capitalize",a[r]?.className),children:[c&&e.jsx(c,{className:"h-3.5 w-3.5"}),n(`actions.${r}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:n("columns.actions")}),cell:({row:l})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Zr,{defaultValues:l.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(Be,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{od({id:l.original.id}).then(({data:r})=>{r&&($.success(n("messages.deleteSuccess")),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{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 vx(){const{t:s}=M("route"),[n,a]=u.useState([]);function l(){Lr().then(({data:r})=>{a(r)})}return u.useEffect(()=>{l()},[]),e.jsxs(Pe,{children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(gx,{data:n,columns:jx(l),refetch:l})})]})]})}const bx=Object.freeze(Object.defineProperty({__proto__:null,default:vx},Symbol.toStringTag,{value:"Module"})),Xr=u.createContext(void 0);function yx({children:s,refreshData:n}){const[a,l]=u.useState(!1),[r,c]=u.useState(null);return e.jsx(Xr.Provider,{value:{isOpen:a,setIsOpen:l,editingPlan:r,setEditingPlan:c,refreshData:n},children:s})}function La(){const s=u.useContext(Xr);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function Nx({table:s,saveOrder:n,isSortMode:a}){const{setIsOpen:l}=La(),{t:r}=M("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(D,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>l(!0),children:[e.jsx(Re,{icon:"ion:add"}),e.jsx("div",{children:r("plan.add")})]}),e.jsx(k,{placeholder:r("plan.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:c=>s.getColumn("name")?.setFilterValue(c.target.value),className:"h-8 w-[150px] lg:w-[250px]"})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(D,{variant:a?"default":"outline",onClick:n,size:"sm",children:r(a?"plan.sort.save":"plan.sort.edit")})})]})}const mn={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"}},_x=s=>{const{t:n}=M("subscribe");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(Ut,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(L,{column:a,title:n("plan.columns.id")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(K,{variant:"outline",children:a.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:a})=>e.jsx(L,{column:a,title:n("plan.columns.show")}),cell:({row:a})=>e.jsx(W,{defaultChecked:a.getValue("show"),onCheckedChange:l=>{na({id:a.original.id,show:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:a})=>e.jsx(L,{column:a,title:n("plan.columns.sell")}),cell:({row:a})=>e.jsx(W,{defaultChecked:a.getValue("sell"),onCheckedChange:l=>{na({id:a.original.id,sell:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:a})=>e.jsx(L,{column:a,title:n("plan.columns.renew"),tooltip:n("plan.columns.renew_tooltip")}),cell:({row:a})=>e.jsx(W,{defaultChecked:a.getValue("renew"),onCheckedChange:l=>{na({id:a.original.id,renew:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:a})=>e.jsx(L,{column:a,title:n("plan.columns.name")}),cell:({row:a})=>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:a.getValue("name")})}),enableSorting:!1,enableHiding:!1,size:900},{accessorKey:"users_count",header:({column:a})=>e.jsx(L,{column:a,title:n("plan.columns.stats")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-2",children:[e.jsx(ft,{}),e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:a.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"group",header:({column:a})=>e.jsx(L,{column:a,title:n("plan.columns.group")}),cell:({row:a})=>e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center gap-1.5 text-nowrap",children:e.jsx(K,{variant:"secondary",className:N("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.getValue("group")?.name})}),enableSorting:!1,enableHiding:!1},{accessorKey:"prices",header:({column:a})=>e.jsx(L,{column:a,title:n("plan.columns.price")}),cell:({row:a})=>{const l=a.getValue("prices"),r=[{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:r.map(({period:c,key:o,unit:m})=>l[o]!=null&&e.jsxs(K,{variant:"secondary",className:N("px-2 py-0.5 font-medium transition-colors text-nowrap",mn[o].color,mn[o].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[c," ¥",l[o],m]},o))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:a})=>e.jsx(L,{className:"justify-end",column:a,title:n("plan.columns.actions")}),cell:({row:a})=>{const{setIsOpen:l,setEditingPlan:r}=La();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{r(a.original),l(!0)},children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.edit")})]}),e.jsx(Be,{title:n("plan.columns.delete_confirm.title"),description:n("plan.columns.delete_confirm.description"),confirmText:n("plan.columns.delete"),variant:"destructive",onConfirm:async()=>{Sd({id:a.original.id}).then(({data:c})=>{c&&($.success(n("plan.columns.delete_confirm.success")),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{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")})]})})]})}}]},wx=h.object({id:h.number().nullable(),group_id:h.union([h.number(),h.string()]).nullable().optional(),name:h.string().min(1).max(250),content:h.string().nullable().optional(),transfer_enable:h.union([h.number().min(0),h.string().min(1)]),prices:h.object({monthly:h.union([h.number(),h.string()]).nullable().optional(),quarterly:h.union([h.number(),h.string()]).nullable().optional(),half_yearly:h.union([h.number(),h.string()]).nullable().optional(),yearly:h.union([h.number(),h.string()]).nullable().optional(),two_yearly:h.union([h.number(),h.string()]).nullable().optional(),three_yearly:h.union([h.number(),h.string()]).nullable().optional(),onetime:h.union([h.number(),h.string()]).nullable().optional(),reset_traffic:h.union([h.number(),h.string()]).nullable().optional()}).default({}),speed_limit:h.union([h.number(),h.string()]).nullable().optional(),capacity_limit:h.union([h.number(),h.string()]).nullable().optional(),device_limit:h.union([h.number(),h.string()]).nullable().optional(),force_update:h.boolean().optional(),reset_traffic_method:h.number().nullable(),users_count:h.number().optional()}),el=u.forwardRef(({className:s,...n},a)=>e.jsx(mr,{ref:a,className:N("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(Ao,{className:N("flex items-center justify-center text-current"),children:e.jsx(zs,{className:"h-4 w-4"})})}));el.displayName=mr.displayName;const Ct={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},St={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}},Cx=[{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 Sx(){const{isOpen:s,setIsOpen:n,editingPlan:a,setEditingPlan:l,refreshData:r}=La(),[c,o]=u.useState(!1),{t:m}=M("subscribe"),x=je({resolver:Ne(wx),defaultValues:{...Ct,...a||{}},mode:"onChange"});u.useEffect(()=>{a?x.reset({...Ct,...a}):x.reset(Ct)},[a,x]);const i=new Da({html:!0}),[d,p]=u.useState();async function C(){vt().then(({data:j})=>{p(j)})}u.useEffect(()=>{s&&C()},[s]);const P=j=>{if(isNaN(j))return;const w=Object.entries(St).reduce((g,[S,R])=>{const E=j*R.months*R.discount;return{...g,[S]:E.toFixed(2)}},{});x.setValue("prices",w,{shouldDirty:!0})},f=()=>{n(!1),l(null),x.reset(Ct)};return e.jsx(be,{open:s,onOpenChange:f,children:e.jsxs(ge,{children:[e.jsxs(we,{children:[e.jsx(ye,{children:m(a?"plan.form.edit_title":"plan.form.add_title")}),e.jsx(De,{})]}),e.jsxs(_e,{...x,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:x.control,name:"name",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:m("plan.form.name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:m("plan.form.name.placeholder"),...j})}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"group_id",render:({field:j})=>e.jsxs(v,{children:[e.jsxs(y,{className:"flex items-center justify-between",children:[m("plan.form.group.label"),e.jsx(sa,{dialogTrigger:e.jsx(D,{variant:"link",children:m("plan.form.group.add")}),refetch:C})]}),e.jsxs(X,{value:j.value?.toString()??"",onValueChange:w=>j.onChange(w?Number(w):null),children:[e.jsx(_,{children:e.jsx(Q,{children:e.jsx(ee,{placeholder:m("plan.form.group.placeholder")})})}),e.jsx(J,{children:d?.map(w=>e.jsx(U,{value:w.id.toString(),children:w.name},w.id))})]}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"transfer_enable",render:({field:j})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:m("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(k,{type:"number",min:0,placeholder:m("plan.form.transfer.placeholder"),className:"rounded-r-none",...j})}),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:m("plan.form.transfer.unit")})]}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"speed_limit",render:({field:j})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:m("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(k,{type:"number",min:0,placeholder:m("plan.form.speed.placeholder"),className:"rounded-r-none",...j,value:j.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:m("plan.form.speed.unit")})]}),e.jsx(T,{})]})}),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:m("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(k,{type:"number",placeholder:m("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:j=>{const w=parseFloat(j.target.value);P(w)}})]}),e.jsx(pe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(D,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const j=Object.keys(St).reduce((w,g)=>({...w,[g]:""}),{});x.setValue("prices",j,{shouldDirty:!0})},children:m("plan.form.price.clear.button")})}),e.jsx(ce,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:m("plan.form.price.clear.tooltip")})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(St).filter(([j])=>!["onetime","reset_traffic"].includes(j)).map(([j,w])=>e.jsx("div",{className:"group relative rounded-md bg-card p-2 ring-1 ring-gray-200 transition-all hover:ring-primary dark:ring-gray-800",children:e.jsx(b,{control:x.control,name:`prices.${j}`,render:({field:g})=>e.jsxs(v,{children:[e.jsxs(y,{className:"text-xs font-medium text-muted-foreground",children:[m(`plan.columns.price_period.${j}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",w.months===1?m("plan.form.price.period.monthly"):m("plan.form.price.period.months",{count:w.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(_,{children:e.jsx(k,{type:"number",placeholder:"0.00",min:0,...g,value:g.value??"",onChange:S=>g.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"})})]})]})})},j))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(St).filter(([j])=>["onetime","reset_traffic"].includes(j)).map(([j,w])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(b,{control:x.control,name:`prices.${j}`,render:({field:g})=>e.jsx(v,{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(y,{className:"text-xs font-medium",children:m(`plan.columns.price_period.${j}`)}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:m(j==="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(_,{children:e.jsx(k,{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"})})]})]})})})},j))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(b,{control:x.control,name:"device_limit",render:({field:j})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:m("plan.form.device.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(k,{type:"number",min:0,placeholder:m("plan.form.device.placeholder"),className:"rounded-r-none",...j,value:j.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:m("plan.form.device.unit")})]}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"capacity_limit",render:({field:j})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:m("plan.form.capacity.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(k,{type:"number",min:0,placeholder:m("plan.form.capacity.placeholder"),className:"rounded-r-none",...j,value:j.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:m("plan.form.capacity.unit")})]}),e.jsx(T,{})]})})]}),e.jsx(b,{control:x.control,name:"reset_traffic_method",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:m("plan.form.reset_method.label")}),e.jsxs(X,{value:j.value?.toString()??"null",onValueChange:w=>j.onChange(w=="null"?null:Number(w)),children:[e.jsx(_,{children:e.jsx(Q,{children:e.jsx(ee,{placeholder:m("plan.form.reset_method.placeholder")})})}),e.jsx(J,{children:Cx.map(w=>e.jsx(U,{value:w.value?.toString()??"null",children:m(`plan.form.reset_method.options.${w.label}`)},w.value))})]}),e.jsx(z,{className:"text-xs",children:m("plan.form.reset_method.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:x.control,name:"content",render:({field:j})=>{const[w,g]=u.useState(!1);return e.jsxs(v,{className:"space-y-2",children:[e.jsxs(y,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[m("plan.form.content.label"),e.jsx(pe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(D,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>g(!w),children:w?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:m(w?"plan.form.content.preview_button.hide":"plan.form.content.preview_button.show")})})]})})]}),e.jsx(pe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(D,{variant:"outline",size:"sm",onClick:()=>{j.onChange(m("plan.form.content.template.content"))},children:m("plan.form.content.template.button")})}),e.jsx(ce,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:m("plan.form.content.template.tooltip")})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${w?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"}`,children:[e.jsx("div",{className:"space-y-2",children:e.jsx(_,{children:e.jsx(Pa,{style:{height:"400px"},value:j.value||"",renderHTML:S=>i.render(S),onChange:({text:S})=>j.onChange(S),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:m("plan.form.content.placeholder"),className:"rounded-md border"})})}),w&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:m("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(j.value||"")}})})]})]}),e.jsx(z,{className:"text-xs",children:m("plan.form.content.description")}),e.jsx(T,{})]})}})]}),e.jsx(Ae,{className:"mt-6",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("div",{className:"flex-shrink-0",children:a&&e.jsx(b,{control:x.control,name:"force_update",render:({field:j})=>e.jsxs(v,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(_,{children:e.jsx(el,{checked:j.value,onCheckedChange:j.onChange})}),e.jsx("div",{className:"",children:e.jsx(y,{className:"text-sm",children:m("plan.form.force_update.label")})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(D,{type:"button",variant:"outline",onClick:f,children:m("plan.form.submit.cancel")}),e.jsx(D,{type:"submit",disabled:c,onClick:()=>{x.handleSubmit(async j=>{o(!0),(await Cd(j)).data&&($.success(m(a?"plan.form.submit.success.update":"plan.form.submit.success.add")),f(),r()),o(!1)})()},children:m(c?"plan.form.submit.submitting":"plan.form.submit.submit")})]})]})})]})]})})}function kx(){const[s,n]=u.useState({}),[a,l]=u.useState({"drag-handle":!1}),[r,c]=u.useState([]),[o,m]=u.useState([]),[x,i]=u.useState(!1),[d,p]=u.useState({pageSize:20,pageIndex:0}),[C,P]=u.useState([]),{refetch:f}=ie({queryKey:["planList"],queryFn:async()=>{const{data:R}=await Us();return P(R),R}});u.useEffect(()=>{l({"drag-handle":x}),p({pageSize:x?99999:10,pageIndex:0})},[x]);const j=(R,E)=>{x&&(R.dataTransfer.setData("text/plain",E.toString()),R.currentTarget.classList.add("opacity-50"))},w=(R,E)=>{if(!x)return;R.preventDefault(),R.currentTarget.classList.remove("bg-muted");const O=parseInt(R.dataTransfer.getData("text/plain"));if(O===E)return;const q=[...C],[te]=q.splice(O,1);q.splice(E,0,te),P(q)},g=async()=>{if(!x){i(!0);return}const R=C?.map(E=>E.id);kd(R).then(()=>{$.success("排序保存成功"),i(!1),f()}).finally(()=>{i(!1)})},S=Ze({data:C||[],columns:_x(f),state:{sorting:o,columnVisibility:a,rowSelection:s,columnFilters:r,pagination:d},enableRowSelection:!0,onPaginationChange:p,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),getSortedRowModel:is(),getFacetedRowModel:_s(),getFacetedUniqueValues:ws(),initialState:{columnPinning:{right:["actions"]}},pageCount:x?1:void 0});return e.jsx(yx,{refreshData:f,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(cs,{table:S,toolbar:R=>e.jsx(Nx,{table:R,refetch:f,saveOrder:g,isSortMode:x}),draggable:x,onDragStart:j,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:w,showPagination:!x}),e.jsx(Sx,{})]})})}function Tx(){const{t:s}=M("subscribe");return e.jsxs(Pe,{children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(kx,{})})]})]})}const Dx=Object.freeze(Object.defineProperty({__proto__:null,default:Tx},Symbol.toStringTag,{value:"Module"})),Gs=[{value:re.PENDING,label:rt[re.PENDING],icon:$o,color:lt[re.PENDING]},{value:re.PROCESSING,label:rt[re.PROCESSING],icon:ur,color:lt[re.PROCESSING]},{value:re.COMPLETED,label:rt[re.COMPLETED],icon:ga,color:lt[re.COMPLETED]},{value:re.CANCELLED,label:rt[re.CANCELLED],icon:xr,color:lt[re.CANCELLED]},{value:re.DISCOUNTED,label:rt[re.DISCOUNTED],icon:ga,color:lt[re.DISCOUNTED]}],ot=[{value:ue.PENDING,label:yt[ue.PENDING],icon:qo,color:Nt[ue.PENDING]},{value:ue.PROCESSING,label:yt[ue.PROCESSING],icon:ur,color:Nt[ue.PROCESSING]},{value:ue.VALID,label:yt[ue.VALID],icon:ga,color:Nt[ue.VALID]},{value:ue.INVALID,label:yt[ue.INVALID],icon:xr,color:Nt[ue.INVALID]}];function kt({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=s?.getFilterValue(),c=Array.isArray(r)?new Set(r):r!==void 0?new Set([r]):new Set;return e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(gt,{className:"mr-2 h-4 w-4"}),n,c?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Se,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:c.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:c.size>2?e.jsxs(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[c.size," selected"]}):a.filter(o=>c.has(o.value)).map(o=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(os,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Is,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Vs,{children:[e.jsx(qs,{children:"No results found."}),e.jsx(Ke,{children:a.map(o=>{const m=c.has(o.value);return e.jsxs(Ie,{onSelect:()=>{const x=new Set(c);m?x.delete(o.value):x.add(o.value);const i=Array.from(x);s?.setFilterValue(i.length?i:void 0)},children:[e.jsx("div",{className:N("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",m?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(zs,{className:N("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)})}),c.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(st,{}),e.jsx(Ke,{children:e.jsx(Ie,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Px=h.object({email:h.string().min(1),plan_id:h.number(),period:h.string(),total_amount:h.number()}),Ex={email:"",plan_id:0,total_amount:0,period:""};function sl({refetch:s,trigger:n,defaultValues:a}){const{t:l}=M("order"),[r,c]=u.useState(!1),o=je({resolver:Ne(Px),defaultValues:{...Ex,...a},mode:"onChange"}),[m,x]=u.useState([]);return u.useEffect(()=>{r&&Us().then(({data:i})=>{x(i)})},[r]),e.jsxs(be,{open:r,onOpenChange:c,children:[e.jsx(Ge,{asChild:!0,children:n||e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Re,{icon:"ion:add"}),e.jsx("div",{children:l("dialog.addOrder")})]})}),e.jsxs(ge,{className:"sm:max-w-[425px]",children:[e.jsxs(we,{children:[e.jsx(ye,{children:l("dialog.assignOrder")}),e.jsx(De,{})]}),e.jsxs(_e,{...o,children:[e.jsx(b,{control:o.control,name:"email",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dialog.fields.userEmail")}),e.jsx(_,{children:e.jsx(k,{placeholder:l("dialog.placeholders.email"),...i})})]})}),e.jsx(b,{control:o.control,name:"plan_id",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dialog.fields.subscriptionPlan")}),e.jsx(_,{children:e.jsxs(X,{value:i.value?i.value?.toString():void 0,onValueChange:d=>i.onChange(parseInt(d)),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dialog.placeholders.plan")})}),e.jsx(J,{children:m.map(d=>e.jsx(U,{value:d.id.toString(),children:d.name},d.id))})]})})]})}),e.jsx(b,{control:o.control,name:"period",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dialog.fields.orderPeriod")}),e.jsx(_,{children:e.jsxs(X,{value:i.value,onValueChange:i.onChange,children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:l("dialog.placeholders.period")})}),e.jsx(J,{children:Object.keys(tm).map(d=>e.jsx(U,{value:d,children:l(`period.${d}`)},d))})]})})]})}),e.jsx(b,{control:o.control,name:"total_amount",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:l("dialog.fields.paymentAmount")}),e.jsx(_,{children:e.jsx(k,{type:"number",placeholder:l("dialog.placeholders.amount"),value:i.value/100,onChange:d=>i.onChange(parseFloat(d.currentTarget.value)*100)})}),e.jsx(T,{})]})}),e.jsxs(Ae,{children:[e.jsx(D,{variant:"outline",onClick:()=>c(!1),children:l("dialog.actions.cancel")}),e.jsx(D,{type:"submit",onClick:()=>{o.handleSubmit(i=>{Rd(i).then(({data:d})=>{d&&(s&&s(),o.reset(),c(!1),$.success(l("dialog.messages.addSuccess")))})})()},children:l("dialog.actions.confirm")})]})]})]})]})}function Rx({table:s,refetch:n}){const{t:a}=M("order"),l=s.getState().columnFilters.length>0,r=Object.values(as).filter(x=>typeof x=="number").map(x=>({label:a(`type.${as[x]}`),value:x,color:x===as.NEW?"green-500":x===as.RENEWAL?"blue-500":x===as.UPGRADE?"purple-500":"orange-500"})),c=Object.values(Te).map(x=>({label:a(`period.${x}`),value:x,color:x===Te.MONTH_PRICE?"slate-500":x===Te.QUARTER_PRICE?"cyan-500":x===Te.HALF_YEAR_PRICE?"indigo-500":x===Te.YEAR_PRICE?"violet-500":x===Te.TWO_YEAR_PRICE?"fuchsia-500":x===Te.THREE_YEAR_PRICE?"pink-500":x===Te.ONETIME_PRICE?"rose-500":"orange-500"})),o=Object.values(re).filter(x=>typeof x=="number").map(x=>({label:a(`status.${re[x]}`),value:x,icon:x===re.PENDING?Gs[0].icon:x===re.PROCESSING?Gs[1].icon:x===re.COMPLETED?Gs[2].icon:x===re.CANCELLED?Gs[3].icon:Gs[4].icon,color:x===re.PENDING?"yellow-500":x===re.PROCESSING?"blue-500":x===re.COMPLETED?"green-500":x===re.CANCELLED?"red-500":"green-500"})),m=Object.values(ue).filter(x=>typeof x=="number").map(x=>({label:a(`commission.${ue[x]}`),value:x,icon:x===ue.PENDING?ot[0].icon:x===ue.PROCESSING?ot[1].icon:x===ue.VALID?ot[2].icon:ot[3].icon,color:x===ue.PENDING?"yellow-500":x===ue.PROCESSING?"blue-500":x===ue.VALID?"green-500":"red-500"}));return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(sl,{refetch:n}),e.jsx(k,{placeholder:a("search.placeholder"),value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:x=>s.getColumn("trade_no")?.setFilterValue(x.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(kt,{column:s.getColumn("type"),title:a("table.columns.type"),options:r}),s.getColumn("period")&&e.jsx(kt,{column:s.getColumn("period"),title:a("table.columns.period"),options:c}),s.getColumn("status")&&e.jsx(kt,{column:s.getColumn("status"),title:a("table.columns.status"),options:o}),s.getColumn("commission_status")&&e.jsx(kt,{column:s.getColumn("commission_status"),title:a("table.columns.commissionStatus"),options:m})]}),l&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[a("actions.reset"),e.jsx(Ye,{className:"ml-2 h-4 w-4"})]})]})}function es({label:s,value:n,className:a,valueClassName:l}){return e.jsxs("div",{className:N("flex items-center py-1.5",a),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:N("text-sm",l),children:n||"-"})]})}function Ix({status:s}){const{t:n}=M("order"),a={[re.PENDING]:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",[re.PROCESSING]:"bg-blue-100 text-blue-800 hover:bg-blue-100",[re.CANCELLED]:"bg-red-100 text-red-800 hover:bg-red-100",[re.COMPLETED]:"bg-green-100 text-green-800 hover:bg-green-100",[re.DISCOUNTED]:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(K,{variant:"secondary",className:N("font-medium",a[s]),children:n(`status.${re[s]}`)})}function Vx({id:s,trigger:n}){const[a,l]=u.useState(!1),[r,c]=u.useState(),{t:o}=M("order");return u.useEffect(()=>{(async()=>{if(a){const{data:x}=await Dd({id:s});c(x)}})()},[a,s]),e.jsxs(be,{onOpenChange:l,open:a,children:[e.jsx(Ge,{asChild:!0,children:n}),e.jsxs(ge,{className:"max-w-xl",children:[e.jsxs(we,{className:"space-y-2",children:[e.jsx(ye,{className:"text-lg font-medium",children:o("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:[o("table.columns.tradeNo"),":",r?.trade_no]}),r?.status&&e.jsx(Ix,{status:r.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:o("dialog.basicInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(es,{label:o("dialog.fields.userEmail"),value:r?.user?.email?e.jsxs(Ls,{to:`/user/manage?email=${r.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[r.user.email,e.jsx(hr,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(es,{label:o("dialog.fields.orderPeriod"),value:r&&o(`period.${r.period}`)}),e.jsx(es,{label:o("dialog.fields.subscriptionPlan"),value:r?.plan?.name,valueClassName:"font-medium"}),e.jsx(es,{label:o("dialog.fields.callbackNo"),value:r?.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:o("dialog.amountInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(es,{label:o("dialog.fields.paymentAmount"),value:Os(r?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(Se,{className:"my-2"}),e.jsx(es,{label:o("dialog.fields.balancePayment"),value:Os(r?.balance_amount||0)}),e.jsx(es,{label:o("dialog.fields.discountAmount"),value:Os(r?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(es,{label:o("dialog.fields.refundAmount"),value:Os(r?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(es,{label:o("dialog.fields.deductionAmount"),value:Os(r?.surplus_amount||0)})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:o("dialog.timeInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(es,{label:o("dialog.fields.createdAt"),value:ve(r?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(es,{label:o("dialog.fields.updatedAt"),value:ve(r?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const Ox={[as.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[as.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[as.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[as.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Mx={[Te.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Te.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Te.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Te.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Te.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Te.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Te.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Te.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Fx=s=>re[s],zx=s=>ue[s],Lx=s=>as[s],Ax=s=>{const{t:n}=M("order");return[{accessorKey:"trade_no",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.tradeNo")}),cell:({row:a})=>{const l=a.original.trade_no,r=l.length>6?`${l.slice(0,3)}...${l.slice(-3)}`:l;return e.jsx("div",{className:"flex items-center",children:e.jsx(Vx,{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:r}),e.jsx(hr,{className:"h-3.5 w-3.5 opacity-70"})]}),id:a.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.type")}),cell:({row:a})=>{const l=a.getValue("type"),r=Ox[l];return e.jsx(K,{variant:"secondary",className:N("font-medium transition-colors text-nowrap",r.color,r.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:n(`type.${Lx(l)}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.plan")}),cell:({row:a})=>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:a.original.plan?.name||"-"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"period",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.period")}),cell:({row:a})=>{const l=a.getValue("period"),r=Mx[l];return e.jsx(K,{variant:"secondary",className:N("font-medium transition-colors text-nowrap",r.color,r.bgColor,"hover:bg-opacity-80"),children:n(`period.${l}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.amount")}),cell:({row:a})=>{const l=a.getValue("total_amount"),r=typeof l=="number"?(l/100).toFixed(2):"N/A";return e.jsxs("div",{className:"flex items-center font-mono text-foreground/90",children:["¥",r]})},enableSorting:!0,enableHiding:!1},{accessorKey:"status",header:({column:a})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(L,{column:a,title:n("table.columns.status")}),e.jsx(pe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx(Br,{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:a})=>{const l=Gs.find(r=>r.value===a.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:n(`status.${Fx(l.value)}`)})]}),l.value===re.PENDING&&e.jsxs(bs,{modal:!0,children:[e.jsx(ys,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(us,{align:"end",className:"w-[140px]",children:[e.jsx(fe,{className:"cursor-pointer",onClick:async()=>{await Pd({trade_no:a.original.trade_no}),s()},children:n("actions.markAsPaid")}),e.jsx(fe,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ed({trade_no:a.original.trade_no}),s()},children:n("actions.cancel")})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.commission")}),cell:({row:a})=>{const l=a.getValue("commission_balance"),r=l?(l/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:l?`¥${r}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.commissionStatus")}),cell:({row:a})=>{const l=a.original.status,r=a.original.commission_balance,c=ot.find(o=>o.value===a.getValue("commission_status"));return r==0||!c?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:[c.icon&&e.jsx(c.icon,{className:`h-4 w-4 text-${c.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n(`commission.${zx(c.value)}`)})]}),c.value===ue.PENDING&&l===re.COMPLETED&&e.jsxs(bs,{modal:!0,children:[e.jsx(ys,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(us,{align:"end",className:"w-[120px]",children:[e.jsx(fe,{className:"cursor-pointer",onClick:async()=>{await tn({trade_no:a.original.trade_no,commission_status:ue.PROCESSING}),s()},children:n("commission.PROCESSING")}),e.jsx(fe,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await tn({trade_no:a.original.trade_no,commission_status:ue.INVALID}),s()},children:n("commission.INVALID")})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.createdAt")}),cell:({row:a})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:ve(a.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}]};function $x(){const[s]=fr(),[n,a]=u.useState({}),[l,r]=u.useState({}),[c,o]=u.useState([]),[m,x]=u.useState([]),[i,d]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const w=Object.entries({user_id:"string",order_id:"string",commission_status:"number",status:"number",commission_balance:"string"}).map(([g,S])=>{const R=s.get(g);return R?{id:g,value:S==="number"?parseInt(R):R}:null}).filter(Boolean);w.length>0&&o(w)},[s]);const{refetch:p,data:C,isLoading:P}=ie({queryKey:["orderList",i,c,m],queryFn:()=>Td({pageSize:i.pageSize,current:i.pageIndex+1,filter:c,sort:m})}),f=Ze({data:C?.data??[],columns:Ax(p),state:{sorting:m,columnVisibility:l,rowSelection:n,columnFilters:c,pagination:i},rowCount:C?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:r,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),onPaginationChange:d,getSortedRowModel:is(),getFacetedRowModel:_s(),getFacetedUniqueValues:ws(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(cs,{table:f,toolbar:e.jsx(Rx,{table:f,refetch:p}),showPagination:!0})}function qx(){const{t:s}=M("order");return e.jsxs(Pe,{children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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($x,{})})]})]})}const Ux=Object.freeze(Object.defineProperty({__proto__:null,default:qx},Symbol.toStringTag,{value:"Module"}));function Hx({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(gt,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Se,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{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(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(c=>r.has(c.value)).map(c=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(os,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Is,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Vs,{children:[e.jsx(qs,{children:"No results found."}),e.jsx(Ke,{children:a.map(c=>{const o=r.has(c.value);return e.jsxs(Ie,{onSelect:()=>{o?r.delete(c.value):r.add(c.value);const m=Array.from(r);s?.setFilterValue(m.length?m:void 0)},children:[e.jsx("div",{className:N("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(zs,{className:N("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${c.color}`}),e.jsx("span",{children:c.label}),l?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:l.get(c.value)})]},c.value)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(st,{}),e.jsx(Ke,{children:e.jsx(Ie,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Kx=h.object({id:h.coerce.number().nullable().optional(),name:h.string().min(1,"请输入优惠券名称"),code:h.string().nullable(),type:h.coerce.number(),value:h.coerce.number(),started_at:h.coerce.number(),ended_at:h.coerce.number(),limit_use:h.union([h.string(),h.number()]).nullable(),limit_use_with_user:h.union([h.string(),h.number()]).nullable(),generate_count:h.coerce.number().nullable().optional(),limit_plan_ids:h.array(h.coerce.number()).default([]).nullable(),limit_period:h.array(h.nativeEnum(dt)).default([]).nullable()}).refine(s=>s.ended_at>s.started_at,{message:"结束时间必须晚于开始时间",path:["ended_at"]}),un={name:"",code:null,type:Ue.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 tl({defaultValues:s,refetch:n,type:a="create",dialogTrigger:l=null,open:r,onOpenChange:c}){const{t:o}=M("coupon"),[m,x]=u.useState(!1),i=r??m,d=c??x,[p,C]=u.useState([]),P=je({resolver:Ne(Kx),defaultValues:s||un});u.useEffect(()=>{s&&P.reset(s)},[s,P]),u.useEffect(()=>{Us().then(({data:g})=>C(g))},[]);const f=g=>{if(!g)return;const S=(R,E)=>{const O=new Date(E*1e3);return R.setHours(O.getHours(),O.getMinutes(),O.getSeconds()),Math.floor(R.getTime()/1e3)};g.from&&P.setValue("started_at",S(g.from,P.watch("started_at"))),g.to&&P.setValue("ended_at",S(g.to,P.watch("ended_at")))},j=async g=>{const S=await Vd(g);if(g.generate_count&&S){const R=new Blob([S],{type:"text/csv;charset=utf-8;"}),E=document.createElement("a");E.href=window.URL.createObjectURL(R),E.download=`coupons_${new Date().getTime()}.csv`,E.click(),window.URL.revokeObjectURL(E.href)}d(!1),a==="create"&&P.reset(un),n()},w=(g,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(k,{type:"datetime-local",step:"1",value:ve(P.watch(g),"YYYY-MM-DDTHH:mm:ss"),onChange:R=>{const E=new Date(R.target.value);P.setValue(g,Math.floor(E.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(be,{open:i,onOpenChange:d,children:[l&&e.jsx(Ge,{asChild:!0,children:l}),e.jsxs(ge,{className:"sm:max-w-[425px]",children:[e.jsx(we,{children:e.jsx(ye,{children:o(a==="create"?"form.add":"form.edit")})}),e.jsx(_e,{...P,children:e.jsxs("form",{onSubmit:P.handleSubmit(j),className:"space-y-4",children:[e.jsx(b,{control:P.control,name:"name",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:o("form.name.label")}),e.jsx(k,{placeholder:o("form.name.placeholder"),...g}),e.jsx(T,{})]})}),a==="create"&&e.jsx(b,{control:P.control,name:"generate_count",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:o("form.generateCount.label")}),e.jsx(k,{type:"number",min:0,placeholder:o("form.generateCount.placeholder"),...g,value:g.value===void 0?"":g.value,onChange:S=>g.onChange(S.target.value===""?"":parseInt(S.target.value)),className:"h-9"}),e.jsx(z,{className:"text-xs",children:o("form.generateCount.description")}),e.jsx(T,{})]})}),(!P.watch("generate_count")||P.watch("generate_count")==null)&&e.jsx(b,{control:P.control,name:"code",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:o("form.code.label")}),e.jsx(k,{placeholder:o("form.code.placeholder"),...g,className:"h-9"}),e.jsx(z,{className:"text-xs",children:o("form.code.description")}),e.jsx(T,{})]})}),e.jsxs(v,{children:[e.jsx(y,{children:o("form.type.label")}),e.jsxs("div",{className:"flex",children:[e.jsx(b,{control:P.control,name:"type",render:({field:g})=>e.jsxs(X,{value:g.value.toString(),onValueChange:S=>{const R=g.value,E=parseInt(S);g.onChange(E);const O=P.getValues("value");O&&(R===Ue.AMOUNT&&E===Ue.PERCENTAGE?P.setValue("value",O/100):R===Ue.PERCENTAGE&&E===Ue.AMOUNT&&P.setValue("value",O*100))},children:[e.jsx(Q,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(ee,{placeholder:o("form.type.placeholder")})}),e.jsx(J,{children:Object.entries(am).map(([S,R])=>e.jsx(U,{value:S,children:o(`table.toolbar.types.${S}`)},S))})]})}),e.jsx(b,{control:P.control,name:"value",render:({field:g})=>{const S=g.value==null?"":P.watch("type")===Ue.AMOUNT&&typeof g.value=="number"?(g.value/100).toString():g.value.toString();return e.jsx(k,{type:"number",placeholder:o("form.value.placeholder"),...g,value:S,onChange:R=>{const E=R.target.value;if(E===""){g.onChange("");return}const O=parseFloat(E);isNaN(O)||g.onChange(P.watch("type")===Ue.AMOUNT?Math.round(O*100):O)},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")==Ue.AMOUNT?"¥":"%"})})]})]}),e.jsxs(v,{children:[e.jsx(y,{children:o("form.validity.label")}),e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsxs(D,{variant:"outline",className:N("w-full justify-start text-left font-normal",!P.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(pt,{className:"mr-2 h-4 w-4"}),ve(P.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ",o("form.validity.to")," ",ve(P.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(os,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(Hs,{mode:"range",selected:{from:new Date(P.watch("started_at")*1e3),to:new Date(P.watch("ended_at")*1e3)},onSelect:f,numberOfMonths:2})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[w("started_at",o("table.validity.startTime")),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:o("form.validity.to")}),w("ended_at",o("table.validity.endTime"))]})})]})]}),e.jsx(T,{})]}),e.jsx(b,{control:P.control,name:"limit_use",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:o("form.limitUse.label")}),e.jsx(k,{type:"number",min:0,placeholder:o("form.limitUse.placeholder"),...g,value:g.value===null?"":g.value,onChange:S=>g.onChange(S.target.value===""?null:parseInt(S.target.value)),className:"h-9"}),e.jsx(z,{className:"text-xs",children:o("form.limitUse.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:P.control,name:"limit_use_with_user",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:o("form.limitUseWithUser.label")}),e.jsx(k,{type:"number",min:0,placeholder:o("form.limitUseWithUser.placeholder"),...g,value:g.value===null?"":g.value,onChange:S=>g.onChange(S.target.value===""?null:parseInt(S.target.value)),className:"h-9"}),e.jsx(z,{className:"text-xs",children:o("form.limitUseWithUser.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:P.control,name:"limit_period",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:o("form.limitPeriod.label")}),e.jsx(ht,{options:Object.entries(dt).filter(([S])=>isNaN(Number(S))).map(([S,R])=>({label:o(`coupon:period.${R}`),value:S})),onChange:S=>{if(S.length===0){g.onChange([]);return}const R=S.map(E=>dt[E.value]);g.onChange(R)},value:(g.value||[]).map(S=>({label:o(`coupon:period.${S}`),value:Object.entries(dt).find(([R,E])=>E===S)?.[0]||""})),placeholder:o("form.limitPeriod.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:o("form.limitPeriod.empty")})}),e.jsx(z,{className:"text-xs",children:o("form.limitPeriod.description")}),e.jsx(T,{})]})}),e.jsx(b,{control:P.control,name:"limit_plan_ids",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:o("form.limitPlan.label")}),e.jsx(ht,{options:p?.map(S=>({label:S.name,value:S.id.toString()}))||[],onChange:S=>g.onChange(S.map(R=>Number(R.value))),value:(p||[]).filter(S=>(g.value||[]).includes(S.id)).map(S=>({label:S.name,value:S.id.toString()})),placeholder:o("form.limitPlan.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:o("form.limitPlan.empty")})}),e.jsx(T,{})]})}),e.jsx(Ae,{children:e.jsx(D,{type:"submit",disabled:P.formState.isSubmitting,children:P.formState.isSubmitting?o("form.submit.saving"):o("form.submit.save")})})]})})]})]})}function Bx({table:s,refetch:n}){const a=s.getState().columnFilters.length>0,{t:l}=M("coupon");return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tl,{refetch:n,dialogTrigger:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Re,{icon:"ion:add"}),e.jsx("div",{children:l("form.add")})]})}),e.jsx(k,{placeholder:l("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:r=>s.getColumn("name")?.setFilterValue(r.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(Hx,{column:s.getColumn("type"),title:l("table.toolbar.type"),options:[{value:Ue.AMOUNT,label:l(`table.toolbar.types.${Ue.AMOUNT}`)},{value:Ue.PERCENTAGE,label:l(`table.toolbar.types.${Ue.PERCENTAGE}`)}]}),a&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("table.toolbar.reset"),e.jsx(Ye,{className:"ml-2 h-4 w-4"})]})]})}const al=u.createContext(void 0);function Gx({children:s,refetch:n}){const[a,l]=u.useState(!1),[r,c]=u.useState(null),o=x=>{c(x),l(!0)},m=()=>{l(!1),c(null)};return e.jsxs(al.Provider,{value:{isOpen:a,currentCoupon:r,openEdit:o,closeEdit:m},children:[s,r&&e.jsx(tl,{defaultValues:r,refetch:n,type:"edit",open:a,onOpenChange:l})]})}function Wx(){const s=u.useContext(al);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const Yx=s=>{const{t:n}=M("coupon");return[{accessorKey:"id",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.id")}),cell:({row:a})=>e.jsx(K,{children:a.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.show")}),cell:({row:a})=>e.jsx(W,{defaultChecked:a.original.show,onCheckedChange:l=>{Md({id:a.original.id,show:l}).then(({data:r})=>!r&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.name")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:a.original.name})}),enableSorting:!1,size:800},{accessorKey:"type",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.type")}),cell:({row:a})=>e.jsx(K,{variant:"outline",children:n(`table.toolbar.types.${a.original.type}`)}),enableSorting:!0},{accessorKey:"code",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.code")}),cell:({row:a})=>e.jsx(K,{variant:"secondary",children:a.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.limitUse")}),cell:({row:a})=>e.jsx(K,{variant:"outline",children:a.original.limit_use===null?n("table.validity.unlimited"):a.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.limitUseWithUser")}),cell:({row:a})=>e.jsx(K,{variant:"outline",children:a.original.limit_use_with_user===null?n("table.validity.noLimit"):a.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:a})=>e.jsx(L,{column:a,title:n("table.columns.validity")}),cell:({row:a})=>{const[l,r]=u.useState(!1),c=Date.now(),o=a.original.started_at*1e3,m=a.original.ended_at*1e3,x=c>m,i=ce.jsx(L,{className:"justify-end",column:a,title:n("table.columns.actions")}),cell:({row:a})=>{const{openEdit:l}=Wx();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>l(a.original),children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),e.jsx(Be,{title:n("table.actions.deleteConfirm.title"),description:n("table.actions.deleteConfirm.description"),confirmText:n("table.actions.deleteConfirm.confirmText"),variant:"destructive",onConfirm:async()=>{Od({id:a.original.id}).then(({data:r})=>{r&&($.success("删除成功"),s())})},children:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{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 Qx(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,c]=u.useState([]),[o,m]=u.useState([]),[x,i]=u.useState({pageIndex:0,pageSize:20}),{refetch:d,data:p}=ie({queryKey:["couponList",x,r,o],queryFn:()=>Id({pageSize:x.pageSize,current:x.pageIndex+1,filter:r,sort:o})}),C=Ze({data:p?.data??[],columns:Yx(d),state:{sorting:o,columnVisibility:a,rowSelection:s,columnFilters:r,pagination:x},pageCount:Math.ceil((p?.total??0)/x.pageSize),rowCount:p?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,onPaginationChange:i,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),getSortedRowModel:is(),getFacetedRowModel:_s(),getFacetedUniqueValues:ws(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Gx,{refetch:d,children:e.jsx("div",{className:"space-y-4",children:e.jsx(cs,{table:C,toolbar:e.jsx(Bx,{table:C,refetch:d})})})})}function Jx(){const{t:s}=M("coupon");return e.jsxs(Pe,{children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(Qx,{})})]})]})}const Zx=Object.freeze(Object.defineProperty({__proto__:null,default:Jx},Symbol.toStringTag,{value:"Module"})),Xx=1,eh=1e6;let da=0;function sh(){return da=(da+1)%Number.MAX_SAFE_INTEGER,da.toString()}const ma=new Map,xn=s=>{if(ma.has(s))return;const n=setTimeout(()=>{ma.delete(s),mt({type:"REMOVE_TOAST",toastId:s})},eh);ma.set(s,n)},th=(s,n)=>{switch(n.type){case"ADD_TOAST":return{...s,toasts:[n.toast,...s.toasts].slice(0,Xx)};case"UPDATE_TOAST":return{...s,toasts:s.toasts.map(a=>a.id===n.toast.id?{...a,...n.toast}:a)};case"DISMISS_TOAST":{const{toastId:a}=n;return a?xn(a):s.toasts.forEach(l=>{xn(l.id)}),{...s,toasts:s.toasts.map(l=>l.id===a||a===void 0?{...l,open:!1}:l)}}case"REMOVE_TOAST":return n.toastId===void 0?{...s,toasts:[]}:{...s,toasts:s.toasts.filter(a=>a.id!==n.toastId)}}},Pt=[];let Et={toasts:[]};function mt(s){Et=th(Et,s),Pt.forEach(n=>{n(Et)})}function ah({...s}){const n=sh(),a=r=>mt({type:"UPDATE_TOAST",toast:{...r,id:n}}),l=()=>mt({type:"DISMISS_TOAST",toastId:n});return mt({type:"ADD_TOAST",toast:{...s,id:n,open:!0,onOpenChange:r=>{r||l()}}}),{id:n,dismiss:l,update:a}}function nl(){const[s,n]=u.useState(Et);return u.useEffect(()=>(Pt.push(n),()=>{const a=Pt.indexOf(n);a>-1&&Pt.splice(a,1)}),[s]),{...s,toast:ah,dismiss:a=>mt({type:"DISMISS_TOAST",toastId:a})}}function nh({open:s,onOpenChange:n,table:a}){const{t:l}=M("user"),{toast:r}=nl(),[c,o]=u.useState(!1),[m,x]=u.useState(""),[i,d]=u.useState(""),p=async()=>{if(!m||!i){r({title:l("messages.error"),description:l("messages.send_mail.required_fields"),variant:"destructive"});return}try{o(!0),await zt.sendMail({subject:m,content:i,filter:a.getState().columnFilters,sort:a.getState().sorting[0]?.id,sort_type:a.getState().sorting[0]?.desc?"DESC":"ASC"}),r({title:l("messages.success"),description:l("messages.send_mail.success")}),n(!1),x(""),d("")}catch{r({title:l("messages.error"),description:l("messages.send_mail.failed"),variant:"destructive"})}finally{o(!1)}};return e.jsx(be,{open:s,onOpenChange:n,children:e.jsxs(ge,{className:"sm:max-w-[500px]",children:[e.jsxs(we,{children:[e.jsx(ye,{children:l("send_mail.title")}),e.jsx(De,{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(k,{id:"subject",value:m,onChange:C=>x(C.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(fs,{id:"content",value:i,onChange:C=>d(C.target.value),className:"col-span-3",rows:6})]})]}),e.jsx(Ae,{children:e.jsx(G,{type:"submit",onClick:p,disabled:c,children:l(c?"send_mail.sending":"send_mail.send")})})]})})}const rh=h.object({email_prefix:h.string().optional(),email_suffix:h.string().min(1),password:h.string().optional(),expired_at:h.number().optional().nullable(),plan_id:h.number().nullable(),generate_count:h.number().optional().nullable()}).refine(s=>s.generate_count===null?s.email_prefix!==void 0&&s.email_prefix!=="":!0,{message:"Email prefix is required when generate_count is null",path:["email_prefix"]}),lh={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0};function ih({refetch:s}){const{t:n}=M("user"),[a,l]=u.useState(!1),r=je({resolver:Ne(rh),defaultValues:lh,mode:"onChange"}),[c,o]=u.useState([]);return u.useEffect(()=>{a&&Us().then(({data:m})=>{m&&o(m)})},[a]),e.jsxs(be,{open:a,onOpenChange:l,children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(G,{size:"sm",variant:"outline",className:"space-x-2 gap-0",children:[e.jsx(Re,{icon:"ion:add"}),e.jsx("div",{children:n("generate.button")})]})}),e.jsxs(ge,{className:"sm:max-w-[425px]",children:[e.jsxs(we,{children:[e.jsx(ye,{children:n("generate.title")}),e.jsx(De,{})]}),e.jsxs(_e,{...r,children:[e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.email")}),e.jsxs("div",{className:"flex",children:[!r.watch("generate_count")&&e.jsx(b,{control:r.control,name:"email_prefix",render:({field:m})=>e.jsx(k,{className:"flex-[5] rounded-r-none",placeholder:n("generate.form.email_prefix"),...m})}),e.jsx("div",{className:`z-[-1] border border-r-0 border-input px-3 py-1 shadow-sm ${r.watch("generate_count")?"rounded-l-md":"border-l-0"}`,children:"@"}),e.jsx(b,{control:r.control,name:"email_suffix",render:({field:m})=>e.jsx(k,{className:"flex-[4] rounded-l-none",placeholder:n("generate.form.email_domain"),...m})})]})]}),e.jsx(b,{control:r.control,name:"password",render:({field:m})=>e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.password")}),e.jsx(k,{placeholder:n("generate.form.password_placeholder"),...m}),e.jsx(T,{})]})}),e.jsx(b,{control:r.control,name:"expired_at",render:({field:m})=>e.jsxs(v,{className:"flex flex-col",children:[e.jsx(y,{children:n("generate.form.expire_time")}),e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsx(_,{children:e.jsxs(G,{variant:"outline",className:N("w-full pl-3 text-left font-normal",!m.value&&"text-muted-foreground"),children:[m.value?ve(m.value):e.jsx("span",{children:n("generate.form.expire_time_placeholder")}),e.jsx(pt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(os,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(Ho,{asChild:!0,children:e.jsx(G,{variant:"outline",className:"w-full",onClick:()=>{m.onChange(null)},children:n("generate.form.permanent")})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Hs,{mode:"single",selected:m.value?new Date(m.value*1e3):void 0,onSelect:x=>{x&&m.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(b,{control:r.control,name:"plan_id",render:({field:m})=>e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.subscription")}),e.jsx(_,{children:e.jsxs(X,{value:m.value?m.value.toString():"null",onValueChange:x=>m.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:n("generate.form.subscription_none")})}),e.jsxs(J,{children:[e.jsx(U,{value:"null",children:n("generate.form.subscription_none")}),c.map(x=>e.jsx(U,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!r.watch("email_prefix")&&e.jsx(b,{control:r.control,name:"generate_count",render:({field:m})=>e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.generate_count")}),e.jsx(k,{type:"number",placeholder:n("generate.form.generate_count_placeholder"),value:m.value||"",onChange:x=>m.onChange(x.target.value?parseInt(x.target.value):null)})]})})]}),e.jsxs(Ae,{children:[e.jsx(G,{variant:"outline",onClick:()=>l(!1),children:n("generate.form.cancel")}),e.jsx(G,{onClick:()=>r.handleSubmit(m=>{Ad(m).then(({data:x})=>{x&&($.success(n("generate.form.success")),r.reset(),s(),l(!1))})})(),children:n("generate.form.submit")})]})]})]})}const rl=gn,ll=jn,oh=vn,il=u.forwardRef(({className:s,...n},a)=>e.jsx(Lt,{className:N("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:a}));il.displayName=Lt.displayName;const ch=Fs("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"}}),Aa=u.forwardRef(({side:s="right",className:n,children:a,...l},r)=>e.jsxs(oh,{children:[e.jsx(il,{}),e.jsxs(At,{ref:r,className:N(ch({side:s}),n),...l,children:[e.jsxs(wa,{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(Ye,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),a]})]}));Aa.displayName=At.displayName;const $a=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-2 text-center sm:text-left",s),...n});$a.displayName="SheetHeader";const ol=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});ol.displayName="SheetFooter";const qa=u.forwardRef(({className:s,...n},a)=>e.jsx($t,{ref:a,className:N("text-lg font-semibold text-foreground",s),...n}));qa.displayName=$t.displayName;const Ua=u.forwardRef(({className:s,...n},a)=>e.jsx(qt,{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Ua.displayName=qt.displayName;function dh({table:s,refetch:n,permissionGroups:a=[],subscriptionPlans:l=[]}){const{t:r}=M("user"),{toast:c}=nl(),o=s.getState().columnFilters.length>0,[m,x]=u.useState([]),[i,d]=u.useState(!1),[p,C]=u.useState(!1),[P,f]=u.useState(!1),[j,w]=u.useState(!1),g=async()=>{try{const B=await zt.dumpCSV({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),ae=window.URL.createObjectURL(new Blob([B.data])),A=document.createElement("a");A.href=ae,A.setAttribute("download",`users_${new Date().toISOString()}.csv`),document.body.appendChild(A),A.click(),A.remove(),window.URL.revokeObjectURL(ae),c({title:r("messages.success"),description:r("messages.export.success")})}catch{c({title:r("messages.error"),description:r("messages.export.failed"),variant:"destructive"})}},S=async()=>{try{w(!0),await zt.batchBan({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),c({title:r("messages.success"),description:r("messages.batch_ban.success")}),n()}catch{c({title:r("messages.error"),description:r("messages.batch_ban.failed"),variant:"destructive"})}finally{w(!1),f(!1)}},R=[{label:r("filter.fields.email"),value:"email",type:"text",operators:[{label:r("filter.operators.contains"),value:"contains"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.id"),value:"id",type:"number",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.plan_id"),value:"plan_id",type:"select",operators:[{label:r("filter.operators.eq"),value:"eq"}],useOptions:!0},{label:r("filter.fields.transfer_enable"),value:"transfer_enable",type:"number",unit:"GB",operators:[{label:r("filter.operators.gt"),value:"gt"},{label:r("filter.operators.lt"),value:"lt"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.total_used"),value:"total_used",type:"number",unit:"GB",operators:[{label:r("filter.operators.gt"),value:"gt"},{label:r("filter.operators.lt"),value:"lt"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.online_count"),value:"online_count",type:"number",operators:[{label:r("filter.operators.eq"),value:"eq"},{label:r("filter.operators.gt"),value:"gt"},{label:r("filter.operators.lt"),value:"lt"}]},{label:r("filter.fields.expired_at"),value:"expired_at",type:"date",operators:[{label:r("filter.operators.lt"),value:"lt"},{label:r("filter.operators.gt"),value:"gt"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.uuid"),value:"uuid",type:"text",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.token"),value:"token",type:"text",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.banned"),value:"banned",type:"select",operators:[{label:r("filter.operators.eq"),value:"eq"}],options:[{label:r("filter.status.normal"),value:"0"},{label:r("filter.status.banned"),value:"1"}]},{label:r("filter.fields.remark"),value:"remark",type:"text",operators:[{label:r("filter.operators.contains"),value:"contains"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.inviter_email"),value:"inviter_email",type:"text",operators:[{label:r("filter.operators.contains"),value:"contains"},{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.invite_user_id"),value:"invite_user_id",type:"number",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.is_admin"),value:"is_admin",type:"boolean",operators:[{label:r("filter.operators.eq"),value:"eq"}]},{label:r("filter.fields.is_staff"),value:"is_staff",type:"boolean",operators:[{label:r("filter.operators.eq"),value:"eq"}]}],E=B=>B*1024*1024*1024,O=B=>B/(1024*1024*1024),q=()=>{x([...m,{field:"",operator:"",value:""}])},te=B=>{x(m.filter((ae,A)=>A!==B))},F=(B,ae,A)=>{const I=[...m];if(I[B]={...I[B],[ae]:A},ae==="field"){const Y=R.find(ne=>ne.value===A);Y&&(I[B].operator=Y.operators[0].value,I[B].value=Y.type==="boolean"?!1:"")}x(I)},se=(B,ae)=>{const A=R.find(I=>I.value===B.field);if(!A)return null;switch(A.type){case"text":return e.jsx(k,{placeholder:r("filter.sheet.value"),value:B.value,onChange:I=>F(ae,"value",I.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(k,{type:"number",placeholder:r("filter.sheet.value_number",{unit:A.unit}),value:A.unit==="GB"?O(B.value||0):B.value,onChange:I=>{const Y=Number(I.target.value);F(ae,"value",A.unit==="GB"?E(Y):Y)}}),A.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:A.unit})]});case"date":return e.jsx(Hs,{mode:"single",selected:B.value,onSelect:I=>F(ae,"value",I),className:"rounded-md border"});case"select":return e.jsxs(X,{value:B.value,onValueChange:I=>F(ae,"value",I),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:r("filter.sheet.value")})}),e.jsx(J,{children:A.useOptions?l.map(I=>e.jsx(U,{value:I.value.toString(),children:I.label},I.value)):A.options?.map(I=>e.jsx(U,{value:I.value.toString(),children:I.label},I.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(W,{checked:B.value,onCheckedChange:I=>F(ae,"value",I)}),e.jsx(Ot,{children:B.value?r("filter.boolean.true"):r("filter.boolean.false")})]});default:return null}},qe=()=>{const B=m.filter(ae=>ae.field&&ae.operator&&ae.value!=="").map(ae=>{const A=R.find(Y=>Y.value===ae.field);let I=ae.value;return ae.operator==="contains"?{id:ae.field,value:I}:(A?.type==="date"&&I instanceof Date&&(I=Math.floor(I.getTime()/1e3)),A?.type==="boolean"&&(I=I?1:0),{id:ae.field,value:`${ae.operator}:${I}`})});s.setColumnFilters(B),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(ih,{refetch:n}),e.jsx(k,{placeholder:r("filter.email_search"),value:s.getColumn("email")?.getFilterValue()??"",onChange:B=>s.getColumn("email")?.setFilterValue(B.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(rl,{open:i,onOpenChange:d,children:[e.jsx(ll,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Ko,{className:"mr-2 h-4 w-4"}),r("filter.advanced"),m.length>0&&e.jsx(K,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:m.length})]})}),e.jsxs(Aa,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs($a,{children:[e.jsx(qa,{children:r("filter.sheet.title")}),e.jsx(Ua,{children:r("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:r("filter.sheet.conditions")}),e.jsx(D,{variant:"outline",size:"sm",onClick:q,children:r("filter.sheet.add")})]}),e.jsx(Xs,{className:"h-[calc(100vh-280px)] pr-4",children:e.jsx("div",{className:"space-y-4",children:m.map((B,ae)=>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(Ot,{children:r("filter.sheet.condition",{number:ae+1})}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>te(ae),children:e.jsx(Ye,{className:"h-4 w-4"})})]}),e.jsxs(X,{value:B.field,onValueChange:A=>F(ae,"field",A),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:r("filter.sheet.field")})}),e.jsx(J,{children:R.map(A=>e.jsx(U,{value:A.value,children:A.label},A.value))})]}),B.field&&e.jsxs(X,{value:B.operator,onValueChange:A=>F(ae,"operator",A),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:r("filter.sheet.operator")})}),e.jsx(J,{children:R.find(A=>A.value===B.field)?.operators.map(A=>e.jsx(U,{value:A.value,children:A.label},A.value))})]}),B.field&&B.operator&&se(B,ae)]},ae))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(D,{variant:"outline",onClick:()=>{x([]),d(!1)},children:r("filter.sheet.reset")}),e.jsx(D,{onClick:qe,children:r("filter.sheet.apply")})]})]})]})]}),o&&e.jsxs(D,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),x([])},className:"h-8 px-2 lg:px-3",children:[r("reset"),e.jsx(Ye,{className:"ml-2 h-4 w-4"})]}),e.jsxs(bs,{children:[e.jsx(ys,{asChild:!0,children:e.jsx(D,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:r("actions.title")})}),e.jsxs(us,{children:[e.jsx(fe,{onClick:()=>C(!0),children:r("actions.send_email")}),e.jsx(fe,{onClick:g,children:r("actions.export_csv")}),e.jsx(Zs,{}),e.jsx(fe,{onClick:()=>f(!0),className:"text-red-600 focus:text-red-600",children:r("actions.batch_ban")})]})]})]}),e.jsx(nh,{open:p,onOpenChange:C,table:s}),e.jsx(Fa,{open:P,onOpenChange:f,children:e.jsxs(Wt,{children:[e.jsxs(Yt,{children:[e.jsx(Jt,{children:r("actions.confirm_ban.title")}),e.jsx(Zt,{children:r(o?"actions.confirm_ban.filtered_description":"actions.confirm_ban.all_description")})]}),e.jsxs(Qt,{children:[e.jsx(ea,{disabled:j,children:r("actions.confirm_ban.cancel")}),e.jsx(Xt,{onClick:S,disabled:j,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:r(j?"actions.confirm_ban.banning":"actions.confirm_ban.confirm")})]})]})})]})}const mh=h.object({id:h.number(),email:h.string().email(),invite_user_email:h.string().email().nullable().optional(),password:h.string().optional().nullable(),balance:h.coerce.number(),commission_balance:h.coerce.number(),u:h.number(),d:h.number(),transfer_enable:h.number(),expired_at:h.number().nullable(),plan_id:h.number().nullable(),banned:h.number(),commission_type:h.number(),commission_rate:h.number().nullable(),discount:h.number().nullable(),speed_limit:h.number().nullable(),device_limit:h.number().nullable(),is_admin:h.number(),is_staff:h.number(),remarks:h.string().nullable()}),cl=u.createContext(void 0);function uh({children:s,defaultValues:n,open:a,onOpenChange:l}){const[r,c]=u.useState(!1),[o,m]=u.useState(!1),[x,i]=u.useState([]),d=je({resolver:Ne(mh),defaultValues:n,mode:"onChange"});u.useEffect(()=>{a!==void 0&&c(a)},[a]);const p=C=>{c(C),l?.(C)};return e.jsx(cl.Provider,{value:{form:d,formOpen:r,setFormOpen:p,datePickerOpen:o,setDatePickerOpen:m,planList:x,setPlanList:i},children:s})}function xh(){const s=u.useContext(cl);if(!s)throw new Error("useUserForm must be used within a UserFormProvider");return s}function hh({refetch:s}){const{t:n}=M("user"),{form:a,formOpen:l,setFormOpen:r,datePickerOpen:c,setDatePickerOpen:o,planList:m,setPlanList:x}=xh();return u.useEffect(()=>{l&&Us().then(({data:i})=>{x(i)})},[l,x]),e.jsxs(_e,{...a,children:[e.jsx(b,{control:a.control,name:"email",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.email")}),e.jsx(_,{children:e.jsx(k,{...i,placeholder:n("edit.form.email_placeholder")})}),e.jsx(T,{...i})]})}),e.jsx(b,{control:a.control,name:"invite_user_email",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.inviter_email")}),e.jsx(_,{children:e.jsx(k,{value:i.value||"",onChange:d=>i.onChange(d.target.value?d.target.value:null),placeholder:n("edit.form.inviter_email_placeholder")})}),e.jsx(T,{...i})]})}),e.jsx(b,{control:a.control,name:"password",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.password")}),e.jsx(_,{children:e.jsx(k,{value:i.value||"",onChange:i.onChange,placeholder:n("edit.form.password_placeholder")})}),e.jsx(T,{...i})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(b,{control:a.control,name:"balance",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.balance")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:i.value||"",onChange:i.onChange,placeholder:n("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(T,{...i})]})}),e.jsx(b,{control:a.control,name:"commission_balance",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.commission_balance")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:i.value||"",onChange:i.onChange,placeholder:n("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(T,{...i})]})}),e.jsx(b,{control:a.control,name:"u",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.upload")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{value:i.value/1024/1024/1024||"",onChange:d=>i.onChange(parseInt(d.target.value)*1024*1024*1024),placeholder:n("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(T,{...i})]})}),e.jsx(b,{control:a.control,name:"d",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.download")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:i.value/1024/1024/1024||"",onChange:d=>i.onChange(parseInt(d.target.value)*1024*1024*1024),placeholder:n("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(T,{...i})]})})]}),e.jsx(b,{control:a.control,name:"transfer_enable",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.total_traffic")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:i.value/1024/1024/1024||"",onChange:d=>i.onChange(parseInt(d.target.value)*1024*1024*1024),placeholder:n("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(T,{})]})}),e.jsx(b,{control:a.control,name:"expired_at",render:({field:i})=>e.jsxs(v,{className:"flex flex-col",children:[e.jsx(y,{children:n("edit.form.expire_time")}),e.jsxs(xs,{open:c,onOpenChange:o,children:[e.jsx(hs,{asChild:!0,children:e.jsx(_,{children:e.jsxs(D,{type:"button",variant:"outline",className:N("w-full pl-3 text-left font-normal",!i.value&&"text-muted-foreground"),onClick:()=>o(!0),children:[i.value?ve(i.value):e.jsx("span",{children:n("edit.form.expire_time_placeholder")}),e.jsx(pt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(os,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:d=>{d.preventDefault()},onEscapeKeyDown:d=>{d.preventDefault()},children:e.jsxs("div",{className:"flex flex-col space-y-3 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{i.onChange(null),o(!1)},children:n("edit.form.expire_time_permanent")}),e.jsx(D,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const d=new Date;d.setMonth(d.getMonth()+1),d.setHours(23,59,59,999),i.onChange(Math.floor(d.getTime()/1e3)),o(!1)},children:n("edit.form.expire_time_1month")}),e.jsx(D,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const d=new Date;d.setMonth(d.getMonth()+3),d.setHours(23,59,59,999),i.onChange(Math.floor(d.getTime()/1e3)),o(!1)},children:n("edit.form.expire_time_3months")})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Hs,{mode:"single",selected:i.value?new Date(i.value*1e3):void 0,onSelect:d=>{if(d){const p=new Date(i.value?i.value*1e3:Date.now());d.setHours(p.getHours(),p.getMinutes(),p.getSeconds()),i.onChange(Math.floor(d.getTime()/1e3))}},disabled:d=>d{const d=new Date;d.setHours(23,59,59,999),i.onChange(Math.floor(d.getTime()/1e3))},className:"h-6 px-2 text-xs",children:n("edit.form.expire_time_today")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{type:"datetime-local",step:"1",value:ve(i.value,"YYYY-MM-DDTHH:mm:ss"),onChange:d=>{const p=new Date(d.target.value);isNaN(p.getTime())||i.onChange(Math.floor(p.getTime()/1e3))},className:"flex-1"}),e.jsx(D,{type:"button",variant:"outline",onClick:()=>o(!1),children:n("edit.form.expire_time_confirm")})]})]})]})})]}),e.jsx(T,{})]})}),e.jsx(b,{control:a.control,name:"plan_id",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.subscription")}),e.jsx(_,{children:e.jsxs(X,{value:i.value?i.value.toString():"null",onValueChange:d=>i.onChange(d==="null"?null:parseInt(d)),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:n("edit.form.subscription_none")})}),e.jsxs(J,{children:[e.jsx(U,{value:"null",children:n("edit.form.subscription_none")}),m.map(d=>e.jsx(U,{value:d.id.toString(),children:d.name},d.id))]})]})})]})}),e.jsx(b,{control:a.control,name:"banned",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.account_status")}),e.jsx(_,{children:e.jsxs(X,{value:i.value.toString(),onValueChange:d=>i.onChange(parseInt(d)),children:[e.jsx(Q,{children:e.jsx(ee,{})}),e.jsxs(J,{children:[e.jsx(U,{value:"1",children:n("columns.status_text.banned")}),e.jsx(U,{value:"0",children:n("columns.status_text.normal")})]})]})})]})}),e.jsx(b,{control:a.control,name:"commission_type",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.commission_type")}),e.jsx(_,{children:e.jsxs(X,{value:i.value.toString(),onValueChange:d=>i.onChange(parseInt(d)),children:[e.jsx(Q,{children:e.jsx(ee,{placeholder:n("edit.form.subscription_none")})}),e.jsxs(J,{children:[e.jsx(U,{value:"0",children:n("edit.form.commission_type_system")}),e.jsx(U,{value:"1",children:n("edit.form.commission_type_cycle")}),e.jsx(U,{value:"2",children:n("edit.form.commission_type_onetime")})]})]})})]})}),e.jsx(b,{control:a.control,name:"commission_rate",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.commission_rate")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:i.value||"",onChange:d=>i.onChange(parseInt(d.currentTarget.value)||null),placeholder:n("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(b,{control:a.control,name:"discount",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.discount")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:i.value||"",onChange:d=>i.onChange(parseInt(d.currentTarget.value)||null),placeholder:n("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(T,{})]})}),e.jsx(b,{control:a.control,name:"speed_limit",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.speed_limit")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:i.value||"",onChange:d=>i.onChange(parseInt(d.currentTarget.value)||null),placeholder:n("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(T,{})]})}),e.jsx(b,{control:a.control,name:"device_limit",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.device_limit")}),e.jsx(_,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:i.value||"",onChange:d=>i.onChange(parseInt(d.currentTarget.value)||null),placeholder:n("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(T,{})]})}),e.jsx(b,{control:a.control,name:"is_admin",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.is_admin")}),e.jsx("div",{className:"py-2",children:e.jsx(_,{children:e.jsx(W,{checked:i.value===1,onCheckedChange:d=>i.onChange(d?1:0)})})})]})}),e.jsx(b,{control:a.control,name:"is_staff",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.is_staff")}),e.jsx("div",{className:"py-2",children:e.jsx(_,{children:e.jsx(W,{checked:i.value===1,onCheckedChange:d=>i.onChange(d?1:0)})})})]})}),e.jsx(b,{control:a.control,name:"remarks",render:({field:i})=>e.jsxs(v,{children:[e.jsx(y,{children:n("edit.form.remarks")}),e.jsx(_,{children:e.jsx(fs,{className:"h-24",value:i.value||"",onChange:d=>i.onChange(d.currentTarget.value??null),placeholder:n("edit.form.remarks_placeholder")})}),e.jsx(T,{})]})}),e.jsxs(ol,{children:[e.jsx(D,{variant:"outline",onClick:()=>r(!1),children:n("edit.form.cancel")}),e.jsx(D,{type:"submit",onClick:()=>{a.handleSubmit(i=>{zd(i).then(({data:d})=>{d&&($.success(n("edit.form.success")),r(!1),s())})})()},children:n("edit.form.submit")})]})]})}function dl({refetch:s,defaultValues:n,dialogTrigger:a=e.jsxs(D,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(gt,{className:"mr-2 h-4 w-4"}),t("edit.button")]})}){const{t:l}=M("user"),[r,c]=u.useState(!1);return e.jsx(uh,{defaultValues:n,open:r,onOpenChange:c,children:e.jsxs(rl,{open:r,onOpenChange:c,children:[e.jsx(ll,{asChild:!0,children:a}),e.jsxs(Aa,{className:"max-w-[90%] space-y-4",children:[e.jsxs($a,{children:[e.jsx(qa,{children:l("edit.title")}),e.jsx(Ua,{})]}),e.jsx(hh,{refetch:s})]})]})})}const 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.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"})}),ul=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"})}),fh=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"})}),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:"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"})}),ua=[{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:_c(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ml,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:ds(s.original.u)})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ul,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:ds(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(K,{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:ds(n)})}}];function xl({user_id:s,dialogTrigger:n}){const{t:a}=M(["traffic"]),[l,r]=u.useState(!1),[c,o]=u.useState({pageIndex:0,pageSize:20}),{data:m,isLoading:x}=ie({queryKey:["userStats",s,c,l],queryFn:()=>l?$d({user_id:s,pageSize:c.pageSize,page:c.pageIndex+1}):null}),i=Ze({data:m?.data??[],columns:ua,pageCount:Math.ceil((m?.total??0)/c.pageSize),state:{pagination:c},manualPagination:!0,getCoreRowModel:Xe(),onPaginationChange:o});return e.jsxs(be,{open:l,onOpenChange:r,children:[e.jsx(Ge,{asChild:!0,children:n}),e.jsxs(ge,{className:"sm:max-w-[700px]",children:[e.jsx(we,{children:e.jsx(ye,{children:a("trafficRecord.title")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(Ia,{children:[e.jsx(Va,{children:i.getHeaderGroups().map(d=>e.jsx(Ps,{children:d.headers.map(p=>e.jsx(Ma,{className:N("h-10 px-2 text-xs",p.id==="total"&&"text-right"),children:p.isPlaceholder?null:Rt(p.column.columnDef.header,p.getContext())},p.id))},d.id))}),e.jsx(Oa,{children:x?Array.from({length:c.pageSize}).map((d,p)=>e.jsx(Ps,{children:Array.from({length:ua.length}).map((C,P)=>e.jsx(Ys,{className:"p-2",children:e.jsx(oe,{className:"h-6 w-full"})},P))},p)):i.getRowModel().rows?.length?i.getRowModel().rows.map(d=>e.jsx(Ps,{"data-state":d.getIsSelected()&&"selected",className:"h-10",children:d.getVisibleCells().map(p=>e.jsx(Ys,{className:"px-2",children:Rt(p.column.columnDef.cell,p.getContext())},p.id))},d.id)):e.jsx(Ps,{children:e.jsx(Ys,{colSpan:ua.length,className:"h-24 text-center",children:a("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:a("trafficRecord.perPage")}),e.jsxs(X,{value:`${i.getState().pagination.pageSize}`,onValueChange:d=>{i.setPageSize(Number(d))},children:[e.jsx(Q,{className:"h-8 w-[70px]",children:e.jsx(ee,{placeholder:i.getState().pagination.pageSize})}),e.jsx(J,{side:"top",children:[10,20,30,40,50].map(d=>e.jsx(U,{value:`${d}`,children:d},d))})]}),e.jsx("p",{className:"text-sm font-medium",children:a("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:a("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()||x,children:e.jsx(fh,{className:"h-4 w-4"})}),e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>i.nextPage(),disabled:!i.getCanNextPage()||x,children:e.jsx(ph,{className:"h-4 w-4"})})]})]})]})]})]})]})}function gh({onConfirm:s,children:n,title:a="确认操作",description:l="确定要执行此操作吗?",cancelText:r="取消",confirmText:c="确认",variant:o="default",className:m}){return e.jsxs(Fa,{children:[e.jsx(Hr,{asChild:!0,children:n}),e.jsxs(Wt,{className:N("sm:max-w-[425px]",m),children:[e.jsxs(Yt,{children:[e.jsx(Jt,{children:a}),e.jsx(Zt,{children:l})]}),e.jsxs(Qt,{children:[e.jsx(ea,{asChild:!0,children:e.jsx(D,{variant:"outline",children:r})}),e.jsx(Xt,{asChild:!0,children:e.jsx(D,{variant:o,onClick:s,children:c})})]})]})]})}const jh=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"})}),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 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"})}),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:"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"})}),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 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"})}),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:"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"})}),_h=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"})}),wh=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"})}),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:"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"})}),Sh=(s,n)=>{const{t:a}=M("user");return[{accessorKey:"is_admin",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.is_admin")}),enableSorting:!1,enableHiding:!0,filterFn:(l,r,c)=>c.includes(l.getValue(r)),size:0},{accessorKey:"is_staff",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.is_staff")}),enableSorting:!1,enableHiding:!0,filterFn:(l,r,c)=>c.includes(l.getValue(r)),size:0},{accessorKey:"id",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx(K,{variant:"outline",children:l.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.email")}),cell:({row:l})=>{const r=l.original.t||0,c=Date.now()/1e3-r<120,o=Math.floor(Date.now()/1e3-r);let m=c?a("columns.online_status.online"):r===0?a("columns.online_status.never"):a("columns.online_status.last_online",{time:ve(r)});if(!c&&r!==0){const x=Math.floor(o/60),i=Math.floor(x/60),d=Math.floor(i/24);d>0?m+=` +`+a("columns.online_status.offline_duration.days",{count:d}):i>0?m+=` +`+a("columns.online_status.offline_duration.hours",{count:i}):x>0?m+=` `+a("columns.online_status.offline_duration.minutes",{count:x}):m+=` -`+a("columns.online_status.offline_duration.seconds",{count:i})}return e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:N("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(oe,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:m})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.online_count")}),cell:({row:l})=>{const r=l.original.device_limit,c=l.original.online_count||0;return e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(K,{variant:"outline",className:N("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(oe,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:r===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:r})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.status")}),cell:({row:l})=>{const r=l.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(K,{className:N("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:a(r?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(l,r,c)=>c.includes(l.getValue(r))},{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(K,{variant:"outline",className:N("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 r=cs(l.original?.total_used),c=cs(l.original?.transfer_enable),i=l.original?.total_used/l.original?.transfer_enable*100||0;return e.jsx(xe,{delayDuration:100,children:e.jsxs(me,{children:[e.jsx(ue,{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:[i.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:N("h-full rounded-full transition-all",i>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(i,100)}%`}})})]})}),e.jsx(oe,{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:cs(l.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.expire_time")}),cell:({row:l})=>{const r=l.original.expired_at,c=Date.now()/1e3,i=r!=null&&re.jsx(z,{column:l,title:a("columns.balance")}),cell:({row:l})=>{const r=Ws(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:r})]})}},{accessorKey:"commission_balance",header:({column:l})=>e.jsx(z,{column:l,title:a("columns.commission")}),cell:({row:l})=>{const r=Ws(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:r})]})}},{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:fe(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:r})=>e.jsxs(Ds,{modal:!0,children:[e.jsx(Es,{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(Dt,{className:"size-4"})})})}),e.jsxs(gs,{align:"end",className:"min-w-[40px]",children:[e.jsx(ye,{onSelect:c=>{c.preventDefault()},className:"p-0",children:e.jsx(tl,{defaultValues:{...l.original,invite_user_email:l.original.invite_user?.email},refetch:s,dialogTrigger:e.jsxs(B,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(rh,{className:"mr-2"}),a("columns.actions_menu.edit")]})})}),e.jsx(ye,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(Wr,{defaultValues:{email:l.original.email},trigger:e.jsxs(B,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(lh,{className:"mr-2 "}),a("columns.actions_menu.assign_order")]})})}),e.jsx(ye,{onSelect:()=>{Rt(l.original.subscribe_url).then(()=>{A.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(oh,{className:"mr-2"}),a("columns.actions_menu.copy_url")]})}),e.jsx(ye,{onSelect:()=>{Ed({id:l.original.id}).then(({data:c})=>{c&&A.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(ih,{className:"mr-2 "}),a("columns.actions_menu.reset_secret")]})}),e.jsx(ye,{onSelect:()=>{},className:"p-0",children:e.jsxs(Ls,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=${l.original?.id}`,children:[e.jsx(ch,{className:"mr-2"}),a("columns.actions_menu.orders")]})}),e.jsx(ye,{onSelect:()=>{r.setColumnFilters([{id:"invite_user_id",value:l.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(dh,{className:"mr-2 "}),a("columns.actions_menu.invites")]})}),e.jsx(ye,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(rl,{user_id:l.original?.id,dialogTrigger:e.jsxs(B,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(mh,{className:"mr-2 "}),a("columns.actions_menu.traffic_records")]})})}),e.jsx(ye,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(nh,{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 tm.destroy(l.original.id);c&&(A.success(a("common:delete.success")),s())}catch{A.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(uh,{className:"mr-2"}),a("columns.actions_menu.delete")]})})})]})]})}]};function hh(){const[s]=or(),[n,a]=u.useState({}),[l,r]=u.useState({is_admin:!1,is_staff:!1}),[c,i]=u.useState([]),[m,x]=u.useState([]),[o,d]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const P=s.get("email");P&&i(L=>L.some(O=>O.id==="email")?L:[...L,{id:"email",value:P}])},[s]);const{refetch:p,data:k,isLoading:I}=ne({queryKey:["userList",o,c,m],queryFn:()=>Pd({pageSize:o.pageSize,current:o.pageIndex+1,filter:c,sort:m})}),[f,j]=u.useState([]),[C,g]=u.useState([]);u.useEffect(()=>{qt().then(({data:P})=>{j(P)}),Hs().then(({data:P})=>{g(P)})},[]);const w=f.map(P=>({label:P.name,value:P.id})),T=C.map(P=>({label:P.name,value:P.id})),S=Ye({data:k?.data??[],columns:xh(p),state:{sorting:m,columnVisibility:l,rowSelection:n,columnFilters:c,pagination:o},rowCount:k?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:x,onColumnFiltersChange:i,onColumnVisibilityChange:r,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),onPaginationChange:d,getSortedRowModel:rs(),getFacetedRowModel:vs(),getFacetedUniqueValues:bs(),initialState:{columnVisibility:{commission_balance:!1,created_at:!1,is_admin:!1,is_staff:!1,permission_group:!1,plan_id:!1},columnPinning:{right:["actions"]}}});return e.jsx(os,{table:S,toolbar:e.jsx(Jx,{table:S,refetch:p,serverGroupList:f,permissionGroups:w,subscriptionPlans:T})})}function fh(){const{t:s}=F("user");return e.jsxs(ke,{children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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 ph=Object.freeze(Object.defineProperty({__proto__:null,default:fh},Symbol.toStringTag,{value:"Module"}));function gh({column:s,title:n,options:a}){const l=new Set(s?.getFilterValue());return e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsxs(B,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(zi,{className:"mr-2 h-4 w-4"}),n,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(we,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{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(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(r=>l.has(r.value)).map(r=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:r.label},`selected-${r.value}`))})]})]})}),e.jsx(ls,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Rs,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Is,{children:[e.jsx(qs,{children:"No results found."}),e.jsx($e,{children:a.map(r=>{const c=l.has(r.value);return e.jsxs(De,{onSelect:()=>{c?l.delete(r.value):l.add(r.value);const i=Array.from(l);s?.setFilterValue(i.length?i:void 0)},children:[e.jsx("div",{className:N("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(Li,{className:N("h-4 w-4")})}),r.icon&&e.jsx(r.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:r.label})]},`option-${r.value}`)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(et,{}),e.jsx($e,{children:e.jsx(De,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const jh=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 vh({table:s}){const{t:n}=F("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(va,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:a=>s.getColumn("status")?.setFilterValue(a),children:e.jsxs(Ht,{className:"grid w-full grid-cols-2",children:[e.jsx(Ts,{value:"0",children:n("status.pending")}),e.jsx(Ts,{value:"1",children:n("status.closed")})]})}),s.getColumn("level")&&e.jsx(gh,{column:s.getColumn("level"),title:n("columns.level"),options:[{label:n("level.low"),value:Ie.LOW,icon:jh,color:"gray"},{label:n("level.medium"),value:Ie.MIDDLE,icon:al,color:"yellow"},{label:n("level.high"),value:Ie.HIGH,icon:nl,color:"red"}]})]})})}function bh(){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 yh=Os("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"}}),ll=u.forwardRef(({className:s,variant:n,layout:a,children:l,...r},c)=>e.jsx("div",{className:N(yh({variant:n,layout:a,className:s}),"relative group"),ref:c,...r,children:u.Children.map(l,i=>u.isValidElement(i)&&typeof i.type!="string"?u.cloneElement(i,{variant:n,layout:a}):i)}));ll.displayName="ChatBubble";const Nh=Os("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"}}),ol=u.forwardRef(({className:s,variant:n,layout:a,isLoading:l=!1,children:r,...c},i)=>e.jsx("div",{className:N(Nh({variant:n,layout:a,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:i,...c,children:l?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(bh,{})}):r}));ol.displayName="ChatBubbleMessage";const _h=u.forwardRef(({variant:s,className:n,children:a,...l},r)=>e.jsx("div",{ref:r,className:N("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),...l,children:a}));_h.displayName="ChatBubbleActionWrapper";const il=u.forwardRef(({className:s,...n},a)=>e.jsx(_s,{autoComplete:"off",ref:a,name:"message",className:N("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}));il.displayName="ChatInput";const cl=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"})}),dl=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"})}),rn=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"})}),wh=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"})}),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:"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"})}),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:"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 kh(){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(re,{className:"h-8 w-3/4"}),e.jsx(re,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(re,{className:"h-20 w-2/3"},s))})]})}function Th(){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(re,{className:"h-5 w-4/5"}),e.jsx(re,{className:"h-4 w-2/3"}),e.jsx(re,{className:"h-3 w-1/2"})]},s))})}function Ph({ticket:s,isActive:n,onClick:a}){const{t:l}=F("ticket"),r=c=>{switch(c){case Ie.HIGH:return"bg-red-50 text-red-600 border-red-200";case Ie.MIDDLE:return"bg-yellow-50 text-yellow-600 border-yellow-200";case Ie.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:N("flex cursor-pointer flex-col border-b p-4 hover:bg-accent/50",n&&"bg-accent"),onClick:a,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 max-w-[280px]",children:[e.jsx("h4",{className:"truncate font-medium flex-1",children:s.subject}),e.jsx(K,{variant:s.status===Ps.CLOSED?"secondary":"default",className:"shrink-0",children:s.status===Ps.CLOSED?l("status.closed"):l("status.processing")})]}),e.jsx("div",{className:"mt-1 text-sm text-muted-foreground truncate max-w-[280px]",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:fe(s.updated_at)}),e.jsx("div",{className:N("px-2 py-0.5 rounded-full border text-xs font-medium",r(s.level)),children:l(`level.${s.level===Ie.LOW?"low":s.level===Ie.MIDDLE?"medium":"high"}`)})]})]})}function Dh({ticketId:s,dialogTrigger:n}){const{t:a}=F("ticket"),l=js(),r=u.useRef(null),c=u.useRef(null),[i,m]=u.useState(!1),[x,o]=u.useState(""),[d,p]=u.useState(!1),[k,I]=u.useState(s),[f,j]=u.useState(""),[C,g]=u.useState(!1),{data:w,isLoading:T,refetch:S}=ne({queryKey:["tickets",i],queryFn:()=>i?Wt.getList({filter:[{id:"status",value:[Ps.OPENING]}]}):Promise.resolve(null),enabled:i}),{data:P,refetch:L,isLoading:G}=ne({queryKey:["ticket",k,i],queryFn:()=>i?Fd(k):Promise.resolve(null),refetchInterval:i?5e3:!1,retry:3}),O=P?.data,Je=(w?.data||[]).filter(te=>te.subject.toLowerCase().includes(f.toLowerCase())||te.user?.email.toLowerCase().includes(f.toLowerCase())),is=(te="smooth")=>{if(r.current){const{scrollHeight:Ue,clientHeight:st}=r.current;r.current.scrollTo({top:Ue-st,behavior:te})}};u.useEffect(()=>{if(!i)return;const te=requestAnimationFrame(()=>{is("instant"),setTimeout(()=>is(),1e3)});return()=>{cancelAnimationFrame(te)}},[i,O?.messages]);const Vs=async()=>{const te=x.trim();!te||d||(p(!0),Wt.reply({id:k,message:te}).then(()=>{o(""),L(),is(),setTimeout(()=>{c.current?.focus()},0)}).finally(()=>{p(!1)}))},ee=async()=>{Wt.close(k).then(()=>{A.success(a("actions.close_success")),L(),S()})},$=()=>{O?.user&&l("/finance/order?user_id="+O.user.id)},ae=O?.status===Ps.CLOSED;return e.jsxs(ve,{open:i,onOpenChange:m,children:[e.jsx(He,{asChild:!0,children:n??e.jsx(B,{variant:"outline",children:a("actions.view_ticket")})}),e.jsxs(pe,{className:"flex h-[90vh] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(be,{}),e.jsxs("div",{className:"flex h-full",children:[e.jsx(B,{variant:"ghost",size:"icon",className:"absolute left-2 top-2 md:hidden z-50",onClick:()=>g(!C),children:e.jsx(rn,{className:N("h-4 w-4 transition-transform",!C&&"rotate-180")})}),e.jsxs("div",{className:N("absolute md:relative inset-y-0 left-0 z-40 flex flex-col border-r bg-background transition-transform duration-200 ease-in-out",C?"-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:a("list.title")}),e.jsx(B,{variant:"ghost",size:"icon",className:"hidden md:flex h-8 w-8",onClick:()=>g(!C),children:e.jsx(rn,{className:N("h-4 w-4 transition-transform",!C&&"rotate-180")})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(wh,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"}),e.jsx(D,{placeholder:a("list.search_placeholder"),value:f,onChange:te=>j(te.target.value),className:"pl-8"})]})]}),e.jsx(Zs,{className:"flex-1",children:e.jsx("div",{className:"w-full",children:T?e.jsx(Th,{}):Je.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground p-4",children:a(f?"list.no_search_results":"list.no_tickets")}):Je.map(te=>e.jsx(Ph,{ticket:te,isActive:te.id===k,onClick:()=>{I(te.id),window.innerWidth<768&&g(!0)}},te.id))})})]}),e.jsxs("div",{className:"flex-1 flex flex-col relative",children:[!C&&e.jsx("div",{className:"absolute inset-0 bg-black/20 z-30 md:hidden",onClick:()=>g(!0)}),G?e.jsx(kh,{}):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:O?.subject}),e.jsx(K,{variant:ae?"secondary":"default",children:a(ae?"status.closed":"status.processing")}),!ae&&e.jsx(qe,{title:a("actions.close_confirm_title"),description:a("actions.close_confirm_description"),confirmText:a("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(cl,{className:"h-4 w-4"}),a("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(ht,{className:"h-4 w-4"}),e.jsx("span",{children:O?.user?.email})]}),e.jsx(we,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(dl,{className:"h-4 w-4"}),e.jsxs("span",{children:[a("detail.created_at")," ",fe(O?.created_at)]})]}),e.jsx(we,{orientation:"vertical",className:"h-4"}),e.jsx(K,{variant:"outline",children:O?.level!=null&&a(`level.${O.level===Ie.LOW?"low":O.level===Ie.MIDDLE?"medium":"high"}`)})]})]}),O?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(tl,{defaultValues:O.user,refetch:L,dialogTrigger:e.jsx(B,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.user_info"),children:e.jsx(ht,{className:"h-4 w-4"})})}),e.jsx(rl,{user_id:O.user.id,dialogTrigger:e.jsx(B,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.traffic_records"),children:e.jsx(Ch,{className:"h-4 w-4"})})}),e.jsx(B,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.order_records"),onClick:$,children:e.jsx(Sh,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:r,className:"h-full space-y-4 overflow-y-auto p-6",children:O?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a("detail.no_messages")}):O?.messages?.map(te=>e.jsx(ll,{variant:te.is_me?"sent":"received",className:te.is_me?"ml-auto":"mr-auto",children:e.jsx(ol,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:te.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:fe(te.created_at)})})]})})},te.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(il,{ref:c,disabled:ae||d,placeholder:a(ae?"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:x,onChange:te=>o(te.target.value),onKeyDown:te=>{te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),Vs())}}),e.jsx(B,{disabled:ae||d||!x.trim(),onClick:Vs,children:a(d?"detail.input.sending":"detail.input.send")})]})})]})]})]})]})]})}const Eh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 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"})}),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.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"})}),Ih=s=>{const{t:n}=F("ticket");return[{accessorKey:"id",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.id")}),cell:({row:a})=>e.jsx(K,{variant:"outline",children:a.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.subject")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Eh,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:a.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.level")}),cell:({row:a})=>{const l=a.getValue("level"),r=l===Ie.LOW?"default":l===Ie.MIDDLE?"secondary":"destructive";return e.jsx(K,{variant:r,className:"whitespace-nowrap",children:n(`level.${l===Ie.LOW?"low":l===Ie.MIDDLE?"medium":"high"}`)})},filterFn:(a,l,r)=>r.includes(a.getValue(l))},{accessorKey:"status",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.status")}),cell:({row:a})=>{const l=a.getValue("status"),r=a.original.reply_status,c=l===Ps.CLOSED?n("status.closed"):n(r===0?"status.replied":"status.pending"),i=l===Ps.CLOSED?"default":r===0?"secondary":"destructive";return e.jsx(K,{variant:i,className:"whitespace-nowrap",children:c})}},{accessorKey:"updated_at",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.updated_at")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(dl,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:fe(a.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:a})=>e.jsx(z,{column:a,title:n("columns.created_at")}),cell:({row:a})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:fe(a.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:a})=>e.jsx(z,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>{const l=a.original.status!==Ps.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Dh,{ticketId:a.original.id,dialogTrigger:e.jsx(B,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.view_details"),children:e.jsx(Rh,{className:"h-4 w-4"})})}),l&&e.jsx(qe,{title:n("actions.close_confirm_title"),description:n("actions.close_confirm_description"),confirmText:n("actions.close_confirm_button"),variant:"destructive",onConfirm:async()=>{Md(a.original.id).then(()=>{A.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(cl,{className:"h-4 w-4"})})})]})}}]};function Vh(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,c]=u.useState([{id:"status",value:"0"}]),[i,m]=u.useState([]),[x,o]=u.useState({pageIndex:0,pageSize:20}),{refetch:d,data:p,isLoading:k}=ne({queryKey:["orderList",x,r,i],queryFn:()=>Vd({pageSize:x.pageSize,current:x.pageIndex+1,filter:r,sort:i})}),I=Ye({data:p?.data??[],columns:Ih(d),state:{sorting:i,columnVisibility:a,rowSelection:s,columnFilters:r,pagination:x},rowCount:p?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,getCoreRowModel:Qe(),getFilteredRowModel:as(),getPaginationRowModel:ns(),onPaginationChange:o,getSortedRowModel:rs(),getFacetedRowModel:vs(),getFacetedUniqueValues:bs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(vh,{table:I,refetch:d}),e.jsx(os,{table:I,showPagination:!0})]})}function Fh(){const{t:s}=F("ticket");return e.jsxs(ke,{children:[e.jsxs(Te,{children:[e.jsx(ze,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(Me,{})]})]}),e.jsxs(Re,{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,{})})]})]})}const Mh=Object.freeze(Object.defineProperty({__proto__:null,default:Fh},Symbol.toStringTag,{value:"Module"}));export{$h as a,Lh as c,Ah as g,qh as r}; +`+a("columns.online_status.offline_duration.seconds",{count:o})}return e.jsx(pe,{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:N("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:m})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.online_count")}),cell:({row:l})=>{const r=l.original.device_limit,c=l.original.online_count||0;return e.jsx(pe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(K,{variant:"outline",className:N("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(ce,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:r===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:r})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.status")}),cell:({row:l})=>{const r=l.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(K,{className:N("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:a(r?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(l,r,c)=>c.includes(l.getValue(r))},{accessorKey:"plan_id",header:({column:l})=>e.jsx(L,{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(L,{column:l,title:a("columns.group")}),cell:({row:l})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(K,{variant:"outline",className:N("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(L,{column:l,title:a("columns.used_traffic")}),cell:({row:l})=>{const r=ds(l.original?.total_used),c=ds(l.original?.transfer_enable),o=l.original?.total_used/l.original?.transfer_enable*100||0;return e.jsx(pe,{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:[o.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:N("h-full rounded-full transition-all",o>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(o,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(L,{column:l,title:a("columns.total_traffic")}),cell:({row:l})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ds(l.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.expire_time")}),cell:({row:l})=>{const r=l.original.expired_at,c=Date.now()/1e3,o=r!=null&&re.jsx(L,{column:l,title:a("columns.balance")}),cell:({row:l})=>{const r=Ws(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:r})]})}},{accessorKey:"commission_balance",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.commission")}),cell:({row:l})=>{const r=Ws(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:r})]})}},{accessorKey:"created_at",header:({column:l})=>e.jsx(L,{column:l,title:a("columns.register_time")}),cell:({row:l})=>e.jsx("div",{className:"truncate",children:ve(l.original?.created_at)}),size:1e3},{id:"actions",header:({column:l})=>e.jsx(L,{column:l,className:"justify-end",title:a("columns.actions")}),cell:({row:l,table:r})=>e.jsxs(bs,{modal:!0,children:[e.jsx(ys,{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":a("columns.actions"),children:e.jsx(Vt,{className:"size-4"})})})}),e.jsxs(us,{align:"end",className:"min-w-[40px]",children:[e.jsx(fe,{onSelect:c=>{c.preventDefault()},className:"p-0",children:e.jsx(dl,{defaultValues:{...l.original,invite_user_email:l.original.invite_user?.email},refetch:s,dialogTrigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(jh,{className:"mr-2"}),a("columns.actions_menu.edit")]})})}),e.jsx(fe,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(sl,{defaultValues:{email:l.original.email},trigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(vh,{className:"mr-2 "}),a("columns.actions_menu.assign_order")]})})}),e.jsx(fe,{onSelect:()=>{Mt(l.original.subscribe_url).then(()=>{$.success(a("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(bh,{className:"mr-2"}),a("columns.actions_menu.copy_url")]})}),e.jsx(fe,{onSelect:()=>{Ld({id:l.original.id}).then(({data:c})=>{c&&$.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(yh,{className:"mr-2 "}),a("columns.actions_menu.reset_secret")]})}),e.jsx(fe,{onSelect:()=>{},className:"p-0",children:e.jsxs(Ls,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=${l.original?.id}`,children:[e.jsx(Nh,{className:"mr-2"}),a("columns.actions_menu.orders")]})}),e.jsx(fe,{onSelect:()=>{r.setColumnFilters([{id:"invite_user_id",value:l.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(_h,{className:"mr-2 "}),a("columns.actions_menu.invites")]})}),e.jsx(fe,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(xl,{user_id:l.original?.id,dialogTrigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(wh,{className:"mr-2 "}),a("columns.actions_menu.traffic_records")]})})}),e.jsx(fe,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(gh,{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 zt.destroy(l.original.id);c&&($.success(a("common:delete.success")),s())}catch{$.error(a("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(Ch,{className:"mr-2"}),a("columns.actions_menu.delete")]})})})]})]})}]};function kh(){const[s]=fr(),[n,a]=u.useState({}),[l,r]=u.useState({is_admin:!1,is_staff:!1}),[c,o]=u.useState([]),[m,x]=u.useState([]),[i,d]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const O=s.get("email");O&&o(q=>q.some(F=>F.id==="email")?q:[...q,{id:"email",value:O}])},[s]);const{refetch:p,data:C,isLoading:P}=ie({queryKey:["userList",i,c,m],queryFn:()=>Fd({pageSize:i.pageSize,current:i.pageIndex+1,filter:c,sort:m})}),[f,j]=u.useState([]),[w,g]=u.useState([]);u.useEffect(()=>{vt().then(({data:O})=>{j(O)}),Us().then(({data:O})=>{g(O)})},[]);const S=f.map(O=>({label:O.name,value:O.id})),R=w.map(O=>({label:O.name,value:O.id})),E=Ze({data:C?.data??[],columns:Sh(p),state:{sorting:m,columnVisibility:l,rowSelection:n,columnFilters:c,pagination:i},rowCount:C?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:x,onColumnFiltersChange:o,onColumnVisibilityChange:r,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),onPaginationChange:d,getSortedRowModel:is(),getFacetedRowModel:_s(),getFacetedUniqueValues:ws(),initialState:{columnVisibility:{commission_balance:!1,created_at:!1,is_admin:!1,is_staff:!1,permission_group:!1,plan_id:!1},columnPinning:{right:["actions"]}}});return e.jsx(cs,{table:E,toolbar:e.jsx(dh,{table:E,refetch:p,serverGroupList:f,permissionGroups:S,subscriptionPlans:R})})}function Th(){const{t:s}=M("user");return e.jsxs(Pe,{children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(kh,{})})})]})]})}const Dh=Object.freeze(Object.defineProperty({__proto__:null,default:Th},Symbol.toStringTag,{value:"Module"}));function Ph({column:s,title:n,options:a}){const l=new Set(s?.getFilterValue());return e.jsxs(xs,{children:[e.jsx(hs,{asChild:!0,children:e.jsxs(G,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Bo,{className:"mr-2 h-4 w-4"}),n,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Se,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{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(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(r=>l.has(r.value)).map(r=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:r.label},`selected-${r.value}`))})]})]})}),e.jsx(os,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Is,{children:[e.jsx($s,{placeholder:n}),e.jsxs(Vs,{children:[e.jsx(qs,{children:"No results found."}),e.jsx(Ke,{children:a.map(r=>{const c=l.has(r.value);return e.jsxs(Ie,{onSelect:()=>{c?l.delete(r.value):l.add(r.value);const o=Array.from(l);s?.setFilterValue(o.length?o:void 0)},children:[e.jsx("div",{className:N("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(Go,{className:N("h-4 w-4")})}),r.icon&&e.jsx(r.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:r.label})]},`option-${r.value}`)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(st,{}),e.jsx(Ke,{children:e.jsx(Ie,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Eh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function Rh({table:s}){const{t:n}=M("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(Ra,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:a=>s.getColumn("status")?.setFilterValue(a),children:e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Es,{value:"0",children:n("status.pending")}),e.jsx(Es,{value:"1",children:n("status.closed")})]})}),s.getColumn("level")&&e.jsx(Ph,{column:s.getColumn("level"),title:n("columns.level"),options:[{label:n("level.low"),value:Oe.LOW,icon:Eh,color:"gray"},{label:n("level.medium"),value:Oe.MIDDLE,icon:ml,color:"yellow"},{label:n("level.high"),value:Oe.HIGH,icon:ul,color:"red"}]})]})})}function Ih(){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 Vh=Fs("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=u.forwardRef(({className:s,variant:n,layout:a,children:l,...r},c)=>e.jsx("div",{className:N(Vh({variant:n,layout:a,className:s}),"relative group"),ref:c,...r,children:u.Children.map(l,o=>u.isValidElement(o)&&typeof o.type!="string"?u.cloneElement(o,{variant:n,layout:a}):o)}));hl.displayName="ChatBubble";const Oh=Fs("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"}}),fl=u.forwardRef(({className:s,variant:n,layout:a,isLoading:l=!1,children:r,...c},o)=>e.jsx("div",{className:N(Oh({variant:n,layout:a,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:o,...c,children:l?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(Ih,{})}):r}));fl.displayName="ChatBubbleMessage";const Mh=u.forwardRef(({variant:s,className:n,children:a,...l},r)=>e.jsx("div",{ref:r,className:N("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),...l,children:a}));Mh.displayName="ChatBubbleActionWrapper";const pl=u.forwardRef(({className:s,...n},a)=>e.jsx(fs,{autoComplete:"off",ref:a,name:"message",className:N("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}));pl.displayName="ChatInput";const 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:"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"})}),jl=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"})}),hn=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"})}),Fh=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"})}),zh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M3.71 16.29a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21a1 1 0 0 0-.21.33a1 1 0 0 0 .21 1.09a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1 1 0 0 0 .21-1.09a1 1 0 0 0-.21-.33M7 8h14a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m-3.29 3.29a1 1 0 0 0-1.09-.21a1.2 1.2 0 0 0-.33.21a1 1 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1 1 0 0 0-.21-.33M21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2M3.71 6.29a1 1 0 0 0-.33-.21a1 1 0 0 0-1.09.21a1.2 1.2 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a1 1 0 0 0 1.09-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1.2 1.2 0 0 0-.21-.33M21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})}),Lh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9 12H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m-1-2h4a1 1 0 0 0 0-2H8a1 1 0 0 0 0 2m1 6H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m12-4h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Zm-6.44-2.83a.8.8 0 0 0-.18-.09a.6.6 0 0 0-.19-.06a1 1 0 0 0-.9.27A1.05 1.05 0 0 0 12 17a1 1 0 0 0 .07.38a1.2 1.2 0 0 0 .22.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21A1 1 0 0 0 14 17a1.05 1.05 0 0 0-.29-.71a2 2 0 0 0-.15-.12m.14-3.88a1 1 0 0 0-1.62.33A1 1 0 0 0 13 14a1 1 0 0 0 1-1a1 1 0 0 0-.08-.38a.9.9 0 0 0-.22-.33"})});function Ah(){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 $h(){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 qh({ticket:s,isActive:n,onClick:a}){const{t:l}=M("ticket"),r=c=>{switch(c){case Oe.HIGH:return"bg-red-50 text-red-600 border-red-200";case Oe.MIDDLE:return"bg-yellow-50 text-yellow-600 border-yellow-200";case Oe.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:N("flex cursor-pointer flex-col border-b p-4 hover:bg-accent/50",n&&"bg-accent"),onClick:a,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 max-w-[280px]",children:[e.jsx("h4",{className:"truncate font-medium flex-1",children:s.subject}),e.jsx(K,{variant:s.status===Rs.CLOSED?"secondary":"default",className:"shrink-0",children:s.status===Rs.CLOSED?l("status.closed"):l("status.processing")})]}),e.jsx("div",{className:"mt-1 text-sm text-muted-foreground truncate max-w-[280px]",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:ve(s.updated_at)}),e.jsx("div",{className:N("px-2 py-0.5 rounded-full border text-xs font-medium",r(s.level)),children:l(`level.${s.level===Oe.LOW?"low":s.level===Oe.MIDDLE?"medium":"high"}`)})]})]})}function Uh({ticketId:s,dialogTrigger:n}){const{t:a}=M("ticket"),l=Ns(),r=u.useRef(null),c=u.useRef(null),[o,m]=u.useState(!1),[x,i]=u.useState(""),[d,p]=u.useState(!1),[C,P]=u.useState(s),[f,j]=u.useState(""),[w,g]=u.useState(!1),{data:S,isLoading:R,refetch:E}=ie({queryKey:["tickets",o],queryFn:()=>o?ra.getList({filter:[{id:"status",value:[Rs.OPENING]}]}):Promise.resolve(null),enabled:o}),{data:O,refetch:q,isLoading:te}=ie({queryKey:["ticket",C,o],queryFn:()=>o?Ud(C):Promise.resolve(null),refetchInterval:o?5e3:!1,retry:3}),F=O?.data,qe=(S?.data||[]).filter(ne=>ne.subject.toLowerCase().includes(f.toLowerCase())||ne.user?.email.toLowerCase().includes(f.toLowerCase())),B=(ne="smooth")=>{if(r.current){const{scrollHeight:We,clientHeight:tt}=r.current;r.current.scrollTo({top:We-tt,behavior:ne})}};u.useEffect(()=>{if(!o)return;const ne=requestAnimationFrame(()=>{B("instant"),setTimeout(()=>B(),1e3)});return()=>{cancelAnimationFrame(ne)}},[o,F?.messages]);const ae=async()=>{const ne=x.trim();!ne||d||(p(!0),ra.reply({id:C,message:ne}).then(()=>{i(""),q(),B(),setTimeout(()=>{c.current?.focus()},0)}).finally(()=>{p(!1)}))},A=async()=>{ra.close(C).then(()=>{$.success(a("actions.close_success")),q(),E()})},I=()=>{F?.user&&l("/finance/order?user_id="+F.user.id)},Y=F?.status===Rs.CLOSED;return e.jsxs(be,{open:o,onOpenChange:m,children:[e.jsx(Ge,{asChild:!0,children:n??e.jsx(G,{variant:"outline",children:a("actions.view_ticket")})}),e.jsxs(ge,{className:"flex h-[90vh] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(ye,{}),e.jsxs("div",{className:"flex h-full",children:[e.jsx(G,{variant:"ghost",size:"icon",className:"absolute left-2 top-2 md:hidden z-50",onClick:()=>g(!w),children:e.jsx(hn,{className:N("h-4 w-4 transition-transform",!w&&"rotate-180")})}),e.jsxs("div",{className:N("absolute md:relative inset-y-0 left-0 z-40 flex flex-col border-r bg-background transition-transform duration-200 ease-in-out",w?"-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:a("list.title")}),e.jsx(G,{variant:"ghost",size:"icon",className:"hidden md:flex h-8 w-8",onClick:()=>g(!w),children:e.jsx(hn,{className:N("h-4 w-4 transition-transform",!w&&"rotate-180")})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Fh,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"}),e.jsx(k,{placeholder:a("list.search_placeholder"),value:f,onChange:ne=>j(ne.target.value),className:"pl-8"})]})]}),e.jsx(Xs,{className:"flex-1",children:e.jsx("div",{className:"w-full",children:R?e.jsx($h,{}):qe.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground p-4",children:a(f?"list.no_search_results":"list.no_tickets")}):qe.map(ne=>e.jsx(qh,{ticket:ne,isActive:ne.id===C,onClick:()=>{P(ne.id),window.innerWidth<768&&g(!0)}},ne.id))})})]}),e.jsxs("div",{className:"flex-1 flex flex-col relative",children:[!w&&e.jsx("div",{className:"absolute inset-0 bg-black/20 z-30 md:hidden",onClick:()=>g(!0)}),te?e.jsx(Ah,{}):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:F?.subject}),e.jsx(K,{variant:Y?"secondary":"default",children:a(Y?"status.closed":"status.processing")}),!Y&&e.jsx(Be,{title:a("actions.close_confirm_title"),description:a("actions.close_confirm_description"),confirmText:a("actions.close_confirm_button"),variant:"destructive",onConfirm:A,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(gl,{className:"h-4 w-4"}),a("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(ft,{className:"h-4 w-4"}),e.jsx("span",{children:F?.user?.email})]}),e.jsx(Se,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(jl,{className:"h-4 w-4"}),e.jsxs("span",{children:[a("detail.created_at")," ",ve(F?.created_at)]})]}),e.jsx(Se,{orientation:"vertical",className:"h-4"}),e.jsx(K,{variant:"outline",children:F?.level!=null&&a(`level.${F.level===Oe.LOW?"low":F.level===Oe.MIDDLE?"medium":"high"}`)})]})]}),F?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(dl,{defaultValues:F.user,refetch:q,dialogTrigger:e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.user_info"),children:e.jsx(ft,{className:"h-4 w-4"})})}),e.jsx(xl,{user_id:F.user.id,dialogTrigger:e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.traffic_records"),children:e.jsx(zh,{className:"h-4 w-4"})})}),e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.order_records"),onClick:I,children:e.jsx(Lh,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:r,className:"h-full space-y-4 overflow-y-auto p-6",children:F?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a("detail.no_messages")}):F?.messages?.map(ne=>e.jsx(hl,{variant:ne.is_me?"sent":"received",className:ne.is_me?"ml-auto":"mr-auto",children:e.jsx(fl,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:ne.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:ve(ne.created_at)})})]})})},ne.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(pl,{ref:c,disabled:Y||d,placeholder:a(Y?"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:x,onChange:ne=>i(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),ae())}}),e.jsx(G,{disabled:Y||d||!x.trim(),onClick:ae,children:a(d?"detail.input.sending":"detail.input.send")})]})})]})]})]})]})]})}const 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:"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"})}),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:"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"})}),Bh=s=>{const{t:n}=M("ticket");return[{accessorKey:"id",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.id")}),cell:({row:a})=>e.jsx(K,{variant:"outline",children:a.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.subject")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Hh,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:a.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.level")}),cell:({row:a})=>{const l=a.getValue("level"),r=l===Oe.LOW?"default":l===Oe.MIDDLE?"secondary":"destructive";return e.jsx(K,{variant:r,className:"whitespace-nowrap",children:n(`level.${l===Oe.LOW?"low":l===Oe.MIDDLE?"medium":"high"}`)})},filterFn:(a,l,r)=>r.includes(a.getValue(l))},{accessorKey:"status",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.status")}),cell:({row:a})=>{const l=a.getValue("status"),r=a.original.reply_status,c=l===Rs.CLOSED?n("status.closed"):n(r===0?"status.replied":"status.pending"),o=l===Rs.CLOSED?"default":r===0?"secondary":"destructive";return e.jsx(K,{variant:o,className:"whitespace-nowrap",children:c})}},{accessorKey:"updated_at",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.updated_at")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(jl,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:ve(a.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:a})=>e.jsx(L,{column:a,title:n("columns.created_at")}),cell:({row:a})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:ve(a.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:a})=>e.jsx(L,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>{const l=a.original.status!==Rs.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Uh,{ticketId:a.original.id,dialogTrigger:e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.view_details"),children:e.jsx(Kh,{className:"h-4 w-4"})})}),l&&e.jsx(Be,{title:n("actions.close_confirm_title"),description:n("actions.close_confirm_description"),confirmText:n("actions.close_confirm_button"),variant:"destructive",onConfirm:async()=>{Hd(a.original.id).then(()=>{$.success(n("actions.close_success")),s()})},children:e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.close_ticket"),children:e.jsx(gl,{className:"h-4 w-4"})})})]})}}]};function Gh(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,c]=u.useState([{id:"status",value:"0"}]),[o,m]=u.useState([]),[x,i]=u.useState({pageIndex:0,pageSize:20}),{refetch:d,data:p,isLoading:C}=ie({queryKey:["orderList",x,r,o],queryFn:()=>qd({pageSize:x.pageSize,current:x.pageIndex+1,filter:r,sort:o})}),P=Ze({data:p?.data??[],columns:Bh(d),state:{sorting:o,columnVisibility:a,rowSelection:s,columnFilters:r,pagination:x},rowCount:p?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:c,onColumnVisibilityChange:l,getCoreRowModel:Xe(),getFilteredRowModel:rs(),getPaginationRowModel:ls(),onPaginationChange:i,getSortedRowModel:is(),getFacetedRowModel:_s(),getFacetedUniqueValues:ws(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Rh,{table:P,refetch:d}),e.jsx(cs,{table:P,showPagination:!0})]})}function Wh(){const{t:s}=M("ticket");return e.jsxs(Pe,{children:[e.jsxs(Ee,{children:[e.jsx($e,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Fe,{}),e.jsx(ze,{})]})]}),e.jsxs(Ve,{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(Gh,{})})]})]})}const Yh=Object.freeze(Object.defineProperty({__proto__:null,default:Wh},Symbol.toStringTag,{value:"Module"}));export{ef as a,Zh as c,Xh as g,sf as r}; diff --git a/public/assets/admin/locales/en-US.js b/public/assets/admin/locales/en-US.js index e78342a..8e02583 100644 --- a/public/assets/admin/locales/en-US.js +++ b/public/assets/admin/locales/en-US.js @@ -1904,6 +1904,45 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "submit": "Submit", "success": "Modified successfully" } + }, + "actions": { + "title": "Actions", + "send_email": "Send Email", + "export_csv": "Export CSV", + "batch_ban": "Batch Ban", + "confirm_ban": { + "title": "Confirm Batch Ban", + "filtered_description": "This action will ban all users that match your current filters. This action cannot be undone.", + "all_description": "This action will ban all users in the system. This action cannot be undone.", + "cancel": "Cancel", + "confirm": "Confirm Ban", + "banning": "Banning..." + } + }, + "messages": { + "success": "Success", + "error": "Error", + "export": { + "success": "Export successful", + "failed": "Export failed" + }, + "batch_ban": { + "success": "Batch ban successful", + "failed": "Batch ban failed" + }, + "send_mail": { + "success": "Email sent successfully", + "failed": "Failed to send email", + "required_fields": "Please fill in all required fields" + } + }, + "send_mail": { + "title": "Send Email", + "description": "Send email to selected or filtered users", + "subject": "Subject", + "content": "Content", + "sending": "Sending...", + "send": "Send" } }, "subscribe": { @@ -2024,7 +2063,7 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "template": { "button": "Use Template", "tooltip": "Use default template", - "content": "## Plan Features\n\n- Traffic: {{transfer}} GB\n- Speed: {{speed}} Mbps\n- Devices: {{devices}}\n\n## Usage Notes\n\n1. The plan is valid for {{validity}} days\n2. Traffic resets {{reset_method}}\n3. Maximum {{capacity}} concurrent users" + "content": "## Plan Details\n\n- Data: {{transfer}} GB\n- Speed Limit: {{speed}} Mbps\n- Concurrent Devices: {{devices}}\n\n## Service Information\n\n1. Data {{reset_method}}\n2. Multi-platform Support\n3. 24/7 Technical Support" } }, "force_update": { diff --git a/public/assets/admin/locales/ko-KR.js b/public/assets/admin/locales/ko-KR.js index d15006f..40ce0d0 100644 --- a/public/assets/admin/locales/ko-KR.js +++ b/public/assets/admin/locales/ko-KR.js @@ -1854,6 +1854,45 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "submit": "제출", "success": "수정 완료" } + }, + "actions": { + "title": "작업", + "send_email": "이메일 보내기", + "export_csv": "CSV 내보내기", + "batch_ban": "일괄 차단", + "confirm_ban": { + "title": "일괄 차단 확인", + "filtered_description": "이 작업은 현재 필터와 일치하는 모든 사용자를 차단합니다. 이 작업은 취소할 수 없습니다.", + "all_description": "이 작업은 시스템의 모든 사용자를 차단합니다. 이 작업은 취소할 수 없습니다.", + "cancel": "취소", + "confirm": "차단 확인", + "banning": "차단 중..." + } + }, + "messages": { + "success": "성공", + "error": "오류", + "export": { + "success": "내보내기 성공", + "failed": "내보내기 실패" + }, + "batch_ban": { + "success": "일괄 차단 성공", + "failed": "일괄 차단 실패" + }, + "send_mail": { + "success": "이메일 전송 성공", + "failed": "이메일 전송 실패", + "required_fields": "모든 필수 항목을 입력해주세요" + } + }, + "send_mail": { + "title": "이메일 보내기", + "description": "선택하거나 필터링된 사용자에게 이메일 보내기", + "subject": "제목", + "content": "내용", + "sending": "전송 중...", + "send": "보내기" } }, "subscribe": { @@ -1974,7 +2013,7 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "template": { "button": "템플릿 사용", "tooltip": "기본 템플릿 사용", - "content": "## 플랜 특징\n\n- 트래픽: {{transfer}} GB\n- 속도: {{speed}} Mbps\n- 기기: {{devices}}대\n\n## 사용 안내\n\n1. 플랜 유효 기간: {{validity}}일\n2. 트래픽 초기화: {{reset_method}}\n3. 최대 동시 접속자: {{capacity}}명" + "content": "## 요금제 상세\n\n- 데이터: {{transfer}} GB\n- 속도 제한: {{speed}} Mbps\n- 동시접속 기기: {{devices}}대\n\n## 서비스 안내\n\n1. 데이터 {{reset_method}} 초기화\n2. 멀티플랫폼 지원\n3. 24시간 기술지원" } }, "force_update": { diff --git a/public/assets/admin/locales/zh-CN.js b/public/assets/admin/locales/zh-CN.js index 0a305c6..ef3c4ca 100644 --- a/public/assets/admin/locales/zh-CN.js +++ b/public/assets/admin/locales/zh-CN.js @@ -1871,6 +1871,45 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "submit": "提交", "success": "修改成功" } + }, + "actions": { + "title": "操作", + "send_email": "发送邮件", + "export_csv": "导出 CSV", + "batch_ban": "批量封禁", + "confirm_ban": { + "title": "确认批量封禁", + "filtered_description": "此操作将封禁所有符合当前筛选条件的用户。此操作无法撤销。", + "all_description": "此操作将封禁系统中的所有用户。此操作无法撤销。", + "cancel": "取消", + "confirm": "确认封禁", + "banning": "封禁中..." + } + }, + "messages": { + "success": "成功", + "error": "错误", + "export": { + "success": "导出成功", + "failed": "导出失败" + }, + "batch_ban": { + "success": "批量封禁成功", + "failed": "批量封禁失败" + }, + "send_mail": { + "success": "邮件发送成功", + "failed": "邮件发送失败", + "required_fields": "请填写所有必填字段" + } + }, + "send_mail": { + "title": "发送邮件", + "description": "向所选或已筛选的用户发送邮件", + "subject": "主题", + "content": "内容", + "sending": "发送中...", + "send": "发送" } }, "subscribe": { @@ -1991,7 +2030,7 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "template": { "button": "使用模板", "tooltip": "使用默认模板", - "content": "## 套餐特点\n\n- 流量:{{transfer}} GB\n- 速度:{{speed}} Mbps\n- 设备数:{{devices}}\n\n## 使用说明\n\n1. 套餐有效期 {{validity}} 天\n2. 流量{{reset_method}}重置\n3. 最多支持 {{capacity}} 个用户同时在线" + "content": "## 套餐详情\n\n- 流量:{{transfer}} GB\n- 速度限制:{{speed}} Mbps\n- 同时在线设备:{{devices}} 台\n\n## 服务说明\n\n1. 流量{{reset_method}}重置\n2. 支持多平台使用\n3. 7×24小时技术支持" } }, "force_update": { diff --git a/resources/lang/en-US.json b/resources/lang/en-US.json index 1007453..fa6a2ab 100644 --- a/resources/lang/en-US.json +++ b/resources/lang/en-US.json @@ -113,5 +113,11 @@ "QR Code": "QR Code", "Unlimited": "Unlimited", "Device Limit": "Device Limit", - "Devices": "Devices" + "Devices": "Devices", + "No Limit": "No Limit", + "First Day of Month": "First Day of Month", + "Monthly": "Monthly", + "Never": "Never", + "First Day of Year": "First Day of Year", + "Yearly": "Yearly" } diff --git a/resources/lang/zh-CN.json b/resources/lang/zh-CN.json index b6a4251..8d2da3d 100644 --- a/resources/lang/zh-CN.json +++ b/resources/lang/zh-CN.json @@ -113,5 +113,11 @@ "QR Code": "二维码", "Unlimited": "长期有效", "Device Limit": "设备限制", - "Devices": "台设备" + "Devices": "台设备", + "No Limit": "不限制", + "First Day of Month": "每月1号", + "Monthly": "按月", + "Never": "不重置", + "First Day of Year": "每年1月1日", + "Yearly": "按年" } diff --git a/resources/lang/zh-TW.json b/resources/lang/zh-TW.json index c83473e..13aeda4 100644 --- a/resources/lang/zh-TW.json +++ b/resources/lang/zh-TW.json @@ -113,5 +113,11 @@ "QR Code": "二維碼", "Unlimited": "長期有效", "Device Limit": "設備限制", - "Devices": "台設備" + "Devices": "台設備", + "No Limit": "不限制", + "First Day of Month": "每月1號", + "Monthly": "按月", + "Never": "不重置", + "First Day of Year": "每年1月1日", + "Yearly": "按年" } diff --git a/theme/Xboard/config.json b/theme/Xboard/config.json index bcecdbf..f1524a2 100644 --- a/theme/Xboard/config.json +++ b/theme/Xboard/config.json @@ -3,7 +3,7 @@ "description": "Xboard", "version": "1.0.0", "images": [ - "https://raw.githubusercontent.com/cedar2025/Xboard/new/docs/images/dashboard.png" + "https://raw.githubusercontent.com/cedar2025/Xboard/master/docs/images/user.png" ], "configs": [ {