diff --git a/app/Http/Controllers/V2/Admin/TicketController.php b/app/Http/Controllers/V2/Admin/TicketController.php index fc51d39..79c9df9 100644 --- a/app/Http/Controllers/V2/Admin/TicketController.php +++ b/app/Http/Controllers/V2/Admin/TicketController.php @@ -70,7 +70,7 @@ class TicketController extends Controller */ private function fetchTickets(Request $request) { - $ticketModel = Ticket::query() + $ticketModel = Ticket::with('user') ->when($request->has('status'), function ($query) use ($request) { $query->where('status', $request->input('status')); }) diff --git a/public/assets/admin/assets/index.css b/public/assets/admin/assets/index.css index e0add00..abab3ee 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-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-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[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}.min-w-0{min-width:0px}.min-w-20{min-width:5rem}.min-w-\[10em\]{min-width:10em}.min-w-\[300px\]{min-width:300px}.min-w-\[40px\]{min-width:40px}.min-w-\[4rem\]{min-width:4rem}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-32{max-width:8rem}.max-w-4xl{max-width:56rem}.max-w-52{max-width:13rem}.max-w-80{max-width:20rem}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[500px\]{max-width:500px}.max-w-\[60\%\]{max-width:60%}.max-w-\[600px\]{max-width:600px}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-none{max-width:none}.max-w-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-\[-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-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/25{border-color:hsl(var(--muted-foreground) / .25)}.border-orange-500\/50{border-color:#f9731680}.border-primary{border-color:hsl(var(--primary))}.border-primary\/40{border-color:hsl(var(--primary) / .4)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-l-slate-500{--tw-border-opacity: 1;border-left-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-r-muted{border-right-color:hsl(var(--muted))}.border-t-transparent{border-top-color:transparent}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/80{background-color:#000c}.bg-blue-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\:bottom-0:after{content:var(--tw-content);bottom:0}.after\:left-0:after{content:var(--tw-content);left:0}.after\:hidden:after{content:var(--tw-content);display:none}.after\:h-32:after{content:var(--tw-content);height:8rem}.after\:w-full:after{content:var(--tw-content);width:100%}.after\:bg-\[linear-gradient\(180deg\,_transparent_10\%\,_hsl\(var\(--background\)\)_70\%\)\]:after{content:var(--tw-content);background-image:linear-gradient(180deg,transparent 10%,hsl(var(--background)) 70%)}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.focus-within\:ring-1:focus-within{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-within\:ring-ring:focus-within{--tw-ring-color: hsl(var(--ring))}.hover\:-translate-y-1:hover{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-180:hover{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-background:hover{background-color:hsl(var(--background))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-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-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-90:active{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:via-background\/90{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .9) var(--tw-gradient-via-position), var(--tw-gradient-to)}.group:hover .group-hover\:to-background\/70{--tw-gradient-to: hsl(var(--background) / .7) var(--tw-gradient-to-position)}.group\/id:hover .group-hover\/id\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:justify-center{justify-content:center}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:px-2{padding-left:.5rem;padding-right:.5rem}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\:focus-visible\]\:outline-none:has(:focus-visible){outline:2px solid transparent;outline-offset:2px}.has-\[\:focus-visible\]\:ring-1:has(:focus-visible){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.has-\[\:focus-visible\]\:ring-neutral-950:has(:focus-visible){--tw-ring-opacity: 1;--tw-ring-color: rgb(10 10 10 / var(--tw-ring-opacity, 1))}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:bg-accent\/50[aria-selected=true]{background-color:hsl(var(--accent) / .5)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[state\=dragging\]\:cursor-grabbing[data-state=dragging]{cursor:grabbing}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[disabled\]\:bg-muted-foreground[data-disabled],.data-\[fixed\]\:bg-muted-foreground[data-fixed]{background-color:hsl(var(--muted-foreground))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[collapsed\=true\]\:py-2[data-collapsed=true]{padding-top:.5rem;padding-bottom:.5rem}.data-\[disabled\]\:text-muted[data-disabled],.data-\[fixed\]\:text-muted[data-fixed]{color:hsl(var(--muted))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{transition-duration:.3s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{animation-duration:.3s}.data-\[disabled\]\:hover\:bg-muted-foreground:hover[data-disabled],.data-\[fixed\]\:hover\:bg-muted-foreground:hover[data-fixed]{background-color:hsl(var(--muted-foreground))}.group[data-state=open] .group-data-\[state\=\"open\"\]\:-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:border-blue-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:bg-blue-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\: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\:inline-flex{display:inline-flex}.md\:hidden{display:none}.md\:h-svh{height:100svh}.md\:max-h-screen{max-height:100vh}.md\:w-14{width:3.5rem}.md\:w-32{width:8rem}.md\:w-64{width:16rem}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[31rem\]{max-width:31rem}.md\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:overflow-y-hidden{overflow-y:hidden}.md\:border-none{border-style:none}.md\:px-4{padding-left:1rem;padding-right:1rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\:pt-0{padding-top:0}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.after\:md\:block:after{content:var(--tw-content);display:block}}@media (min-width: 1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-1\/5{width:20%}.lg\:w-\[250px\]{width:250px}.lg\:max-w-none{max-width:none}.lg\:max-w-xl{max-width:36rem}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:flex-col{flex-direction:column}.lg\:gap-8{gap:2rem}.lg\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(0px * var(--tw-space-x-reverse));margin-left:calc(0px * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-12>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(3rem * var(--tw-space-x-reverse));margin-left:calc(3rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-3{padding-left:.75rem;padding-right:.75rem}}@media (min-width: 1280px){.xl\:mr-2{margin-right:.5rem}.xl\:flex{display:flex}.xl\:inline-flex{display:inline-flex}.xl\:h-10{height:2.5rem}.xl\:w-60{width:15rem}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:justify-start{justify-content:flex-start}.xl\:px-3{padding-left:.75rem;padding-right:.75rem}.xl\:py-2{padding-top:.5rem;padding-bottom:.5rem}}.\[\&\:\:-webkit-calendar-picker-indicator\]\:hidden::-webkit-calendar-picker-indicator{display:none}.\[\&\:has\(\>\.day-range-end\)\]\:rounded-r-md:has(>.day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\>\.day-range-start\)\]\:rounded-l-md:has(>.day-range-start){border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:rounded-md:has([aria-selected]){border-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:hsl(var(--accent))}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-accent\/50:has([aria-selected].day-outside){background-color:hsl(var(--accent) / .5)}.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--header-height: 4rem;--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%}.collapsibleDropdown{overflow:hidden}.collapsibleDropdown[data-state=open]{animation:slideDown .2s ease-out}.collapsibleDropdown[data-state=closed]{animation:slideUp .2s ease-out}@keyframes slideDown{0%{height:0}to{height:var(--radix-collapsible-content-height)}}@keyframes slideUp{0%{height:var(--radix-collapsible-content-height)}to{height:0}}*{border-color:hsl(var(--border))}body{min-height:100svh;width:100%;background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-left-1{left:-.25rem}.-right-1{right:-.25rem}.-right-5{right:-1.25rem}.-top-1\/2{top:-50%}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-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} diff --git a/public/assets/admin/assets/index.js b/public/assets/admin/assets/index.js index 444f8b1..55fbd44 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 pl,c as gl,I as Ma,a as Es,S as na,u as ms,b as ra,d as jl,O as la,e as vl,f as $,g as bl,h as yl,i as Nl,k as _l,B as wl,l as Cl,Q as Sl,m as kl,R as Tl,n as Pl,P as Dl,o as El,p as Rl,q as nn,F as Vl,C as Il,s as Fl,v as Ml,w as Ol,x as zl,y as rn,z as I,A as h,D as de,E as ue,G as ln,H as Pt,J as Dt,K as oa,L as Ae,T as Et,M as Rt,N as on,U as cn,V as dn,W as ia,X as mn,Y as Ll,Z as un,_ as xn,$ as hn,a0 as fn,a1 as Rs,a2 as pn,a3 as Al,a4 as gn,a5 as jn,a6 as $l,a7 as ql,a8 as Hl,a9 as Kl,aa as Ul,ab as Bl,ac as Gl,ad as Yl,ae as Wl,af as Jl,ag as Ql,ah as vn,ai as Zl,aj as Xl,ak as Vs,al as bn,am as eo,an as so,ao as yn,ap as ca,aq as to,ar as ao,as as Oa,at as no,au as Nn,av as ro,aw as _n,ax as lo,ay as oo,az as io,aA as co,aB as mo,aC as uo,aD as wn,aE as xo,aF as ho,aG as fo,aH as De,aI as po,aJ as Cn,aK as go,aL as jo,aM as Sn,aN as kn,aO as Tn,aP as vo,aQ as bo,aR as Pn,aS as Dn,aT as En,aU as yo,aV as No,aW as Rn,aX as _o,aY as da,aZ as Vn,a_ as wo,a$ as In,b0 as Co,b1 as Fn,b2 as So,b3 as Mn,b4 as On,b5 as ko,b6 as To,b7 as zn,b8 as Po,b9 as Do,ba as Ln,bb as Eo,bc as An,bd as Ro,be as Vo,bf as Ye,bg as se,bh as Ge,bi as dt,bj as Io,bk as Fo,bl as Mo,bm as Oo,bn as zo,bo as Lo,bp as za,bq as La,br as Ao,bs as $o,bt as qo,bu as Ho,bv as Ko,bw as Wt,bx as Jt,by as Uo,bz as Bo,bA as $n,bB as Go,bC as Yo,bD as qn,bE as Wo,bF as ve,bG as Jo,bH as Aa,bI as Qt,bJ as Zt,bK as Qo,bL as Zo,bM as Hn,bN as Xo,bO as ma,bP as ei,bQ as si,bR as ti,bS as Kn,bT as Un,bU as Bn,bV as ai,bW as ni,bX as ri,bY as li,bZ as Gn,b_ as oi,b$ as as,c0 as ii,c1 as ci,c2 as di,c3 as _t,c4 as Se,c5 as $a,c6 as mi,c7 as Yn,c8 as Wn,c9 as Jn,ca as Qn,cb as Zn,cc as Xn,cd as ui,ce as xi,cf as hi,cg as Vt,ch as Is,ci as ns,cj as He,ck as Ke,cl as Je,cm as Qe,cn as Ze,co as fi,cp as pi,cq as gi,cr as ji,cs as vi,ct as bi,cu as yi,cv as Ni,cw as _i,cx as Xt,cy as ua,cz as xa,cA as wi,cB as us,cC as xs,cD as mt,cE as Ci,cF as wt,cG as Si,cH as qa,cI as er,cJ as Ha,cK as Ct,cL as ki,cM as Ti,cN as Pi,cO as Di,cP as sr,cQ as Ei,cR as Ri,cS as tr,cT as ea,cU as ar,cV as Vi,cW as nr,cX as rr,cY as Ii,cZ as Fi,c_ as Mi,c$ as Oi,d0 as zi}from"./vendor.js";import"./index.js";var Fh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mh(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Li(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 Ai={theme:"system",setTheme:()=>null},lr=u.createContext(Ai);function $i({children:s,defaultTheme:n="system",storageKey:a="vite-ui-theme",...l}){const[r,i]=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 c={theme:r,setTheme:m=>{localStorage.setItem(a,m),i(m)}};return e.jsx(lr.Provider,{...l,value:c,children:s})}const qi=()=>{const s=u.useContext(lr);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Hi=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),Ki=function(s,n){return new URL(s,n).href},Ka={},ne=function(n,a,l){let r=Promise.resolve();if(a&&a.length>0){const c=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),x=m?.nonce||m?.getAttribute("nonce");r=Promise.allSettled(a.map(o=>{if(o=Ki(o,l),o in Ka)return;Ka[o]=!0;const d=o.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(!!l)for(let f=c.length-1;f>=0;f--){const g=c[f];if(g.href===o&&(!d||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${p}`))return;const R=document.createElement("link");if(R.rel=d?"stylesheet":Hi,d||(R.as="script"),R.crossOrigin="",R.href=o,x&&R.setAttribute("nonce",x),document.head.appendChild(R),d)return new Promise((f,g)=>{R.addEventListener("load",f),R.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${o}`)))})}))}function i(c){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=c,window.dispatchEvent(m),!m.defaultPrevented)throw c}return r.then(c=>{for(const m of c||[])m.status==="rejected"&&i(m.reason);return n().catch(i)})};function _(...s){return pl(gl(s))}const Bs=Es("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"}}),V=u.forwardRef(({className:s,variant:n,size:a,asChild:l=!1,children:r,disabled:i,loading:c=!1,leftSection:m,rightSection:x,...o},d)=>{const p=l?na:"button";return e.jsxs(p,{className:_(Bs({variant:n,size:a,className:s})),disabled:c||i,ref:d,...o,children:[(m&&c||!m&&!x&&c)&&e.jsx(Ma,{className:"mr-2 h-4 w-4 animate-spin"}),!c&&m&&e.jsx("div",{className:"mr-2",children:m}),r,!c&&x&&e.jsx("div",{className:"ml-2",children:x}),x&&c&&e.jsx(Ma,{className:"ml-2 h-4 w-4 animate-spin"})]})});V.displayName="Button";function Ls({className:s,minimal:n=!1}){const a=ms();return e.jsx("div",{className:_("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(V,{variant:"outline",onClick:()=>a(-1),children:"Go Back"}),e.jsx(V,{onClick:()=>a("/"),children:"Back to Home"})]})]})})}function Ua(){const s=ms();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(V,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(V,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function Ui(){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(V,{variant:"outline",children:"Learn more"})})]})})}function Bi(s){return typeof s>"u"}function Gi(s){return s===null}function Yi(s){return Gi(s)||Bi(s)}class Wi{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:i,time:c,expire:m}=r;return Yi(m)||m>new Date().getTime()?{value:i,time:c}:(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 or({prefixKey:s="",storage:n=sessionStorage}){return new Wi({prefixKey:s,storage:n})}const ir="Xboard_",Ji=function(s={}){return or({prefixKey:s.prefixKey||"",storage:localStorage})},Qi=function(s={}){return or({prefixKey:s.prefixKey||"",storage:sessionStorage})},It=Ji({prefixKey:ir});Qi({prefixKey:ir});const cr="access_token";function rt(){return It.get(cr)}function dr(){It.remove(cr)}const Ba=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Zi({children:s}){const n=ms(),a=ra(),l=rt();return u.useEffect(()=>{if(!l.value&&!Ba.includes(a.pathname)){const r=encodeURIComponent(a.pathname+a.search);n(`/sign-in?redirect=${r}`)}},[l.value,a.pathname,a.search,n]),Ba.includes(a.pathname)||l.value?e.jsx(e.Fragment,{children:s}):null}const Xi=()=>e.jsx(Zi,{children:e.jsx(la,{})}),ec=jl([{path:"/sign-in",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Cc);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(Xi,{}),children:[{path:"/",lazy:async()=>({Component:(await ne(()=>Promise.resolve().then(()=>Ic),void 0,import.meta.url)).default}),errorElement:e.jsx(Ls,{}),children:[{index:!0,lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>nm);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Ls,{}),children:[{path:"system",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>im);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>um);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>gm);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Nm);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>km);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Rm);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Om);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>qm);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Gm);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Zm);return{default:s}},void 0,import.meta.url)).default})}]},{path:"payment",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>iu);return{default:s}},void 0,import.meta.url)).default})},{path:"plugin",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>mu);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>fu);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Nu);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Du);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Ls,{}),children:[{path:"manage",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>sx);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>lx);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>ux);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Ls,{}),children:[{path:"plan",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>yx);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Fx);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Kx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Ls,{}),children:[{path:"manage",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>fh);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Rh);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Ls},{path:"/404",Component:Ua},{path:"/503",Component:Ui},{path:"*",Component:Ua}]),sc="locale";function tc(){return It.get(sc)}function mr(){dr();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 ac=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function nc(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const F=vl.create({baseURL:nc(),timeout:12e3,headers:{"Content-Type":"application/json"}});F.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const n=rt();if(!ac.includes(s.url?.split("?")[0]||"")){if(!n.value)return mr(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=n.value}return s.headers["Content-Language"]=tc().value||"zh-CN",s},s=>Promise.reject(s));F.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)&&mr(),$.error(a||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[n]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});function rc(){return F.get("/user/info")}const $t={token:rt()?.value||"",userInfo:null,isLoggedIn:!!rt()?.value,loading:!1,error:null},tt=bl("user/fetchUserInfo",async()=>(await rc()).data,{condition:(s,{getState:n})=>{const{user:a}=n();return!!a.token&&!a.loading}}),ur=yl({name:"user",initialState:$t,reducers:{setToken(s,n){s.token=n.payload,s.isLoggedIn=!!n.payload},resetUserState:()=>$t},extraReducers:s=>{s.addCase(tt.pending,n=>{n.loading=!0,n.error=null}).addCase(tt.fulfilled,(n,a)=>{n.loading=!1,n.userInfo=a.payload,n.error=null}).addCase(tt.rejected,(n,a)=>{if(n.loading=!1,n.error=a.error.message||"Failed to fetch user info",!n.token)return $t})}}),{setToken:lc,resetUserState:oc}=ur.actions,ic=s=>s.user.userInfo,cc=ur.reducer,xr=Nl({reducer:{user:cc}});rt()?.value&&xr.dispatch(tt());_l.use(wl).use(Cl).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 dc=new Sl;kl.createRoot(document.getElementById("root")).render(e.jsx(Tl.StrictMode,{children:e.jsx(Pl,{client:dc,children:e.jsx(Dl,{store:xr,children:e.jsxs($i,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(El,{router:ec}),e.jsx(Rl,{richColors:!0,position:"top-right"})]})})})}));const Me=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:_("rounded-xl border bg-card text-card-foreground shadow",s),...n}));Me.displayName="Card";const $e=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:_("flex flex-col space-y-1.5 p-6",s),...n}));$e.displayName="CardHeader";const cs=u.forwardRef(({className:s,...n},a)=>e.jsx("h3",{ref:a,className:_("font-semibold leading-none tracking-tight",s),...n}));cs.displayName="CardTitle";const Ks=u.forwardRef(({className:s,...n},a)=>e.jsx("p",{ref:a,className:_("text-sm text-muted-foreground",s),...n}));Ks.displayName="CardDescription";const qe=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:_("p-6 pt-0",s),...n}));qe.displayName="CardContent";const mc=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:_("flex items-center p-6 pt-0",s),...n}));mc.displayName="CardFooter";const uc=Es("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),St=u.forwardRef(({className:s,...n},a)=>e.jsx(nn,{ref:a,className:_(uc(),s),...n}));St.displayName=nn.displayName;const xe=Vl,hr=u.createContext({}),y=({...s})=>e.jsx(hr.Provider,{value:{name:s.name},children:e.jsx(Il,{...s})}),Ft=()=>{const s=u.useContext(hr),n=u.useContext(fr),{getFieldState:a,formState:l}=Fl(),r=a(s.name,l);if(!s)throw new Error("useFormField should be used within ");const{id:i}=n;return{id:i,name:s.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...r}},fr=u.createContext({}),b=u.forwardRef(({className:s,...n},a)=>{const l=u.useId();return e.jsx(fr.Provider,{value:{id:l},children:e.jsx("div",{ref:a,className:_("space-y-2",s),...n})})});b.displayName="FormItem";const N=u.forwardRef(({className:s,...n},a)=>{const{error:l,formItemId:r}=Ft();return e.jsx(St,{ref:a,className:_(l&&"text-destructive",s),htmlFor:r,...n})});N.displayName="FormLabel";const w=u.forwardRef(({...s},n)=>{const{error:a,formItemId:l,formDescriptionId:r,formMessageId:i}=Ft();return e.jsx(na,{ref:n,id:l,"aria-describedby":a?`${r} ${i}`:`${r}`,"aria-invalid":!!a,...s})});w.displayName="FormControl";const M=u.forwardRef(({className:s,...n},a)=>{const{formDescriptionId:l}=Ft();return e.jsx("p",{ref:a,id:l,className:_("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:i}=Ft(),c=r?String(r?.message):n;return c?e.jsx("p",{ref:l,id:i,className:_("text-[0.8rem] font-medium text-destructive",s),...a,children:c}):null});E.displayName="FormMessage";const D=u.forwardRef(({className:s,type:n,...a},l)=>e.jsx("input",{type:n,className:_("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 pr=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:_("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(V,{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(i=>!i),children:l?e.jsx(Ml,{size:18}):e.jsx(Ol,{size:18})})]})});pr.displayName="PasswordInput";const xc=s=>F({url:"/passport/auth/login",method:"post",data:s});function he(s=void 0,n="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),zl(s).format(n))}function hc(s=void 0,n="YYYY-MM-DD"){return he(s,n)}function qs(s){const n=typeof s=="string"?parseFloat(s):s;return isNaN(n)?"0.00":n.toFixed(2)}function Ts(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+$/,i=>i.includes(".")?".00":i);return n?`¥${r}`:r}function kt(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 ss(s){const n=s/1024,a=n/1024,l=a/1024,r=l/1024;return r>=1?qs(r)+" TB":l>=1?qs(l)+" GB":a>=1?qs(a)+" MB":qs(n)+" KB"}const fc="access_token";function pc(s){It.set(fc,s)}function gc({className:s,onForgotPassword:n,...a}){const l=ms(),r=rn(),{t:i}=I("auth"),c=h.object({email:h.string().min(1,{message:i("signIn.validation.emailRequired")}),password:h.string().min(1,{message:i("signIn.validation.passwordRequired")}).min(7,{message:i("signIn.validation.passwordLength")})}),m=de({resolver:ue(c),defaultValues:{email:"",password:""}});async function x(o){try{const{data:d}=await xc(o);pc(d.auth_data),r(lc(d.auth_data)),await r(tt()).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:_("grid gap-6",s),...a,children:e.jsx(xe,{...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(y,{control:m.control,name:"email",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:i("signIn.email")}),e.jsx(w,{children:e.jsx(D,{placeholder:i("signIn.emailPlaceholder"),autoComplete:"email",...o})}),e.jsx(E,{})]})}),e.jsx(y,{control:m.control,name:"password",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:i("signIn.password")}),e.jsx(w,{children:e.jsx(pr,{placeholder:i("signIn.passwordPlaceholder"),autoComplete:"current-password",...o})}),e.jsx(E,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(V,{variant:"link",type:"button",className:"px-0 text-sm font-normal text-muted-foreground hover:text-primary",onClick:n,children:i("signIn.forgotPassword")})}),e.jsx(V,{className:"w-full",size:"lg",loading:m.formState.isSubmitting,children:i("signIn.submit")})]})})})})}const ge=ln,ze=on,jc=cn,ut=oa,gr=u.forwardRef(({className:s,...n},a)=>e.jsx(Pt,{ref:a,className:_("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}));gr.displayName=Pt.displayName;const fe=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(jc,{children:[e.jsx(gr,{}),e.jsxs(Dt,{ref:l,className:_("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(oa,{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(Ae,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));fe.displayName=Dt.displayName;const be=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col space-y-1.5 text-center sm:text-left",s),...n});be.displayName="DialogHeader";const Le=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Le.displayName="DialogFooter";const je=u.forwardRef(({className:s,...n},a)=>e.jsx(Et,{ref:a,className:_("text-lg font-semibold leading-none tracking-tight",s),...n}));je.displayName=Et.displayName;const Pe=u.forwardRef(({className:s,...n},a)=>e.jsx(Rt,{ref:a,className:_("text-sm text-muted-foreground",s),...n}));Pe.displayName=Rt.displayName;const Us=Es("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"}}),J=u.forwardRef(({className:s,variant:n,size:a,asChild:l=!1,...r},i)=>{const c=l?na:"button";return e.jsx(c,{className:_(Us({variant:n,size:a,className:s})),ref:i,...r})});J.displayName="Button";const _s=$l,ws=ql,vc=Hl,bc=u.forwardRef(({className:s,inset:n,children:a,...l},r)=>e.jsxs(dn,{ref:r,className:_("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(ia,{className:"ml-auto h-4 w-4"})]}));bc.displayName=dn.displayName;const yc=u.forwardRef(({className:s,...n},a)=>e.jsx(mn,{ref:a,className:_("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}));yc.displayName=mn.displayName;const ds=u.forwardRef(({className:s,sideOffset:n=4,...a},l)=>e.jsx(Ll,{children:e.jsx(un,{ref:l,sideOffset:n,className:_("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})}));ds.displayName=un.displayName;const pe=u.forwardRef(({className:s,inset:n,...a},l)=>e.jsx(xn,{ref:l,className:_("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}));pe.displayName=xn.displayName;const Nc=u.forwardRef(({className:s,children:n,checked:a,...l},r)=>e.jsxs(hn,{ref:r,className:_("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(fn,{children:e.jsx(Rs,{className:"h-4 w-4"})})}),n]}));Nc.displayName=hn.displayName;const _c=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(pn,{ref:l,className:_("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(fn,{children:e.jsx(Al,{className:"h-4 w-4 fill-current"})})}),n]}));_c.displayName=pn.displayName;const ha=u.forwardRef(({className:s,inset:n,...a},l)=>e.jsx(gn,{ref:l,className:_("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",s),...a}));ha.displayName=gn.displayName;const lt=u.forwardRef(({className:s,...n},a)=>e.jsx(jn,{ref:a,className:_("-mx-1 my-1 h-px bg-muted",s),...n}));lt.displayName=jn.displayName;const sa=({className:s,...n})=>e.jsx("span",{className:_("ml-auto text-xs tracking-widest opacity-60",s),...n});sa.displayName="DropdownMenuShortcut";const qt=[{code:"en-US",name:"English",flag:Kl,shortName:"EN"},{code:"zh-CN",name:"中文",flag:Ul,shortName:"CN"},{code:"ko-KR",name:"한국어",flag:Bl,shortName:"KR"}];function jr(){const{i18n:s}=I(),n=r=>{s.changeLanguage(r)},a=qt.find(r=>r.code===s.language)||qt[1],l=a.flag;return e.jsxs(_s,{children:[e.jsx(ws,{asChild:!0,children:e.jsxs(J,{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(ds,{align:"end",className:"w-[120px]",children:qt.map(r=>{const i=r.flag,c=r.code===s.language;return e.jsxs(pe,{onClick:()=>n(r.code),className:_("flex items-center gap-2 px-2 py-1.5 cursor-pointer",c&&"bg-accent"),children:[e.jsx(i,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:_("text-sm",c&&"font-medium"),children:r.name})]},r.code)})})]})}function wc(){const[s,n]=u.useState(!1),{t:a}=I("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(jr,{})}),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(Me,{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(gc,{onForgotPassword:()=>n(!0)})]})]})]}),e.jsx(ge,{open:s,onOpenChange:n,children:e.jsx(fe,{children:e.jsxs(be,{children:[e.jsx(je,{children:a("signIn.resetPassword.title")}),e.jsx(Pe,{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(J,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>kt(l).then(()=>{$.success(a("common:copy.success"))}),children:e.jsx(Gl,{className:"h-4 w-4"})})]})})]})})})]})}const Cc=Object.freeze(Object.defineProperty({__proto__:null,default:wc},Symbol.toStringTag,{value:"Module"})),we=u.forwardRef(({className:s,fadedBelow:n=!1,fixedHeight:a=!1,...l},r)=>e.jsx("div",{ref:r,className:_("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}));we.displayName="Layout";const Ce=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:_("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...n}));Ce.displayName="LayoutHeader";const Te=u.forwardRef(({className:s,fixedHeight:n,...a},l)=>e.jsx("div",{ref:l,className:_("flex-1 overflow-hidden px-4 py-6 md:px-8",n&&"h-[calc(100%-var(--header-height))]",s),...a}));Te.displayName="LayoutBody";const vr=Yl,br=Wl,yr=Jl,ce=Ql,oe=Zl,ie=Xl,te=u.forwardRef(({className:s,sideOffset:n=4,...a},l)=>e.jsx(vn,{ref:l,sideOffset:n,className:_("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}));te.displayName=vn.displayName;function Mt(){const{pathname:s}=ra();return{checkActiveNav:a=>{if(a==="/"&&s==="/")return!0;const l=a.replace(/^\//,""),r=s.replace(/^\//,"");return l?r.startsWith(l):!1}}}function Nr({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 Sc(){const[s,n]=Nr({key:"collapsed-sidebar-items",defaultValue:[]}),a=r=>!s.includes(r);return{isExpanded:a,toggleItem:r=>{a(r)?n([...s,r]):n(s.filter(i=>i!==r))}}}function kc({links:s,isCollapsed:n,className:a,closeNav:l}){const{t:r}=I(),i=({sub:c,...m})=>{const x=`${r(m.title)}-${m.href}`;return n&&c?u.createElement(Dc,{...m,sub:c,key:x,closeNav:l}):n?u.createElement(Pc,{...m,key:x,closeNav:l}):c?u.createElement(Tc,{...m,sub:c,key:x,closeNav:l}):u.createElement(_r,{...m,key:x,closeNav:l})};return e.jsx("div",{"data-collapsed":n,className:_("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(ce,{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(i)})})})}function _r({title:s,icon:n,label:a,href:l,closeNav:r,subLink:i=!1}){const{checkActiveNav:c}=Mt(),{t:m}=I();return e.jsxs(Vs,{to:l,onClick:r,className:_(Bs({variant:c(l)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",i&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":c(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 Tc({title:s,icon:n,label:a,sub:l,closeNav:r}){const{checkActiveNav:i}=Mt(),{isExpanded:c,toggleItem:m}=Sc(),{t:x}=I(),o=!!l?.find(P=>i(P.href)),d=x(s),p=c(d)||o;return e.jsxs(vr,{open:p,onOpenChange:()=>m(d),children:[e.jsxs(br,{className:_(Bs({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:_('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(bn,{stroke:1})})]}),e.jsx(yr,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:l.map(P=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(_r,{...P,subLink:!0,closeNav:r})},x(P.title)))})})]})}function Pc({title:s,icon:n,label:a,href:l,closeNav:r}){const{checkActiveNav:i}=Mt(),{t:c}=I();return e.jsxs(oe,{delayDuration:0,children:[e.jsx(ie,{asChild:!0,children:e.jsxs(Vs,{to:l,onClick:r,className:_(Bs({variant:i(l)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[n,e.jsx("span",{className:"sr-only",children:c(s)})]})}),e.jsxs(te,{side:"right",className:"flex items-center gap-4",children:[c(s),a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:c(a)})]})]})}function Dc({title:s,icon:n,label:a,sub:l,closeNav:r}){const{checkActiveNav:i}=Mt(),{t:c}=I(),m=!!l?.find(x=>i(x.href));return e.jsxs(_s,{children:[e.jsxs(oe,{delayDuration:0,children:[e.jsx(ie,{asChild:!0,children:e.jsx(ws,{asChild:!0,children:e.jsx(V,{variant:m?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:n})})}),e.jsxs(te,{side:"right",className:"flex items-center gap-4",children:[c(s)," ",a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:c(a)}),e.jsx(bn,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(ds,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(ha,{children:[c(s)," ",a?`(${c(a)})`:""]}),e.jsx(lt,{}),l.map(({title:x,icon:o,label:d,href:p})=>e.jsx(pe,{asChild:!0,children:e.jsxs(Vs,{to:p,onClick:r,className:`${i(p)?"bg-secondary":""}`,children:[o," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:c(x)}),d&&e.jsx("span",{className:"ml-auto text-xs",children:c(d)})]})},`${c(x)}-${p}`))]})]})}const wr=[{title:"nav:dashboard",label:"",href:"/",icon:e.jsx(eo,{size:18})},{title:"nav:systemManagement",label:"",href:"",icon:e.jsx(so,{size:18}),sub:[{title:"nav:systemConfig",label:"",href:"/config/system",icon:e.jsx(yn,{size:18})},{title:"nav:pluginManagement",label:"",href:"/config/plugin",icon:e.jsx(ca,{size:18})},{title:"nav:themeConfig",label:"",href:"/config/theme",icon:e.jsx(to,{size:18})},{title:"nav:noticeManagement",label:"",href:"/config/notice",icon:e.jsx(ao,{size:18})},{title:"nav:paymentConfig",label:"",href:"/config/payment",icon:e.jsx(Oa,{size:18})},{title:"nav:knowledgeManagement",label:"",href:"/config/knowledge",icon:e.jsx(no,{size:18})}]},{title:"nav:nodeManagement",label:"",href:"",icon:e.jsx(Nn,{size:18}),sub:[{title:"nav:nodeManagement",label:"",href:"/server/manage",icon:e.jsx(ro,{size:18})},{title:"nav:permissionGroupManagement",label:"",href:"/server/group",icon:e.jsx(_n,{size:18})},{title:"nav:routeManagement",label:"",href:"/server/route",icon:e.jsx(lo,{size:18})}]},{title:"nav:subscriptionManagement",label:"",href:"",icon:e.jsx(oo,{size:18}),sub:[{title:"nav:planManagement",label:"",href:"/finance/plan",icon:e.jsx(io,{size:18})},{title:"nav:orderManagement",label:"",href:"/finance/order",icon:e.jsx(Oa,{size:18})},{title:"nav:couponManagement",label:"",href:"/finance/coupon",icon:e.jsx(co,{size:18})}]},{title:"nav:userManagement",label:"",href:"",icon:e.jsx(mo,{size:18}),sub:[{title:"nav:userManagement",label:"",href:"/user/manage",icon:e.jsx(uo,{size:18})},{title:"nav:ticketManagement",label:"",href:"/user/ticket",icon:e.jsx(wn,{size:18})}]}];function Ec({className:s,isCollapsed:n,setIsCollapsed:a}){const[l,r]=u.useState(!1),{t:i}=I();return u.useEffect(()=>{l?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[l]),e.jsxs("aside",{className:_(`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(we,{children:[e.jsxs(Ce,{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(V,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":i("common:toggleNavigation"),"aria-controls":"sidebar-menu","aria-expanded":l,onClick:()=>r(c=>!c),children:l?e.jsx(xo,{}):e.jsx(ho,{})})]}),e.jsx(kc,{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:wr}),e.jsx("div",{className:_("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:_("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(V,{onClick:()=>a(c=>!c),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex","aria-label":i("common:toggleSidebar"),children:e.jsx(fo,{stroke:1.5,className:`h-5 w-5 ${n?"rotate-180":""}`})})]})]})}function Rc(){const[s,n]=Nr({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]=Rc();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(Ec,{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(la,{})})]})}const Ic=Object.freeze(Object.defineProperty({__proto__:null,default:Vc},Symbol.toStringTag,{value:"Module"})),Cs=u.forwardRef(({className:s,...n},a)=>e.jsx(De,{ref:a,className:_("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...n}));Cs.displayName=De.displayName;const Fc=({children:s,...n})=>e.jsx(ge,{...n,children:e.jsx(fe,{className:"overflow-hidden p-0",children:e.jsx(Cs,{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})})}),Fs=u.forwardRef(({className:s,...n},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(po,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(De.Input,{ref:a,className:_("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})]}));Fs.displayName=De.Input.displayName;const Ss=u.forwardRef(({className:s,...n},a)=>e.jsx(De.List,{ref:a,className:_("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...n}));Ss.displayName=De.List.displayName;const Ms=u.forwardRef((s,n)=>e.jsx(De.Empty,{ref:n,className:"py-6 text-center text-sm",...s}));Ms.displayName=De.Empty.displayName;const Oe=u.forwardRef(({className:s,...n},a)=>e.jsx(De.Group,{ref:a,className:_("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}));Oe.displayName=De.Group.displayName;const Gs=u.forwardRef(({className:s,...n},a)=>e.jsx(De.Separator,{ref:a,className:_("-mx-1 h-px bg-border",s),...n}));Gs.displayName=De.Separator.displayName;const ke=u.forwardRef(({className:s,...n},a)=>e.jsx(De.Item,{ref:a,className:_("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}));ke.displayName=De.Item.displayName;function Mc(){const s=[];for(const n of wr)if(n.href&&s.push(n),n.sub)for(const a of n.sub)s.push({...a,parent:n.title});return s}function Ie(){const[s,n]=u.useState(!1),a=ms(),l=Mc(),{t:r}=I("search"),{t:i}=I("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 c=u.useCallback(m=>{n(!1),a(m)},[a]);return e.jsxs(e.Fragment,{children:[e.jsxs(J,{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(Cn,{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(Fc,{open:s,onOpenChange:n,children:[e.jsx(Fs,{placeholder:r("placeholder")}),e.jsxs(Ss,{children:[e.jsx(Ms,{children:r("noResults")}),e.jsx(Oe,{heading:r("title"),children:l.map(m=>e.jsxs(ke,{value:`${m.parent?m.parent+" ":""}${m.title}`,onSelect:()=>c(m.href),children:[e.jsx("div",{className:"mr-2",children:m.icon}),e.jsx("span",{children:i(m.title)}),m.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:i(m.parent)})]},m.href))})]})]})]})}function Ee(){const{theme:s,setTheme:n}=qi();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(V,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>n(s==="light"?"dark":"light"),children:s==="light"?e.jsx(go,{size:20}):e.jsx(jo,{size:20})}),e.jsx(jr,{})]})}const Cr=u.forwardRef(({className:s,...n},a)=>e.jsx(Sn,{ref:a,className:_("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...n}));Cr.displayName=Sn.displayName;const Sr=u.forwardRef(({className:s,...n},a)=>e.jsx(kn,{ref:a,className:_("aspect-square h-full w-full",s),...n}));Sr.displayName=kn.displayName;const kr=u.forwardRef(({className:s,...n},a)=>e.jsx(Tn,{ref:a,className:_("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...n}));kr.displayName=Tn.displayName;function Re(){const s=ms(),n=rn(),a=vo(ic),{t:l}=I(["common"]),r=()=>{dr(),n(oc()),s("/sign-in")},i=a?.email?.split("@")[0]||l("common:user"),c=i.substring(0,2).toUpperCase();return e.jsxs(_s,{children:[e.jsx(ws,{asChild:!0,children:e.jsx(V,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(Cr,{className:"h-8 w-8",children:[e.jsx(Sr,{src:a?.avatar_url,alt:i}),e.jsx(kr,{children:c})]})})}),e.jsxs(ds,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(ha,{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:i}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:a?.email||l("common:defaultEmail")})]})}),e.jsx(lt,{}),e.jsx(pe,{asChild:!0,children:e.jsxs(Vs,{to:"/config/system",children:[l("common:settings"),e.jsx(sa,{children:"⌘S"})]})}),e.jsx(lt,{}),e.jsxs(pe,{onClick:r,children:[l("common:logout"),e.jsx(sa,{children:"⇧⌘Q"})]})]})]})}const A=window?.settings?.secure_path,Oc=s=>F.get(A+"/stat/getOrder",{params:s}),zc=()=>F.get(A+"/stat/getStats"),Ga=s=>F.get(A+"/stat/getTrafficRank",{params:s}),Lc=()=>F.get(A+"/theme/getThemes"),Ac=s=>F.post(A+"/theme/getThemeConfig",{name:s}),$c=(s,n)=>F.post(A+"/theme/saveThemeConfig",{name:s,config:n}),qc=s=>{const n=new FormData;return n.append("file",s),F.post(A+"/theme/upload",n,{headers:{"Content-Type":"multipart/form-data"}})},Hc=s=>F.post(A+"/theme/delete",{name:s}),Kc=s=>F.post(A+"/config/save",s),Tr=()=>F.get(A+"/server/manage/getNodes"),Uc=s=>F.post(A+"/server/manage/save",s),Bc=s=>F.post(A+"/server/manage/drop",s),Gc=s=>F.post(A+"/server/manage/copy",s),Yc=s=>F.post(A+"/server/manage/update",s),Wc=s=>F.post(A+"/server/manage/sort",s),Ot=()=>F.get(A+"/server/group/fetch"),Jc=s=>F.post(A+"/server/group/save",s),Qc=s=>F.post(A+"/server/group/drop",s),Pr=()=>F.get(A+"/server/route/fetch"),Zc=s=>F.post(A+"/server/route/save",s),Xc=s=>F.post(A+"/server/route/drop",s),ed=()=>F.get(A+"/payment/fetch"),sd=()=>F.get(A+"/payment/getPaymentMethods"),td=s=>F.post(A+"/payment/getPaymentForm",s),ad=s=>F.post(A+"/payment/save",s),nd=s=>F.post(A+"/payment/drop",s),rd=s=>F.post(A+"/payment/show",s),ld=s=>F.post(A+"/payment/sort",s),od=s=>F.post(A+"/notice/save",s),id=s=>F.post(A+"/notice/drop",s),cd=s=>F.post(A+"/notice/show",s),dd=()=>F.get(A+"/knowledge/fetch"),md=s=>F.get(A+"/knowledge/fetch?id="+s),ud=s=>F.post(A+"/knowledge/save",s),xd=s=>F.post(A+"/knowledge/drop",s),hd=s=>F.post(A+"/knowledge/show",s),fd=s=>F.post(A+"/knowledge/sort",s),Os=()=>F.get(A+"/plan/fetch"),pd=s=>F.post(A+"/plan/save",s),Ht=s=>F.post(A+"/plan/update",s),gd=s=>F.post(A+"/plan/drop",s),jd=s=>F.post(A+"/plan/sort",{ids:s}),vd=async s=>F.post(A+"/order/fetch",s),bd=s=>F.post(A+"/order/detail",s),yd=s=>F.post(A+"/order/paid",s),Nd=s=>F.post(A+"/order/cancel",s),Ya=s=>F.post(A+"/order/update",s),_d=s=>F.post(A+"/order/assign",s),wd=s=>F.post(A+"/coupon/fetch",s),Cd=s=>F.post(A+"/coupon/generate",s),Sd=s=>F.post(A+"/coupon/drop",s),kd=s=>F.post(A+"/coupon/update",s),Td=s=>F.post(A+"/user/fetch",s),Pd=s=>F.post(A+"/user/update",s),Dd=s=>F.post(A+"/user/resetSecret",s),Ed=s=>F.post(A+"/user/generate",s),Rd=s=>F.post(A+"/stat/getStatUser",s),Vd=s=>F.post(A+"/ticket/fetch",s),Id=s=>F.get(A+"/ticket/fetch?id= "+s),Fd=s=>F.post(A+"/ticket/reply",s),Dr=s=>F.post(A+"/ticket/close",{id:s}),hs=(s="")=>F.get(A+"/config/fetch?key="+s),fs=s=>F.post(A+"/config/save",s),Md=()=>F.get(A+"/config/getEmailTemplate"),Od=()=>F.post(A+"/config/testSendMail"),zd=()=>F.post(A+"/config/setTelegramWebhook"),fa=bo,zt=u.forwardRef(({className:s,...n},a)=>e.jsx(Pn,{ref:a,className:_("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...n}));zt.displayName=Pn.displayName;const Ns=u.forwardRef(({className:s,...n},a)=>e.jsx(Dn,{ref:a,className:_("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}));Ns.displayName=Dn.displayName;const yt=u.forwardRef(({className:s,...n},a)=>e.jsx(En,{ref:a,className:_("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...n}));yt.displayName=En.displayName;const G=yo,js=Po,Y=No,U=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(Rn,{ref:l,className:_("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(_o,{asChild:!0,children:e.jsx(da,{className:"h-4 w-4 opacity-50"})})]}));U.displayName=Rn.displayName;const Er=u.forwardRef(({className:s,...n},a)=>e.jsx(Vn,{ref:a,className:_("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(wo,{className:"h-4 w-4"})}));Er.displayName=Vn.displayName;const Rr=u.forwardRef(({className:s,...n},a)=>e.jsx(In,{ref:a,className:_("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(da,{className:"h-4 w-4"})}));Rr.displayName=In.displayName;const B=u.forwardRef(({className:s,children:n,position:a="popper",...l},r)=>e.jsx(Co,{children:e.jsxs(Fn,{ref:r,className:_("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(Er,{}),e.jsx(So,{className:_("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(Rr,{})]})}));B.displayName=Fn.displayName;const Ld=u.forwardRef(({className:s,...n},a)=>e.jsx(Mn,{ref:a,className:_("px-2 py-1.5 text-sm font-semibold",s),...n}));Ld.displayName=Mn.displayName;const L=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(On,{ref:l,className:_("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(ko,{children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsx(To,{children:n})]}));L.displayName=On.displayName;const Ad=u.forwardRef(({className:s,...n},a)=>e.jsx(zn,{ref:a,className:_("-mx-1 my-1 h-px bg-muted",s),...n}));Ad.displayName=zn.displayName;function zs({className:s,classNames:n,showOutsideDays:a=!0,...l}){return e.jsx(Do,{showOutsideDays:a,className:_("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:_(Us({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:_("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:_(Us({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,...i})=>e.jsx(Ln,{className:_("h-4 w-4",r),...i}),IconRight:({className:r,...i})=>e.jsx(ia,{className:_("h-4 w-4",r),...i})},...l})}zs.displayName="Calendar";const rs=Ro,ls=Vo,Xe=u.forwardRef(({className:s,align:n="center",sideOffset:a=4,...l},r)=>e.jsx(Eo,{children:e.jsx(An,{ref:r,align:n,sideOffset:a,className:_("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})}));Xe.displayName=An.displayName;const vs={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},et=s=>(s/100).toFixed(2),$d=({active:s,payload:n,label:a})=>{const{t:l}=I();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,i)=>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"))?`¥${et(r.value)}`:l("dashboard:overview.transactions",{count:r.value})})]},i))]}):null},qd=[{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"}],Hd=(s,n)=>{const a=new Date;if(s==="custom"&&n)return{startDate:n.from,endDate:n.to};let l;switch(s){case"7d":l=Ye(a,7);break;case"30d":l=Ye(a,30);break;case"90d":l=Ye(a,90);break;case"180d":l=Ye(a,180);break;case"365d":l=Ye(a,365);break;default:l=Ye(a,30)}return{startDate:l,endDate:a}};function Kd(){const[s,n]=u.useState("amount"),[a,l]=u.useState("30d"),[r,i]=u.useState({from:Ye(new Date,7),to:new Date}),{t:c}=I(),{startDate:m,endDate:x}=Hd(a,r),{data:o}=se({queryKey:["orderStat",{start_date:Ge(m,"yyyy-MM-dd"),end_date:Ge(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:d}=await Oc({start_date:Ge(m,"yyyy-MM-dd"),end_date:Ge(x,"yyyy-MM-dd")});return d},refetchInterval:3e4});return e.jsxs(Me,{children:[e.jsx($e,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(cs,{children:c("dashboard:overview.title")}),e.jsxs(Ks,{children:[o?.summary.start_date," ",c("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(G,{value:a,onValueChange:d=>l(d),children:[e.jsx(U,{className:"w-[120px]",children:e.jsx(Y,{placeholder:c("dashboard:overview.selectTimeRange")})}),e.jsx(B,{children:qd.map(d=>e.jsx(L,{value:d.value,children:c(d.label)},d.value))})]}),a==="custom"&&e.jsxs(rs,{children:[e.jsx(ls,{asChild:!0,children:e.jsxs(J,{variant:"outline",className:_("min-w-0 justify-start text-left font-normal",!r&&"text-muted-foreground"),children:[e.jsx(dt,{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:[Ge(r.from,"yyyy-MM-dd")," -"," ",Ge(r.to,"yyyy-MM-dd")]}):Ge(r.from,"yyyy-MM-dd"):c("dashboard:overview.selectDate")})]})}),e.jsx(Xe,{className:"w-auto p-0",align:"end",children:e.jsx(zs,{mode:"range",defaultMonth:r?.from,selected:{from:r?.from,to:r?.to},onSelect:d=>{d?.from&&d?.to&&i({from:d.from,to:d.to})},numberOfMonths:2})})]})]}),e.jsx(fa,{value:s,onValueChange:d=>n(d),children:e.jsxs(zt,{children:[e.jsx(Ns,{value:"amount",children:c("dashboard:overview.amount")}),e.jsx(Ns,{value:"count",children:c("dashboard:overview.count")})]})})]})]})}),e.jsxs(qe,{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:c("dashboard:overview.totalIncome")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",et(o?.summary?.paid_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:c("dashboard:overview.totalTransactions",{count:o?.summary?.paid_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[c("dashboard:overview.avgOrderAmount")," ¥",et(o?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:c("dashboard:overview.totalCommission")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",et(o?.summary?.commission_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:c("dashboard:overview.totalTransactions",{count:o?.summary?.commission_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[c("dashboard:overview.commissionRate")," ",o?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]}),e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(Io,{width:"100%",height:"100%",children:e.jsxs(Fo,{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:vs.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:vs.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:vs.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:vs.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(Mo,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>Ge(new Date(d),"MM-dd",{locale:Ao})}),e.jsx(Oo,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>s==="amount"?`¥${et(d)}`:c("dashboard:overview.transactions",{count:d})}),e.jsx(zo,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(Lo,{content:e.jsx($d,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(za,{type:"monotone",dataKey:"paid_total",name:c("dashboard:overview.orderAmount"),stroke:vs.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(za,{type:"monotone",dataKey:"commission_total",name:c("dashboard:overview.commissionAmount"),stroke:vs.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(La,{dataKey:"paid_count",name:c("dashboard:overview.orderCount"),fill:vs.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(La,{dataKey:"commission_count",name:c("dashboard:overview.commissionCount"),fill:vs.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})]})]})}function le({className:s,...n}){return e.jsx("div",{className:_("animate-pulse rounded-md bg-primary/10",s),...n})}function Ud(){return e.jsxs(Me,{children:[e.jsxs($e,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(le,{className:"h-4 w-[120px]"}),e.jsx(le,{className:"h-4 w-4"})]}),e.jsxs(qe,{children:[e.jsx(le,{className:"h-8 w-[140px] mb-2"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4"}),e.jsx(le,{className:"h-4 w-[100px]"})]})]})]})}function Bd(){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(Ud,{},n))})}var Z=(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))(Z||{});const Zs={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},Xs={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var We=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(We||{}),re=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(re||{});const ht={0:"待确认",1:"发放中",2:"有效",3:"无效"},ft={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var _e=(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))(_e||{});const Gd={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var Ne=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s))(Ne||{});const Ps=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"}],is={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a"};var Fe=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(Fe||{});const Yd={1:"按金额优惠",2:"按比例优惠"};var at=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(at||{}),ts=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(ts||{}),nt=(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))(nt||{});function bs({title:s,value:n,icon:a,trend:l,description:r,onClick:i,highlight:c,className:m}){return e.jsxs(Me,{className:_("transition-colors",i&&"cursor-pointer hover:bg-muted/50",c&&"border-primary/50",m),onClick:i,children:[e.jsxs($e,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(cs,{className:"text-sm font-medium",children:s}),a]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n}),l?e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(Bo,{className:_("h-4 w-4",l.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:_("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 Wd({className:s}){const n=ms(),{t:a}=I(),{data:l,isLoading:r}=se({queryKey:["dashboardStats"],queryFn:async()=>(await zc()).data,refetchInterval:1e3*60*5});if(r||!l)return e.jsx(Bd,{});const i=()=>{const c=new URLSearchParams;c.set("commission_status",re.PENDING.toString()),c.set("status",Z.COMPLETED.toString()),c.set("commission_balance","gt:0"),n(`/finance/order?${c.toString()}`)};return e.jsxs("div",{className:_("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx(bs,{title:a("dashboard:stats.todayIncome"),value:Ts(l.todayIncome),icon:e.jsx($o,{className:"h-4 w-4 text-emerald-500"}),trend:{value:l.dayIncomeGrowth,label:a("dashboard:stats.vsYesterday"),isPositive:l.dayIncomeGrowth>0}}),e.jsx(bs,{title:a("dashboard:stats.monthlyIncome"),value:Ts(l.currentMonthIncome),icon:e.jsx(qo,{className:"h-4 w-4 text-blue-500"}),trend:{value:l.monthIncomeGrowth,label:a("dashboard:stats.vsLastMonth"),isPositive:l.monthIncomeGrowth>0}}),e.jsx(bs,{title:a("dashboard:stats.pendingTickets"),value:l.ticketPendingTotal,icon:e.jsx(Ho,{className:_("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(bs,{title:a("dashboard:stats.pendingCommission"),value:l.commissionPendingTotal,icon:e.jsx(Ko,{className:_("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:i,highlight:l.commissionPendingTotal>0}),e.jsx(bs,{title:a("dashboard:stats.monthlyNewUsers"),value:l.currentMonthNewUsers,icon:e.jsx(Wt,{className:"h-4 w-4 text-blue-500"}),trend:{value:l.userGrowth,label:a("dashboard:stats.vsLastMonth"),isPositive:l.userGrowth>0}}),e.jsx(bs,{title:a("dashboard:stats.totalUsers"),value:l.totalUsers,icon:e.jsx(Wt,{className:"h-4 w-4 text-muted-foreground"}),description:a("dashboard:stats.activeUsers",{count:l.activeUsers})}),e.jsx(bs,{title:a("dashboard:stats.monthlyUpload"),value:ss(l.monthTraffic.upload),icon:e.jsx(Jt,{className:"h-4 w-4 text-emerald-500"}),description:a("dashboard:stats.todayTraffic",{value:ss(l.todayTraffic.upload)})}),e.jsx(bs,{title:a("dashboard:stats.monthlyDownload"),value:ss(l.monthTraffic.download),icon:e.jsx(Uo,{className:"h-4 w-4 text-blue-500"}),description:a("dashboard:stats.todayTraffic",{value:ss(l.todayTraffic.download)})})]})}const ot=u.forwardRef(({className:s,children:n,...a},l)=>e.jsxs($n,{ref:l,className:_("relative overflow-hidden",s),...a,children:[e.jsx(Go,{className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(Tt,{}),e.jsx(Yo,{})]}));ot.displayName=$n.displayName;const Tt=u.forwardRef(({className:s,orientation:n="vertical",...a},l)=>e.jsx(qn,{ref:l,orientation:n,className:_("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(Wo,{className:"relative flex-1 rounded-full bg-border"})}));Tt.displayName=qn.displayName;const ta={today:{getValue:()=>{const s=Qo();return{start:s,end:Zo(s,1)}}},last7days:{getValue:()=>{const s=new Date;return{start:Ye(s,7),end:s}}},last30days:{getValue:()=>{const s=new Date;return{start:Ye(s,30),end:s}}},custom:{getValue:()=>null}};function Wa({selectedRange:s,customDateRange:n,onRangeChange:a,onCustomRangeChange:l}){const{t:r}=I(),i={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(G,{value:s,onValueChange:a,children:[e.jsx(U,{className:"w-[120px]",children:e.jsx(Y,{placeholder:r("dashboard:trafficRank.selectTimeRange")})}),e.jsx(B,{position:"popper",className:"z-50",children:Object.entries(ta).map(([c])=>e.jsx(L,{value:c,children:i[c]},c))})]}),s==="custom"&&e.jsxs(rs,{children:[e.jsx(ls,{asChild:!0,children:e.jsxs(J,{variant:"outline",className:_("min-w-0 justify-start text-left font-normal",!n&&"text-muted-foreground"),children:[e.jsx(dt,{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:[Ge(n.from,"yyyy-MM-dd")," -"," ",Ge(n.to,"yyyy-MM-dd")]}):Ge(n.from,"yyyy-MM-dd"):e.jsx("span",{children:r("dashboard:trafficRank.selectDateRange")})})]})}),e.jsx(Xe,{className:"w-auto p-0",align:"end",children:e.jsx(zs,{mode:"range",defaultMonth:n?.from,selected:{from:n?.from,to:n?.to},onSelect:c=>{c?.from&&c?.to&&l({from:c.from,to:c.to})},numberOfMonths:2})})]})]})}const As=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Jd({className:s}){const{t:n}=I(),[a,l]=u.useState("today"),[r,i]=u.useState({from:Ye(new Date,7),to:new Date}),[c,m]=u.useState("today"),[x,o]=u.useState({from:Ye(new Date,7),to:new Date}),d=u.useMemo(()=>a==="custom"?{start:r.from,end:r.to}:ta[a].getValue(),[a,r]),p=u.useMemo(()=>c==="custom"?{start:x.from,end:x.to}:ta[c].getValue(),[c,x]),{data:P}=se({queryKey:["nodeTrafficRank",d.start,d.end],queryFn:()=>Ga({type:"node",start_time:ve.round(d.start.getTime()/1e3),end_time:ve.round(d.end.getTime()/1e3)}),refetchInterval:3e4}),{data:R}=se({queryKey:["userTrafficRank",p.start,p.end],queryFn:()=>Ga({type:"user",start_time:ve.round(p.start.getTime()/1e3),end_time:ve.round(p.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:_("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(Me,{children:[e.jsx($e,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(cs,{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(Wa,{selectedRange:a,customDateRange:r,onRangeChange:l,onCustomRangeChange:i}),e.jsx(Aa,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(qe,{className:"flex-1",children:P?.data?e.jsxs(ot,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:P.data.map(f=>e.jsx(ce,{delayDuration:200,children:e.jsxs(oe,{children:[e.jsx(ie,{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:_("ml-2 flex items-center text-xs font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?e.jsx(Qt,{className:"mr-1 h-3 w-3"}):e.jsx(Zt,{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:As(f.value)})]})]})})}),e.jsx(te,{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:As(f.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:As(f.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:_("font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?"+":"",f.change,"%"]})]})})]})},f.id))}),e.jsx(Tt,{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(Me,{children:[e.jsx($e,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(cs,{className:"flex items-center text-base font-medium",children:[e.jsx(Wt,{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(Wa,{selectedRange:c,customDateRange:x,onRangeChange:m,onCustomRangeChange:o}),e.jsx(Aa,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(qe,{className:"flex-1",children:R?.data?e.jsxs(ot,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:R.data.map(f=>e.jsx(ce,{children:e.jsxs(oe,{children:[e.jsx(ie,{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:_("ml-2 flex items-center text-xs font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?e.jsx(Qt,{className:"mr-1 h-3 w-3"}):e.jsx(Zt,{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/R.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:As(f.value)})]})]})})}),e.jsx(te,{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:As(f.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:As(f.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:_("font-medium",f.change>=0?"text-green-600":"text-red-600"),children:[f.change>=0?"+":"",f.change,"%"]})]})})]})},f.id))}),e.jsx(Tt,{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 Qd=Es("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 H({className:s,variant:n,...a}){return e.jsx("div",{className:_(Qd({variant:n}),s),...a})}const me=window?.settings?.secure_path,Vr=5*60*1e3,aa=new Map,Zd=s=>{const n=aa.get(s);return n?Date.now()-n.timestamp>Vr?(aa.delete(s),null):n.data:null},Xd=(s,n)=>{aa.set(s,{data:n,timestamp:Date.now()})},em=async(s,n=Vr)=>{const a=Zd(s);if(a)return a;const l=await F.get(s);return Xd(s,l),l},sm={getList:s=>F.post(`${me}/user/fetch`,s),update:s=>F.post(`${me}/user/update`,s),resetSecret:s=>F.post(`${me}/user/resetSecret`,{id:s}),generate:s=>F.post(`${me}/user/generate`,s),getStats:s=>F.post(`${me}/stat/getStatUser`,s),destroy:s=>F.post(`${me}/user/destroy`,{id:s})},Ja={getList:()=>em(`${me}/notice/fetch`),save:s=>F.post(`${me}/notice/save`,s),drop:s=>F.post(`${me}/notice/drop`,{id:s}),updateStatus:s=>F.post(`${me}/notice/show`,{id:s}),sort:s=>F.post(`${me}/notice/sort`,{ids:s})},Qa={getSystemStatus:()=>F.get(`${me}/system/getSystemStatus`),getQueueStats:()=>F.get(`${me}/system/getQueueStats`),getQueueWorkload:()=>F.get(`${me}/system/getQueueWorkload`),getQueueMasters:()=>F.get(`${me}/system/getQueueMasters`),getSystemLog:s=>F.get(`${me}/system/getSystemLog`,{params:s})},Ds={getPluginList:()=>F.get(`${me}/plugin/getPlugins`),installPlugin:s=>F.post(`${me}/plugin/install`,{code:s}),uninstallPlugin:s=>F.post(`${me}/plugin/uninstall`,{code:s}),enablePlugin:s=>F.post(`${me}/plugin/enable`,{code:s}),disablePlugin:s=>F.post(`${me}/plugin/disable`,{code:s}),getPluginConfig:s=>F.get(`${me}/plugin/config`,{params:{code:s}}),updatePluginConfig:(s,n)=>F.post(`${me}/plugin/config`,{code:s,config:n})},Nt=u.forwardRef(({className:s,value:n,...a},l)=>e.jsx(Hn,{ref:l,className:_("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...a,children:e.jsx(Xo,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));Nt.displayName=Hn.displayName;function tm(){const{t:s}=I(),[n,a]=u.useState(null),[l,r]=u.useState(null),[i,c]=u.useState(!0),[m,x]=u.useState(!1),o=async()=>{try{x(!0);const[P,R]=await Promise.all([Qa.getSystemStatus(),Qa.getQueueStats()]);a(P.data),r(R.data)}catch(P){console.error("Error fetching system data:",P)}finally{c(!1),x(!1)}};u.useEffect(()=>{o();const P=setInterval(o,3e4);return()=>clearInterval(P)},[]);const d=()=>{o()};if(i)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(ma,{className:"h-6 w-6 animate-spin"})});const p=P=>P?e.jsx(Kn,{className:"h-5 w-5 text-green-500"}):e.jsx(Un,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Me,{children:[e.jsxs($e,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(cs,{className:"flex items-center gap-2",children:[e.jsx(ei,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Ks,{children:s("dashboard:queue.status.description")})]}),e.jsx(J,{variant:"outline",size:"icon",onClick:d,disabled:m,children:e.jsx(si,{className:_("h-4 w-4",m&&"animate-spin")})})]}),e.jsx(qe,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[p(l?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(H,{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(ce,{children:e.jsxs(oe,{children:[e.jsx(ie,{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(Nt,{value:(l?.recentJobs||0)/(l?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(te,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:l?.periods?.recentJobs||0})})})]})}),e.jsx(ce,{children:e.jsxs(oe,{children:[e.jsx(ie,{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(Nt,{value:(l?.jobsPerMinute||0)/(l?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(te,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:l?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(Me,{children:[e.jsxs($e,{children:[e.jsxs(cs,{className:"flex items-center gap-2",children:[e.jsx(ti,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Ks,{children:s("dashboard:queue.details.description")})]}),e.jsx(qe,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children: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(Nt,{value:(l?.processes||0)/((l?.processes||0)+(l?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]})}function am(){const{t:s}=I();return e.jsxs(we,{children:[e.jsxs(Ce,{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(Ie,{}),e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsx(Te,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Wd,{}),e.jsx(Kd,{}),e.jsx(Jd,{}),e.jsx(tm,{})]})})})]})}const nm=Object.freeze(Object.defineProperty({__proto__:null,default:am},Symbol.toStringTag,{value:"Module"})),ye=u.forwardRef(({className:s,orientation:n="horizontal",decorative:a=!0,...l},r)=>e.jsx(Bn,{ref:r,decorative:a,orientation:n,className:_("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...l}));ye.displayName=Bn.displayName;function rm({className:s,items:n,...a}){const{pathname:l}=ra(),r=ms(),[i,c]=u.useState(l??"/settings"),m=o=>{c(o),r(o)},{t:x}=I("settings");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(G,{value:i,onValueChange:m,children:[e.jsx(U,{className:"h-12 sm:w-48",children:e.jsx(Y,{placeholder:"Theme"})}),e.jsx(B,{children:n.map(o=>e.jsx(L,{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:_("flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",s),...a,children:n.map(o=>e.jsxs(Vs,{to:o.href,className:_(Bs({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 lm=[{title:"site.title",key:"site",icon:e.jsx(ai,{size:18}),href:"/config/system",description:"site.description"},{title:"safe.title",key:"safe",icon:e.jsx(_n,{size:18}),href:"/config/system/safe",description:"safe.description"},{title:"subscribe.title",key:"subscribe",icon:e.jsx(wn,{size:18}),href:"/config/system/subscribe",description:"subscribe.description"},{title:"invite.title",key:"invite",icon:e.jsx(ni,{size:18}),href:"/config/system/invite",description:"invite.description"},{title:"server.title",key:"server",icon:e.jsx(Nn,{size:18}),href:"/config/system/server",description:"server.description"},{title:"email.title",key:"email",icon:e.jsx(ri,{size:18}),href:"/config/system/email",description:"email.description"},{title:"telegram.title",key:"telegram",icon:e.jsx(li,{size:18}),href:"/config/system/telegram",description:"telegram.description"},{title:"app.title",key:"app",icon:e.jsx(yn,{size:18}),href:"/config/system/app",description:"app.description"}];function om(){const{t:s}=I("settings");return e.jsxs(we,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(ye,{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(rm,{items:lm})}),e.jsx("div",{className:"w-full p-1 pr-4 lg:max-w-xl",children:e.jsx("div",{className:"pb-16",children:e.jsx(la,{})})})]})]})]})}const im=Object.freeze(Object.defineProperty({__proto__:null,default:om},Symbol.toStringTag,{value:"Module"})),K=u.forwardRef(({className:s,...n},a)=>e.jsx(Gn,{className:_("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(oi,{className:_("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")})}));K.displayName=Gn.displayName;const ps=u.forwardRef(({className:s,...n},a)=>e.jsx("textarea",{className:_("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}));ps.displayName="Textarea";const cm=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 dm(){const{t:s}=I("settings"),[n,a]=u.useState(!1),l=u.useRef(null),{data:r}=se({queryKey:["settings","site"],queryFn:()=>hs("site")}),{data:i}=se({queryKey:["plans"],queryFn:()=>Os()}),c=de({resolver:ue(cm),defaultValues:{},mode:"onBlur"}),{mutateAsync:m}=as({mutationFn:fs,onSuccess:d=>{d.data&&$.success(s("common.autoSaved"))}});u.useEffect(()=>{if(r?.data?.site){const d=r?.data?.site;Object.entries(d).forEach(([p,P])=>{c.setValue(p,P)}),l.current=d}},[r]);const x=u.useCallback(ve.debounce(async d=>{if(!ve.isEqual(d,l.current)){a(!0);try{const p=Object.entries(d).reduce((P,[R,f])=>(P[R]=f===null?"":f,P),{});await m(p),l.current=d}finally{a(!1)}}},1e3),[m]),o=u.useCallback(d=>{x(d)},[x]);return u.useEffect(()=>{const d=c.watch(p=>{o(p)});return()=>d.unsubscribe()},[c.watch,o]),e.jsx(xe,{...c,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{control:c.control,name:"app_name",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("site.form.siteName.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("site.form.siteName.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(c.getValues())}})}),e.jsx(M,{children:s("site.form.siteName.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:c.control,name:"app_description",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("site.form.siteDescription.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("site.form.siteDescription.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(c.getValues())}})}),e.jsx(M,{children:s("site.form.siteDescription.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:c.control,name:"app_url",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("site.form.siteUrl.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("site.form.siteUrl.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(c.getValues())}})}),e.jsx(M,{children:s("site.form.siteUrl.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:c.control,name:"force_https",render:({field:d})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("site.form.forceHttps.label")}),e.jsx(M,{children:s("site.form.forceHttps.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:!!d.value,onCheckedChange:p=>{d.onChange(Number(p)),o(c.getValues())}})})]})}),e.jsx(y,{control:c.control,name:"logo",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("site.form.logo.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("site.form.logo.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(c.getValues())}})}),e.jsx(M,{children:s("site.form.logo.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:c.control,name:"subscribe_url",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("site.form.subscribeUrl.label")}),e.jsx(w,{children:e.jsx(ps,{placeholder:s("site.form.subscribeUrl.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(c.getValues())}})}),e.jsx(M,{children:s("site.form.subscribeUrl.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:c.control,name:"tos_url",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("site.form.tosUrl.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("site.form.tosUrl.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(c.getValues())}})}),e.jsx(M,{children:s("site.form.tosUrl.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:c.control,name:"stop_register",render:({field:d})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("site.form.stopRegister.label")}),e.jsx(M,{children:s("site.form.stopRegister.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:!!d.value,onCheckedChange:p=>{d.onChange(Number(p)),o(c.getValues())}})})]})}),e.jsx(y,{control:c.control,name:"try_out_plan_id",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("site.form.tryOut.label")}),e.jsx(w,{children:e.jsxs(G,{value:d.value?.toString(),onValueChange:p=>{d.onChange(Number(p)),o(c.getValues())},children:[e.jsx(U,{children:e.jsx(Y,{placeholder:s("site.form.tryOut.placeholder")})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:s("site.form.tryOut.placeholder")}),i?.data?.map(p=>e.jsx(L,{value:p.id.toString(),children:p.name},p.id.toString()))]})]})}),e.jsx(M,{children:s("site.form.tryOut.description")}),e.jsx(E,{})]})}),!!c.watch("try_out_plan_id")&&e.jsx(y,{control:c.control,name:"try_out_hour",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"",children:s("site.form.tryOut.duration.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("site.form.tryOut.duration.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(c.getValues())}})}),e.jsx(M,{children:s("site.form.tryOut.duration.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:c.control,name:"currency",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("site.form.currency.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("site.form.currency.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(c.getValues())}})}),e.jsx(M,{children:s("site.form.currency.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:c.control,name:"currency_symbol",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("site.form.currencySymbol.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("site.form.currencySymbol.placeholder"),...d,value:d.value||"",onChange:p=>{d.onChange(p),o(c.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 mm(){const{t:s}=I("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(ye,{}),e.jsx(dm,{})]})}const um=Object.freeze(Object.defineProperty({__proto__:null,default:mm},Symbol.toStringTag,{value:"Module"})),xm=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()}),hm={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 fm(){const{t:s}=I("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=de({resolver:ue(xm),defaultValues:hm,mode:"onBlur"}),{data:i}=se({queryKey:["settings","safe"],queryFn:()=>hs("safe")}),{mutateAsync:c}=as({mutationFn:fs,onSuccess:o=>{o.data&&$.success(s("common.autoSaved"))}});u.useEffect(()=>{if(i?.data.safe){const o=i.data.safe;Object.entries(o).forEach(([d,p])=>{typeof p=="number"?r.setValue(d,String(p)):r.setValue(d,p)}),l.current=o}},[i]);const m=u.useCallback(ve.debounce(async o=>{if(!ve.isEqual(o,l.current)){a(!0);try{await c(o),l.current=o}finally{a(!1)}}},1e3),[c]),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(xe,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{control:r.control,name:"email_verify",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("safe.form.emailVerify.label")}),e.jsx(M,{children:s("safe.form.emailVerify.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(y,{control:r.control,name:"email_gmail_limit_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("safe.form.gmailLimit.label")}),e.jsx(M,{children:s("safe.form.gmailLimit.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(y,{control:r.control,name:"safe_mode_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("safe.form.safeMode.label")}),e.jsx(M,{children:s("safe.form.safeMode.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(y,{control:r.control,name:"secure_path",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("safe.form.securePath.label")}),e.jsx(w,{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(y,{control:r.control,name:"email_whitelist_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("safe.form.emailWhitelist.label")}),e.jsx(M,{children:s("safe.form.emailWhitelist.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),r.watch("email_whitelist_enable")&&e.jsx(y,{control:r.control,name:"email_whitelist_suffix",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("safe.form.emailWhitelist.suffixes.label")}),e.jsx(w,{children:e.jsx(ps,{placeholder:s("safe.form.emailWhitelist.suffixes.placeholder"),...o,value:(o.value||[]).join(` +import{r as m,j as e,t as gl,c as jl,I as Oa,a as Fs,S as ia,u as hs,b as ca,d as vl,O as da,e as bl,f as $,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 Vl,q as ln,F as Il,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 ue,E as he,G as cn,H as Vt,J as It,K as ma,L as He,T as Ft,M as Mt,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 Ms,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 Os,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 Re,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 Vn,aU as No,aV as _o,aW as In,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 Vo,be as Io,bf as Je,bg as te,bh as Qe,bi as ht,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 Xt,bx as ea,by as Bo,bz as Go,bA as Hn,bB as Wo,bC as Yo,bD as Kn,bE as Qo,bF as be,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 ls,c0 as ci,c1 as di,c2 as mi,c3 as kt,c4 as ke,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 Ot,ch as zs,ci as os,cj as Be,ck as Ge,cl as Xe,cm as es,cn as ss,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 fs,cC as ps,cD as ft,cE as Si,cF as Tt,cG as ki,cH as Ha,cI as tr,cJ as Ka,cK as Pt,cL as Ti,cM as Pi,cN as Di,cO as Ei,cP as ar,cQ as Ri,cR as Vi,cS as nr,cT as na,cU as rr,cV as Ii,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=m.createContext($i);function qi({children:s,defaultTheme:n="system",storageKey:a="vite-ui-theme",...l}){const[r,c]=m.useState(()=>localStorage.getItem(a)||n);m.useEffect(()=>{const u=window.document.documentElement;if(u.classList.remove("light","dark"),r==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";u.classList.add(x);return}u.classList.add(r)},[r]);const i={theme:r,setTheme:u=>{localStorage.setItem(a,u),c(u)}};return e.jsx(ir.Provider,{...l,value:i,children:s})}const Hi=()=>{const s=m.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={},oe=function(n,a,l){let r=Promise.resolve();if(a&&a.length>0){const i=document.getElementsByTagName("link"),u=document.querySelector("meta[property=csp-nonce]"),x=u?.nonce||u?.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 g=i[f];if(g.href===o&&(!d||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${p}`))return;const R=document.createElement("link");if(R.rel=d?"stylesheet":Ki,d||(R.as="script"),R.crossOrigin="",R.href=o,x&&R.setAttribute("nonce",x),document.head.appendChild(R),d)return new Promise((f,g)=>{R.addEventListener("load",f),R.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${o}`)))})}))}function c(i){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=i,window.dispatchEvent(u),!u.defaultPrevented)throw i}return r.then(i=>{for(const u of i||[])u.status==="rejected"&&c(u.reason);return n().catch(c)})};function N(...s){return gl(jl(s))}const Zs=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"}}),V=m.forwardRef(({className:s,variant:n,size:a,asChild:l=!1,children:r,disabled:c,loading:i=!1,leftSection:u,rightSection:x,...o},d)=>{const p=l?ia:"button";return e.jsxs(p,{className:N(Zs({variant:n,size:a,className:s})),disabled:i||c,ref:d,...o,children:[(u&&i||!u&&!x&&i)&&e.jsx(Oa,{className:"mr-2 h-4 w-4 animate-spin"}),!i&&u&&e.jsx("div",{className:"mr-2",children:u}),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"})]})});V.displayName="Button";function Ks({className:s,minimal:n=!1}){const a=hs();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(V,{variant:"outline",onClick:()=>a(-1),children:"Go Back"}),e.jsx(V,{onClick:()=>a("/"),children:"Back to Home"})]})]})})}function Ba(){const s=hs();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(V,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(V,{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(V,{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:u}=r;return Yi(u)||u>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})},zt=Ji({prefixKey:dr});Zi({prefixKey:dr});const mr="access_token";function dt(){return zt.get(mr)}function ur(){zt.remove(mr)}const Ga=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Xi({children:s}){const n=hs(),a=ca(),l=dt();return m.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 oe(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 oe(()=>Promise.resolve().then(()=>Fc),void 0,import.meta.url)).default}),errorElement:e.jsx(Ks,{}),children:[{index:!0,lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>rm);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Ks,{}),children:[{path:"system",lazy:async()=>({Component:(await oe(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 oe(async()=>{const{default:s}=await Promise.resolve().then(()=>xm);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>jm);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>_m);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Tm);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Vm);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>zm);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Hm);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Wm);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Xm);return{default:s}},void 0,import.meta.url)).default})}]},{path:"payment",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>cu);return{default:s}},void 0,import.meta.url)).default})},{path:"plugin",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>uu);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>pu);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>_u);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Eu);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Ks,{}),children:[{path:"manage",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>tx);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>ox);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>xx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Ks,{}),children:[{path:"plan",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Nx);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Mx);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Ux);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Ks,{}),children:[{path:"manage",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>ph);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await oe(async()=>{const{default:s}=await Promise.resolve().then(()=>Mh);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Ks},{path:"/404",Component:Ba},{path:"/503",Component:Bi},{path:"*",Component:Ba}]),tc="locale";function ac(){return zt.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 I=bl.create({baseURL:rc(),timeout:12e3,headers:{"Content-Type":"application/json"}});I.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const n=dt();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));I.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(),$.error(a||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[n]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});function lc(){return I.get("/user/info")}const Kt={token:dt()?.value||"",userInfo:null,isLoggedIn:!!dt()?.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:Kt,reducers:{setToken(s,n){s.token=n.payload,s.isLoggedIn=!!n.payload},resetUserState:()=>Kt},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 Kt})}}),{setToken:oc,resetUserState:ic}=hr.actions,cc=s=>s.user.userInfo,dc=hr.reducer,fr=_l({reducer:{user:dc}});dt()?.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(Vl,{richColors:!0,position:"top-right"})]})})})}));const Le=m.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("rounded-xl border bg-card text-card-foreground shadow",s),...n}));Le.displayName="Card";const Ke=m.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("flex flex-col space-y-1.5 p-6",s),...n}));Ke.displayName="CardHeader";const us=m.forwardRef(({className:s,...n},a)=>e.jsx("h3",{ref:a,className:N("font-semibold leading-none tracking-tight",s),...n}));us.displayName="CardTitle";const Ys=m.forwardRef(({className:s,...n},a)=>e.jsx("p",{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Ys.displayName="CardDescription";const Ue=m.forwardRef(({className:s,...n},a)=>e.jsx("div",{ref:a,className:N("p-6 pt-0",s),...n}));Ue.displayName="CardContent";const uc=m.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=Fs("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Dt=m.forwardRef(({className:s,...n},a)=>e.jsx(ln,{ref:a,className:N(xc(),s),...n}));Dt.displayName=ln.displayName;const fe=Il,pr=m.createContext({}),b=({...s})=>e.jsx(pr.Provider,{value:{name:s.name},children:e.jsx(Fl,{...s})}),Lt=()=>{const s=m.useContext(pr),n=m.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=m.createContext({}),v=m.forwardRef(({className:s,...n},a)=>{const l=m.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=m.forwardRef(({className:s,...n},a)=>{const{error:l,formItemId:r}=Lt();return e.jsx(Dt,{ref:a,className:N(l&&"text-destructive",s),htmlFor:r,...n})});y.displayName="FormLabel";const _=m.forwardRef(({...s},n)=>{const{error:a,formItemId:l,formDescriptionId:r,formMessageId:c}=Lt();return e.jsx(ia,{ref:n,id:l,"aria-describedby":a?`${r} ${c}`:`${r}`,"aria-invalid":!!a,...s})});_.displayName="FormControl";const M=m.forwardRef(({className:s,...n},a)=>{const{formDescriptionId:l}=Lt();return e.jsx("p",{ref:a,id:l,className:N("text-[0.8rem] text-muted-foreground",s),...n})});M.displayName="FormDescription";const E=m.forwardRef(({className:s,children:n,...a},l)=>{const{error:r,formMessageId:c}=Lt(),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=m.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=m.forwardRef(({className:s,...n},a)=>{const[l,r]=m.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(V,{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=>I({url:"/passport/auth/login",method:"post",data:s});function xe(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 xe(s,n)}function Gs(s){const n=typeof s=="string"?parseFloat(s):s;return isNaN(n)?"0.00":n.toFixed(2)}function Rs(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 Et(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 rs(s){const n=s/1024,a=n/1024,l=a/1024,r=l/1024;return r>=1?Gs(r)+" TB":l>=1?Gs(l)+" GB":a>=1?Gs(a)+" MB":Gs(n)+" KB"}const pc="access_token";function gc(s){zt.set(pc,s)}function jc({className:s,onForgotPassword:n,...a}){const l=hs(),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")})}),u=ue({resolver:he(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&&u.setError("root",{message:d.response.data.message})}}return e.jsx("div",{className:N("grid gap-6",s),...a,children:e.jsx(fe,{...u,children:e.jsx("form",{onSubmit:u.handleSubmit(x),className:"space-y-4",children:e.jsxs("div",{className:"space-y-4",children:[u.formState.errors.root&&e.jsx("div",{className:"text-sm text-destructive",children:u.formState.errors.root.message}),e.jsx(b,{control:u.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:u.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(V,{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(V,{className:"w-full",size:"lg",loading:u.formState.isSubmitting,children:c("signIn.submit")})]})})})})}const je=cn,$e=dn,vc=mn,pt=ma,vr=m.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=m.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(vc,{children:[e.jsx(vr,{}),e.jsxs(It,{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(He,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));pe.displayName=It.displayName;const ye=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-1.5 text-center sm:text-left",s),...n});ye.displayName="DialogHeader";const qe=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});qe.displayName="DialogFooter";const ve=m.forwardRef(({className:s,...n},a)=>e.jsx(Ft,{ref:a,className:N("text-lg font-semibold leading-none tracking-tight",s),...n}));ve.displayName=Ft.displayName;const Ee=m.forwardRef(({className:s,...n},a)=>e.jsx(Mt,{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Ee.displayName=Mt.displayName;const Qs=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=m.forwardRef(({className:s,variant:n,size:a,asChild:l=!1,...r},c)=>{const i=l?ia:"button";return e.jsx(i,{className:N(Qs({variant:n,size:a,className:s})),ref:c,...r})});G.displayName="Button";const ks=ql,Ts=Hl,bc=Kl,yc=m.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=m.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 xs=m.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})}));xs.displayName=hn.displayName;const ge=m.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}));ge.displayName=fn.displayName;const _c=m.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(Ms,{className:"h-4 w-4"})})}),n]}));_c.displayName=pn.displayName;const wc=m.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=m.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 mt=m.forwardRef(({className:s,...n},a)=>e.jsx(bn,{ref:a,className:N("-mx-1 my-1 h-px bg-muted",s),...n}));mt.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 Ut=[{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=Ut.find(r=>r.code===s.language)||Ut[1],l=a.flag;return e.jsxs(ks,{children:[e.jsx(Ts,{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(xs,{align:"end",className:"w-[120px]",children:Ut.map(r=>{const c=r.flag,i=r.code===s.language;return e.jsxs(ge,{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]=m.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(Le,{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(je,{open:s,onOpenChange:n,children:e.jsx(pe,{children:e.jsxs(ye,{children:[e.jsx(ve,{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(G,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>Et(l).then(()=>{$.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"})),Ce=m.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}));Ce.displayName="Layout";const Se=m.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}));Se.displayName="LayoutHeader";const Pe=m.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}));Pe.displayName="LayoutBody";const yr=Yl,Nr=Ql,_r=Jl,me=Zl,ce=Xl,de=eo,re=m.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}));re.displayName=yn.displayName;function At(){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]=m.useState(()=>{const r=localStorage.getItem(s);return r!==null?JSON.parse(r):n});return m.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,...u})=>{const x=`${r(u.title)}-${u.href}`;return n&&i?m.createElement(Ec,{...u,sub:i,key:x,closeNav:l}):n?m.createElement(Dc,{...u,key:x,closeNav:l}):i?m.createElement(Pc,{...u,sub:i,key:x,closeNav:l}):m.createElement(Cr,{...u,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(me,{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}=At(),{t:u}=F();return e.jsxs(Os,{to:l,onClick:r,className:N(Zs({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}),u(s),a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:u(a)})]})}function Pc({title:s,icon:n,label:a,sub:l,closeNav:r}){const{checkActiveNav:c}=At(),{isExpanded:i,toggleItem:u}=kc(),{t:x}=F(),o=!!l?.find(T=>c(T.href)),d=x(s),p=i(d)||o;return e.jsxs(yr,{open:p,onOpenChange:()=>u(d),children:[e.jsxs(Nr,{className:N(Zs({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(T=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(Cr,{...T,subLink:!0,closeNav:r})},x(T.title)))})})]})}function Dc({title:s,icon:n,label:a,href:l,closeNav:r}){const{checkActiveNav:c}=At(),{t:i}=F();return e.jsxs(ce,{delayDuration:0,children:[e.jsx(de,{asChild:!0,children:e.jsxs(Os,{to:l,onClick:r,className:N(Zs({variant:c(l)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[n,e.jsx("span",{className:"sr-only",children:i(s)})]})}),e.jsxs(re,{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}=At(),{t:i}=F(),u=!!l?.find(x=>c(x.href));return e.jsxs(ks,{children:[e.jsxs(ce,{delayDuration:0,children:[e.jsx(de,{asChild:!0,children:e.jsx(Ts,{asChild:!0,children:e.jsx(V,{variant:u?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:n})})}),e.jsxs(re,{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(xs,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(ja,{children:[i(s)," ",a?`(${i(a)})`:""]}),e.jsx(mt,{}),l.map(({title:x,icon:o,label:d,href:p})=>e.jsx(ge,{asChild:!0,children:e.jsxs(Os,{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]=m.useState(!1),{t:c}=F();return m.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(Ce,{children:[e.jsxs(Se,{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(V,{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(V,{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 Vc(){const[s,n]=wr({key:"collapsed-sidebar",defaultValue:!1});return m.useEffect(()=>{const a=()=>{n(window.innerWidth<768?!1:s)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[s,n]),[s,n]}function Ic(){const[s,n]=Vc();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:Ic},Symbol.toStringTag,{value:"Module"})),Ps=m.forwardRef(({className:s,...n},a)=>e.jsx(Re,{ref:a,className:N("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...n}));Ps.displayName=Re.displayName;const Mc=({children:s,...n})=>e.jsx(je,{...n,children:e.jsx(pe,{className:"overflow-hidden p-0",children:e.jsx(Ps,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:s})})}),Ls=m.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(Re.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})]}));Ls.displayName=Re.Input.displayName;const Ds=m.forwardRef(({className:s,...n},a)=>e.jsx(Re.List,{ref:a,className:N("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...n}));Ds.displayName=Re.List.displayName;const As=m.forwardRef((s,n)=>e.jsx(Re.Empty,{ref:n,className:"py-6 text-center text-sm",...s}));As.displayName=Re.Empty.displayName;const Ae=m.forwardRef(({className:s,...n},a)=>e.jsx(Re.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}));Ae.displayName=Re.Group.displayName;const Xs=m.forwardRef(({className:s,...n},a)=>e.jsx(Re.Separator,{ref:a,className:N("-mx-1 h-px bg-border",s),...n}));Xs.displayName=Re.Separator.displayName;const Te=m.forwardRef(({className:s,...n},a)=>e.jsx(Re.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}));Te.displayName=Re.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 Oe(){const[s,n]=m.useState(!1),a=hs(),l=Oc(),{t:r}=F("search"),{t:c}=F("nav");m.useEffect(()=>{const u=x=>{x.key==="k"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),n(o=>!o))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[]);const i=m.useCallback(u=>{n(!1),a(u)},[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(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(Ls,{placeholder:r("placeholder")}),e.jsxs(Ds,{children:[e.jsx(As,{children:r("noResults")}),e.jsx(Ae,{heading:r("title"),children:l.map(u=>e.jsxs(Te,{value:`${u.parent?u.parent+" ":""}${u.title}`,onSelect:()=>i(u.href),children:[e.jsx("div",{className:"mr-2",children:u.icon}),e.jsx("span",{children:c(u.title)}),u.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c(u.parent)})]},u.href))})]})]})]})}function Ve(){const{theme:s,setTheme:n}=Hi();return m.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(V,{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=m.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=m.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=m.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 Ie(){const s=hs(),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(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsx(V,{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(xs,{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(mt,{}),e.jsx(ge,{asChild:!0,children:e.jsxs(Os,{to:"/config/system",children:[l("common:settings"),e.jsx(ra,{children:"⌘S"})]})}),e.jsx(mt,{}),e.jsxs(ge,{onClick:r,children:[l("common:logout"),e.jsx(ra,{children:"⇧⌘Q"})]})]})]})}const q=window?.settings?.secure_path,zc=s=>I.get(q+"/stat/getOrder",{params:s}),Lc=()=>I.get(q+"/stat/getStats"),Wa=s=>I.get(q+"/stat/getTrafficRank",{params:s}),Ac=()=>I.get(q+"/theme/getThemes"),$c=s=>I.post(q+"/theme/getThemeConfig",{name:s}),qc=(s,n)=>I.post(q+"/theme/saveThemeConfig",{name:s,config:n}),Hc=s=>{const n=new FormData;return n.append("file",s),I.post(q+"/theme/upload",n,{headers:{"Content-Type":"multipart/form-data"}})},Kc=s=>I.post(q+"/theme/delete",{name:s}),Uc=s=>I.post(q+"/config/save",s),Dr=()=>I.get(q+"/server/manage/getNodes"),Bc=s=>I.post(q+"/server/manage/save",s),Gc=s=>I.post(q+"/server/manage/drop",s),Wc=s=>I.post(q+"/server/manage/copy",s),Yc=s=>I.post(q+"/server/manage/update",s),Qc=s=>I.post(q+"/server/manage/sort",s),$t=()=>I.get(q+"/server/group/fetch"),Jc=s=>I.post(q+"/server/group/save",s),Zc=s=>I.post(q+"/server/group/drop",s),Er=()=>I.get(q+"/server/route/fetch"),Xc=s=>I.post(q+"/server/route/save",s),ed=s=>I.post(q+"/server/route/drop",s),sd=()=>I.get(q+"/payment/fetch"),td=()=>I.get(q+"/payment/getPaymentMethods"),ad=s=>I.post(q+"/payment/getPaymentForm",s),nd=s=>I.post(q+"/payment/save",s),rd=s=>I.post(q+"/payment/drop",s),ld=s=>I.post(q+"/payment/show",s),od=s=>I.post(q+"/payment/sort",s),id=s=>I.post(q+"/notice/save",s),cd=s=>I.post(q+"/notice/drop",s),dd=s=>I.post(q+"/notice/show",s),md=()=>I.get(q+"/knowledge/fetch"),ud=s=>I.get(q+"/knowledge/fetch?id="+s),xd=s=>I.post(q+"/knowledge/save",s),hd=s=>I.post(q+"/knowledge/drop",s),fd=s=>I.post(q+"/knowledge/show",s),pd=s=>I.post(q+"/knowledge/sort",s),$s=()=>I.get(q+"/plan/fetch"),gd=s=>I.post(q+"/plan/save",s),Bt=s=>I.post(q+"/plan/update",s),jd=s=>I.post(q+"/plan/drop",s),vd=s=>I.post(q+"/plan/sort",{ids:s}),bd=async s=>I.post(q+"/order/fetch",s),yd=s=>I.post(q+"/order/detail",s),Nd=s=>I.post(q+"/order/paid",s),_d=s=>I.post(q+"/order/cancel",s),Ya=s=>I.post(q+"/order/update",s),wd=s=>I.post(q+"/order/assign",s),Cd=s=>I.post(q+"/coupon/fetch",s),Sd=s=>I.post(q+"/coupon/generate",s),kd=s=>I.post(q+"/coupon/drop",s),Td=s=>I.post(q+"/coupon/update",s),Pd=s=>I.post(q+"/user/fetch",s),Dd=s=>I.post(q+"/user/update",s),Ed=s=>I.post(q+"/user/resetSecret",s),Rd=s=>I.post(q+"/user/generate",s),Vd=s=>I.post(q+"/stat/getStatUser",s),Id=s=>I.post(q+"/ticket/fetch",s),Fd=s=>I.get(q+"/ticket/fetch?id= "+s),Md=s=>I.post(q+"/ticket/close",{id:s}),gs=(s="")=>I.get(q+"/config/fetch?key="+s),js=s=>I.post(q+"/config/save",s),Od=()=>I.get(q+"/config/getEmailTemplate"),zd=()=>I.post(q+"/config/testSendMail"),Ld=()=>I.post(q+"/config/setTelegramWebhook"),va=yo,qt=m.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}));qt.displayName=En.displayName;const Cs=m.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}));Cs.displayName=Rn.displayName;const Ct=m.forwardRef(({className:s,...n},a)=>e.jsx(Vn,{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}));Ct.displayName=Vn.displayName;const W=No,ys=Do,Y=_o,U=m.forwardRef(({className:s,children:n,...a},l)=>e.jsxs(In,{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"})})]}));U.displayName=In.displayName;const Rr=m.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 Vr=m.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"})}));Vr.displayName=Mn.displayName;const B=m.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(Vr,{})]})}));B.displayName=On.displayName;const Ad=m.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 A=m.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(Ms,{className:"h-4 w-4"})})}),e.jsx(Po,{children:n})]}));A.displayName=Ln.displayName;const $d=m.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 qs({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(Qs({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(Qs({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})}qs.displayName="Calendar";const is=Vo,cs=Io,ts=m.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})}));ts.displayName=qn.displayName;const Ns={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=Je(a,7);break;case"30d":l=Je(a,30);break;case"90d":l=Je(a,90);break;case"180d":l=Je(a,180);break;case"365d":l=Je(a,365);break;default:l=Je(a,30)}return{startDate:l,endDate:a}};function Ud(){const[s,n]=m.useState("amount"),[a,l]=m.useState("30d"),[r,c]=m.useState({from:Je(new Date,7),to:new Date}),{t:i}=F(),{startDate:u,endDate:x}=Kd(a,r),{data:o}=te({queryKey:["orderStat",{start_date:Qe(u,"yyyy-MM-dd"),end_date:Qe(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:d}=await zc({start_date:Qe(u,"yyyy-MM-dd"),end_date:Qe(x,"yyyy-MM-dd")});return d},refetchInterval:3e4});return e.jsxs(Le,{children:[e.jsx(Ke,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(us,{children:i("dashboard:overview.title")}),e.jsxs(Ys,{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(W,{value:a,onValueChange:d=>l(d),children:[e.jsx(U,{className:"w-[120px]",children:e.jsx(Y,{placeholder:i("dashboard:overview.selectTimeRange")})}),e.jsx(B,{children:Hd.map(d=>e.jsx(A,{value:d.value,children:i(d.label)},d.value))})]}),a==="custom"&&e.jsxs(is,{children:[e.jsx(cs,{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(ht,{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:[Qe(r.from,"yyyy-MM-dd")," -"," ",Qe(r.to,"yyyy-MM-dd")]}):Qe(r.from,"yyyy-MM-dd"):i("dashboard:overview.selectDate")})]})}),e.jsx(ts,{className:"w-auto p-0",align:"end",children:e.jsx(qs,{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(qt,{children:[e.jsx(Cs,{value:"amount",children:i("dashboard:overview.amount")}),e.jsx(Cs,{value:"count",children:i("dashboard:overview.count")})]})})]})]})}),e.jsxs(Ue,{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:Ns.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Ns.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:Ns.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Ns.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(Oo,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:d=>Qe(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:Ns.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(La,{type:"monotone",dataKey:"commission_total",name:i("dashboard:overview.commissionAmount"),stroke:Ns.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(Aa,{dataKey:"paid_count",name:i("dashboard:overview.orderCount"),fill:Ns.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(Aa,{dataKey:"commission_count",name:i("dashboard:overview.commissionCount"),fill:Ns.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})]})]})}function ae({className:s,...n}){return e.jsx("div",{className:N("animate-pulse rounded-md bg-primary/10",s),...n})}function Bd(){return e.jsxs(Le,{children:[e.jsxs(Ke,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ae,{className:"h-4 w-[120px]"}),e.jsx(ae,{className:"h-4 w-4"})]}),e.jsxs(Ue,{children:[e.jsx(ae,{className:"h-8 w-[140px] mb-2"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4"}),e.jsx(ae,{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 Z=(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))(Z||{});const nt={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},rt={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var Ze=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(Ze||{}),ie=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(ie||{});const jt={0:"待确认",1:"发放中",2:"有效",3:"无效"},vt={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var we=(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))(we||{});const Wd={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var _e=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s))(_e||{});const Vs=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"}],ms={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a"};var ze=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(ze||{});const Yd={1:"按金额优惠",2:"按比例优惠"};var Ss=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(Ss||{}),De=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(De||{}),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 _s({title:s,value:n,icon:a,trend:l,description:r,onClick:c,highlight:i,className:u}){return e.jsxs(Le,{className:N("transition-colors",c&&"cursor-pointer hover:bg-muted/50",i&&"border-primary/50",u),onClick:c,children:[e.jsxs(Ke,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(us,{className:"text-sm font-medium",children:s}),a]}),e.jsxs(Ue,{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=hs(),{t:a}=F(),{data:l,isLoading:r}=te({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",ie.PENDING.toString()),i.set("status",Z.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(_s,{title:a("dashboard:stats.todayIncome"),value:Rs(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(_s,{title:a("dashboard:stats.monthlyIncome"),value:Rs(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(_s,{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(_s,{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(_s,{title:a("dashboard:stats.monthlyNewUsers"),value:l.currentMonthNewUsers,icon:e.jsx(Xt,{className:"h-4 w-4 text-blue-500"}),trend:{value:l.userGrowth,label:a("dashboard:stats.vsLastMonth"),isPositive:l.userGrowth>0}}),e.jsx(_s,{title:a("dashboard:stats.totalUsers"),value:l.totalUsers,icon:e.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"}),description:a("dashboard:stats.activeUsers",{count:l.activeUsers})}),e.jsx(_s,{title:a("dashboard:stats.monthlyUpload"),value:rs(l.monthTraffic.upload),icon:e.jsx(ea,{className:"h-4 w-4 text-emerald-500"}),description:a("dashboard:stats.todayTraffic",{value:rs(l.todayTraffic.upload)})}),e.jsx(_s,{title:a("dashboard:stats.monthlyDownload"),value:rs(l.monthTraffic.download),icon:e.jsx(Bo,{className:"h-4 w-4 text-blue-500"}),description:a("dashboard:stats.todayTraffic",{value:rs(l.todayTraffic.download)})})]})}const Js=m.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(Rt,{}),e.jsx(Yo,{})]}));Js.displayName=Hn.displayName;const Rt=m.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"})}));Rt.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:Je(s,7),end:s}}},last30days:{getValue:()=>{const s=new Date;return{start:Je(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(W,{value:s,onValueChange:a,children:[e.jsx(U,{className:"w-[120px]",children:e.jsx(Y,{placeholder:r("dashboard:trafficRank.selectTimeRange")})}),e.jsx(B,{position:"popper",className:"z-50",children:Object.entries(la).map(([i])=>e.jsx(A,{value:i,children:c[i]},i))})]}),s==="custom"&&e.jsxs(is,{children:[e.jsx(cs,{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(ht,{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:[Qe(n.from,"yyyy-MM-dd")," -"," ",Qe(n.to,"yyyy-MM-dd")]}):Qe(n.from,"yyyy-MM-dd"):e.jsx("span",{children:r("dashboard:trafficRank.selectDateRange")})})]})}),e.jsx(ts,{className:"w-auto p-0",align:"end",children:e.jsx(qs,{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 Us=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Jd({className:s}){const{t:n}=F(),[a,l]=m.useState("today"),[r,c]=m.useState({from:Je(new Date,7),to:new Date}),[i,u]=m.useState("today"),[x,o]=m.useState({from:Je(new Date,7),to:new Date}),d=m.useMemo(()=>a==="custom"?{start:r.from,end:r.to}:la[a].getValue(),[a,r]),p=m.useMemo(()=>i==="custom"?{start:x.from,end:x.to}:la[i].getValue(),[i,x]),{data:T}=te({queryKey:["nodeTrafficRank",d.start,d.end],queryFn:()=>Wa({type:"node",start_time:be.round(d.start.getTime()/1e3),end_time:be.round(d.end.getTime()/1e3)}),refetchInterval:3e4}),{data:R}=te({queryKey:["userTrafficRank",p.start,p.end],queryFn:()=>Wa({type:"user",start_time:be.round(p.start.getTime()/1e3),end_time:be.round(p.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:N("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(Le,{children:[e.jsx(Ke,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(us,{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(Ue,{className:"flex-1",children:T?.data?e.jsxs(Js,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:T.data.map(f=>e.jsx(me,{delayDuration:200,children:e.jsxs(ce,{children:[e.jsx(de,{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/T.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Us(f.value)})]})]})})}),e.jsx(re,{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:Us(f.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:Us(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(Rt,{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(Le,{children:[e.jsx(Ke,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(us,{className:"flex items-center text-base font-medium",children:[e.jsx(Xt,{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:u,onCustomRangeChange:o}),e.jsx($a,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Ue,{className:"flex-1",children:R?.data?e.jsxs(Js,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:R.data.map(f=>e.jsx(me,{children:e.jsxs(ce,{children:[e.jsx(de,{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/R.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Us(f.value)})]})]})})}),e.jsx(re,{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:Us(f.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:Us(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(Rt,{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=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 H({className:s,variant:n,...a}){return e.jsx("div",{className:N(Zd({variant:n}),s),...a})}const ne=window?.settings?.secure_path,Ir=5*60*1e3,oa=new Map,Xd=s=>{const n=oa.get(s);return n?Date.now()-n.timestamp>Ir?(oa.delete(s),null):n.data:null},em=(s,n)=>{oa.set(s,{data:n,timestamp:Date.now()})},sm=async(s,n=Ir)=>{const a=Xd(s);if(a)return a;const l=await I.get(s);return em(s,l),l},tm={getList:s=>I.post(`${ne}/user/fetch`,s),update:s=>I.post(`${ne}/user/update`,s),resetSecret:s=>I.post(`${ne}/user/resetSecret`,{id:s}),generate:s=>I.post(`${ne}/user/generate`,s),getStats:s=>I.post(`${ne}/stat/getStatUser`,s),destroy:s=>I.post(`${ne}/user/destroy`,{id:s})},Ja={getList:()=>sm(`${ne}/notice/fetch`),save:s=>I.post(`${ne}/notice/save`,s),drop:s=>I.post(`${ne}/notice/drop`,{id:s}),updateStatus:s=>I.post(`${ne}/notice/show`,{id:s}),sort:s=>I.post(`${ne}/notice/sort`,{ids:s})},Gt={getList:s=>I.post(`${ne}/ticket/fetch`,s),getInfo:s=>I.get(`${ne}/ticket/fetch?id=${s}`),reply:s=>I.post(`${ne}/ticket/reply`,s),close:s=>I.post(`${ne}/ticket/close`,{id:s})},Za={getSystemStatus:()=>I.get(`${ne}/system/getSystemStatus`),getQueueStats:()=>I.get(`${ne}/system/getQueueStats`),getQueueWorkload:()=>I.get(`${ne}/system/getQueueWorkload`),getQueueMasters:()=>I.get(`${ne}/system/getQueueMasters`),getSystemLog:s=>I.get(`${ne}/system/getSystemLog`,{params:s})},Is={getPluginList:()=>I.get(`${ne}/plugin/getPlugins`),installPlugin:s=>I.post(`${ne}/plugin/install`,{code:s}),uninstallPlugin:s=>I.post(`${ne}/plugin/uninstall`,{code:s}),enablePlugin:s=>I.post(`${ne}/plugin/enable`,{code:s}),disablePlugin:s=>I.post(`${ne}/plugin/disable`,{code:s}),getPluginConfig:s=>I.get(`${ne}/plugin/config`,{params:{code:s}}),updatePluginConfig:(s,n)=>I.post(`${ne}/plugin/config`,{code:s,config:n})},St=m.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)}%)`}})}));St.displayName=Un.displayName;function am(){const{t:s}=F(),[n,a]=m.useState(null),[l,r]=m.useState(null),[c,i]=m.useState(!0),[u,x]=m.useState(!1),o=async()=>{try{x(!0);const[T,R]=await Promise.all([Za.getSystemStatus(),Za.getQueueStats()]);a(T.data),r(R.data)}catch(T){console.error("Error fetching system data:",T)}finally{i(!1),x(!1)}};m.useEffect(()=>{o();const T=setInterval(o,3e4);return()=>clearInterval(T)},[]);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=T=>T?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(Le,{children:[e.jsxs(Ke,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(us,{className:"flex items-center gap-2",children:[e.jsx(si,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Ys,{children:s("dashboard:queue.status.description")})]}),e.jsx(G,{variant:"outline",size:"icon",onClick:d,disabled:u,children:e.jsx(ti,{className:N("h-4 w-4",u&&"animate-spin")})})]}),e.jsx(Ue,{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(H,{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(me,{children:e.jsxs(ce,{children:[e.jsx(de,{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(St,{value:(l?.recentJobs||0)/(l?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(re,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:l?.periods?.recentJobs||0})})})]})}),e.jsx(me,{children:e.jsxs(ce,{children:[e.jsx(de,{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(St,{value:(l?.jobsPerMinute||0)/(l?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(re,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:l?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(Le,{children:[e.jsxs(Ke,{children:[e.jsxs(us,{className:"flex items-center gap-2",children:[e.jsx(ai,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Ys,{children:s("dashboard:queue.details.description")})]}),e.jsx(Ue,{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(St,{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(Ce,{children:[e.jsxs(Se,{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(Oe,{}),e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsx(Pe,{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"})),Ne=m.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}));Ne.displayName=Wn.displayName;function lm({className:s,items:n,...a}){const{pathname:l}=ca(),r=hs(),[c,i]=m.useState(l??"/settings"),u=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(W,{value:c,onValueChange:u,children:[e.jsx(U,{className:"h-12 sm:w-48",children:e.jsx(Y,{placeholder:"Theme"})}),e.jsx(B,{children:n.map(o=>e.jsx(A,{value:o.href,children:e.jsxs("div",{className:"flex gap-x-4 px-2 py-1",children:[e.jsx("span",{className:"scale-125",children:o.icon}),e.jsx("span",{className:"text-md",children: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(Os,{to:o.href,className:N(Zs({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(Ce,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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(Ne,{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"})),K=m.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")})}));K.displayName=Yn.displayName;const vs=m.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}));vs.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]=m.useState(!1),l=m.useRef(null),{data:r}=te({queryKey:["settings","site"],queryFn:()=>gs("site")}),{data:c}=te({queryKey:["plans"],queryFn:()=>$s()}),i=ue({resolver:he(dm),defaultValues:{},mode:"onBlur"}),{mutateAsync:u}=ls({mutationFn:js,onSuccess:d=>{d.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(r?.data?.site){const d=r?.data?.site;Object.entries(d).forEach(([p,T])=>{i.setValue(p,T)}),l.current=d}},[r]);const x=m.useCallback(be.debounce(async d=>{if(!be.isEqual(d,l.current)){a(!0);try{const p=Object.entries(d).reduce((T,[R,f])=>(T[R]=f===null?"":f,T),{});await u(p),l.current=d}finally{a(!1)}}},1e3),[u]),o=m.useCallback(d=>{x(d)},[x]);return m.useEffect(()=>{const d=i.watch(p=>{o(p)});return()=>d.unsubscribe()},[i.watch,o]),e.jsx(fe,{...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(K,{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(vs,{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(K,{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(W,{value:d.value?.toString(),onValueChange:p=>{d.onChange(Number(p)),o(i.getValues())},children:[e.jsx(U,{children:e.jsx(Y,{placeholder:s("site.form.tryOut.placeholder")})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:s("site.form.tryOut.placeholder")}),c?.data?.map(p=>e.jsx(A,{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(Ne,{}),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]=m.useState(!1),l=m.useRef(null),r=ue({resolver:he(hm),defaultValues:fm,mode:"onBlur"}),{data:c}=te({queryKey:["settings","safe"],queryFn:()=>gs("safe")}),{mutateAsync:i}=ls({mutationFn:js,onSuccess:o=>{o.data&&$.success(s("common.autoSaved"))}});m.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 u=m.useCallback(be.debounce(async o=>{if(!be.isEqual(o,l.current)){a(!0);try{await i(o),l.current=o}finally{a(!1)}}},1e3),[i]),x=m.useCallback(o=>{u(o)},[u]);return m.useEffect(()=>{const o=r.watch(d=>{x(d)});return()=>o.unsubscribe()},[r.watch,x]),e.jsx(fe,{...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(K,{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(K,{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(K,{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(K,{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(vs,{placeholder:s("safe.form.emailWhitelist.suffixes.placeholder"),...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("safe.form.emailWhitelist.suffixes.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:r.control,name:"recaptcha_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("safe.form.recaptcha.enable.label")}),e.jsx(M,{children:s("safe.form.recaptcha.enable.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),r.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(y,{control:r.control,name:"recaptcha_key",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("safe.form.recaptcha.key.label")}),e.jsx(w,{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(y,{control:r.control,name:"recaptcha_site_key",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("safe.form.recaptcha.siteKey.label")}),e.jsx(w,{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(y,{control:r.control,name:"register_limit_by_ip_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(M,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(w,{children:e.jsx(K,{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(y,{control:r.control,name:"register_limit_count",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("safe.form.registerLimit.count.label")}),e.jsx(w,{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(y,{control:r.control,name:"register_limit_expire",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("safe.form.registerLimit.expire.label")}),e.jsx(w,{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(y,{control:r.control,name:"password_limit_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("safe.form.passwordLimit.enable.label")}),e.jsx(M,{children:s("safe.form.passwordLimit.enable.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),r.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(y,{control:r.control,name:"password_limit_count",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("safe.form.passwordLimit.count.label")}),e.jsx(w,{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(y,{control:r.control,name:"password_limit_expire",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("safe.form.passwordLimit.expire.label")}),e.jsx(w,{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 pm(){const{t:s}=I("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(ye,{}),e.jsx(fm,{})]})}const gm=Object.freeze(Object.defineProperty({__proto__:null,default:pm},Symbol.toStringTag,{value:"Module"})),jm=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")}),vm={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 bm(){const{t:s}=I("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=de({resolver:ue(jm),defaultValues:vm,mode:"onBlur"}),{data:i}=se({queryKey:["settings","subscribe"],queryFn:()=>hs("subscribe")}),{mutateAsync:c}=as({mutationFn:fs,onSuccess:o=>{o.data&&$.success(s("common.autoSaved"))}});u.useEffect(()=>{if(i?.data?.subscribe){const o=i?.data?.subscribe;Object.entries(o).forEach(([d,p])=>{r.setValue(d,p)}),l.current=o}},[i]);const m=u.useCallback(ve.debounce(async o=>{if(!ve.isEqual(o,l.current)){a(!0);try{await c(o),l.current=o}finally{a(!1)}}},1e3),[c]),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(xe,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{control:r.control,name:"plan_change_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("subscribe.plan_change_enable.title")}),e.jsx(M,{children:s("subscribe.plan_change_enable.description")}),e.jsx(w,{children:e.jsx(K,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(E,{})]})}),e.jsx(y,{control:r.control,name:"reset_traffic_method",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("subscribe.reset_traffic_method.title")}),e.jsxs(G,{onValueChange:o.onChange,value:o.value?.toString()||"0",children:[e.jsx(w,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择重置方式"})})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:s("subscribe.reset_traffic_method.options.monthly_first")}),e.jsx(L,{value:"1",children:s("subscribe.reset_traffic_method.options.monthly_reset")}),e.jsx(L,{value:"2",children:s("subscribe.reset_traffic_method.options.no_reset")}),e.jsx(L,{value:"3",children:s("subscribe.reset_traffic_method.options.yearly_first")}),e.jsx(L,{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(y,{control:r.control,name:"surplus_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("subscribe.surplus_enable.title")}),e.jsx(M,{children:s("subscribe.surplus_enable.description")}),e.jsx(w,{children:e.jsx(K,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})}),e.jsx(E,{})]})}),e.jsx(y,{control:r.control,name:"new_order_event_id",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("subscribe.new_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(w,{children:e.jsxs(G,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:s("subscribe.new_order_event.options.no_action")}),e.jsx(L,{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(y,{control:r.control,name:"renew_order_event_id",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("subscribe.renew_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(w,{children:e.jsxs(G,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:s("subscribe.renew_order_event.options.no_action")}),e.jsx(L,{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(y,{control:r.control,name:"change_order_event_id",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("subscribe.change_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(w,{children:e.jsxs(G,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:s("subscribe.change_order_event.options.no_action")}),e.jsx(L,{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(y,{control:r.control,name:"subscribe_path",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("subscribe.subscribe_path.title")}),e.jsx(w,{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(y,{control:r.control,name:"show_info_to_server_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("subscribe.show_info_to_server.title")}),e.jsx(M,{children:s("subscribe.show_info_to_server.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value||!1,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(y,{control:r.control,name:"show_protocol_to_server_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("subscribe.show_protocol_to_server.title")}),e.jsx(M,{children:s("subscribe.show_protocol_to_server.description")})]}),e.jsx(w,{children:e.jsx(K,{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 ym(){const{t:s}=I("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(ye,{}),e.jsx(bm,{})]})}const Nm=Object.freeze(Object.defineProperty({__proto__:null,default:ym},Symbol.toStringTag,{value:"Module"})),_m=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)}),wm={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 Cm(){const{t:s}=I("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=de({resolver:ue(_m),defaultValues:wm,mode:"onBlur"}),{data:i}=se({queryKey:["settings","invite"],queryFn:()=>hs("invite")}),{mutateAsync:c}=as({mutationFn:fs,onSuccess:o=>{o.data&&$.success(s("common.autoSaved"))}});u.useEffect(()=>{if(i?.data?.invite){const o=i?.data?.invite;Object.entries(o).forEach(([d,p])=>{typeof p=="number"?r.setValue(d,String(p)):r.setValue(d,p)}),l.current=o}},[i]);const m=u.useCallback(ve.debounce(async o=>{if(!ve.isEqual(o,l.current)){a(!0);try{await c(o),l.current=o}finally{a(!1)}}},1e3),[c]),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(xe,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{control:r.control,name:"invite_force",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("invite.invite_force.title")}),e.jsx(M,{children:s("invite.invite_force.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(y,{control:r.control,name:"invite_commission",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("invite.invite_commission.title")}),e.jsx(w,{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(y,{control:r.control,name:"invite_gen_limit",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("invite.invite_gen_limit.title")}),e.jsx(w,{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(y,{control:r.control,name:"invite_never_expire",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("invite.invite_never_expire.title")}),e.jsx(M,{children:s("invite.invite_never_expire.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(y,{control:r.control,name:"commission_first_time_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("invite.commission_first_time.title")}),e.jsx(M,{children:s("invite.commission_first_time.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(y,{control:r.control,name:"commission_auto_check_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("invite.commission_auto_check.title")}),e.jsx(M,{children:s("invite.commission_auto_check.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(y,{control:r.control,name:"commission_withdraw_limit",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("invite.commission_withdraw_limit.title")}),e.jsx(w,{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(y,{control:r.control,name:"commission_withdraw_method",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("invite.commission_withdraw_method.title")}),e.jsx(w,{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(y,{control:r.control,name:"withdraw_close_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("invite.withdraw_close.title")}),e.jsx(M,{children:s("invite.withdraw_close.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),e.jsx(y,{control:r.control,name:"commission_distribution_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("invite.commission_distribution.title")}),e.jsx(M,{children:s("invite.commission_distribution.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:o.value,onCheckedChange:d=>{o.onChange(d),x(r.getValues())}})})]})}),r.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(y,{control:r.control,name:"commission_distribution_l1",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:s("invite.commission_distribution.l1")}),e.jsx(w,{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(y,{control:r.control,name:"commission_distribution_l2",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:s("invite.commission_distribution.l2")}),e.jsx(w,{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(y,{control:r.control,name:"commission_distribution_l3",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:s("invite.commission_distribution.l3")}),e.jsx(w,{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 Sm(){const{t:s}=I("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(ye,{}),e.jsx(Cm,{})]})}const km=Object.freeze(Object.defineProperty({__proto__:null,default:Sm},Symbol.toStringTag,{value:"Module"})),Tm=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()}),Pm={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function Dm(){const{data:s}=se({queryKey:["settings","frontend"],queryFn:()=>hs("frontend")}),n=de({resolver:ue(Tm),defaultValues:Pm,mode:"onChange"});u.useEffect(()=>{if(s?.data?.frontend){const l=s?.data?.frontend;Object.entries(l).forEach(([r,i])=>{n.setValue(r,i)})}},[s]);function a(l){fs(l).then(({data:r})=>{r&&$.success("更新成功")})}return e.jsx(xe,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(a),className:"space-y-8",children:[e.jsx(y,{control:n.control,name:"frontend_theme_sidebar",render:({field:l})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:"边栏风格"}),e.jsx(M,{children:"边栏风格"})]}),e.jsx(w,{children:e.jsx(K,{checked:l.value,onCheckedChange:l.onChange})})]})}),e.jsx(y,{control:n.control,name:"frontend_theme_header",render:({field:l})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:"头部风格"}),e.jsx(M,{children:"边栏风格"})]}),e.jsx(w,{children:e.jsx(K,{checked:l.value,onCheckedChange:l.onChange})})]})}),e.jsx(y,{control:n.control,name:"frontend_theme_color",render:({field:l})=>e.jsxs(b,{children:[e.jsx(N,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(w,{children:e.jsxs("select",{className:_(Bs({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(da,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(M,{children:"主题色"}),e.jsx(E,{})]})}),e.jsx(y,{control:n.control,name:"frontend_background_url",render:({field:l})=>e.jsxs(b,{children:[e.jsx(N,{children:"背景"}),e.jsx(w,{children:e.jsx(D,{placeholder:"请输入图片地址",...l})}),e.jsx(M,{children:"将会在后台登录页面进行展示。"}),e.jsx(E,{})]})}),e.jsx(V,{type:"submit",children:"保存设置"})]})})}function Em(){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(ye,{}),e.jsx(Dm,{})]})}const Rm=Object.freeze(Object.defineProperty({__proto__:null,default:Em},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()}),Im={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function Fm(){const{t:s}=I("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=de({resolver:ue(Vm),defaultValues:Im,mode:"onBlur"}),{data:i}=se({queryKey:["settings","server"],queryFn:()=>hs("server")}),{mutateAsync:c}=as({mutationFn:fs,onSuccess:d=>{d.data&&$.success(s("common.AutoSaved"))}});u.useEffect(()=>{if(i?.data.server){const d=i.data.server;Object.entries(d).forEach(([p,P])=>{r.setValue(p,P)}),l.current=d}},[i]);const m=u.useCallback(ve.debounce(async d=>{if(!ve.isEqual(d,l.current)){a(!0);try{await c(d),l.current=d}finally{a(!1)}}},1e3),[c]),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 P="";for(let R=0;Re.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("server.server_token.title")}),e.jsx(w,{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(ce,{children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(J,{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(ii,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(te,{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(y,{control:r.control,name:"server_pull_interval",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("server.server_pull_interval.title")}),e.jsx(w,{children:e.jsx(D,{type:"number",placeholder:s("server.server_pull_interval.placeholder"),...d,value:d.value||"",onChange:p=>{const P=p.target.value?Number(p.target.value):null;d.onChange(P)}})}),e.jsx(M,{children:s("server.server_pull_interval.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:r.control,name:"server_push_interval",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("server.server_push_interval.title")}),e.jsx(w,{children:e.jsx(D,{type:"number",placeholder:s("server.server_push_interval.placeholder"),...d,value:d.value||"",onChange:p=>{const P=p.target.value?Number(p.target.value):null;d.onChange(P)}})}),e.jsx(M,{children:s("server.server_push_interval.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:r.control,name:"device_limit_mode",render:({field:d})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("server.device_limit_mode.title")}),e.jsxs(G,{onValueChange:d.onChange,value:d.value?.toString()||"0",children:[e.jsx(w,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:s("server.device_limit_mode.placeholder")})})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:s("server.device_limit_mode.strict")}),e.jsx(L,{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 Mm(){const{t:s}=I("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(ye,{}),e.jsx(Fm,{})]})}const Om=Object.freeze(Object.defineProperty({__proto__:null,default:Mm},Symbol.toStringTag,{value:"Module"}));function zm({open:s,onOpenChange:n,result:a}){const l=!a.error;return e.jsx(ge,{open:s,onOpenChange:n,children:e.jsxs(fe,{className:"sm:max-w-[425px]",children:[e.jsxs(be,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l?e.jsx(Kn,{className:"h-5 w-5 text-green-500"}):e.jsx(Un,{className:"h-5 w-5 text-destructive"}),e.jsx(je,{children:l?"邮件发送成功":"邮件发送失败"})]}),e.jsx(Pe,{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(ot,{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 Lm=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 Am(){const{t:s}=I("settings"),[n,a]=u.useState(null),[l,r]=u.useState(!1),i=u.useRef(null),[c,m]=u.useState(!1),x=de({resolver:ue(Lm),defaultValues:{},mode:"onBlur"}),{data:o}=se({queryKey:["settings","email"],queryFn:()=>hs("email")}),{data:d}=se({queryKey:["emailTemplate"],queryFn:()=>Md()}),{mutateAsync:p}=as({mutationFn:fs,onSuccess:S=>{S.data&&$.success(s("common.autoSaved"))}}),{mutate:P,isPending:R}=as({mutationFn:Od,onMutate:()=>{a(null),r(!1)},onSuccess:S=>{a(S.data),r(!0),S.data.error?$.error(s("email.test.error")):$.success(s("email.test.success"))}});u.useEffect(()=>{if(o?.data.email){const S=o.data.email;Object.entries(S).forEach(([j,C])=>{x.setValue(j,C)}),i.current=S}},[o]);const f=u.useCallback(ve.debounce(async S=>{if(!ve.isEqual(S,i.current)){m(!0);try{await p(S),i.current=S}finally{m(!1)}}},1e3),[p]),g=u.useCallback(S=>{f(S)},[f]);return u.useEffect(()=>{const S=x.watch(j=>{g(j)});return()=>S.unsubscribe()},[x.watch,g]),e.jsxs(e.Fragment,{children:[e.jsx(xe,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{control:x.control,name:"email_host",render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("email.email_host.title")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("common.placeholder"),...S,value:S.value||""})}),e.jsx(M,{children:s("email.email_host.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"email_port",render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("email.email_port.title")}),e.jsx(w,{children:e.jsx(D,{type:"number",placeholder:s("common.placeholder"),...S,value:S.value||"",onChange:j=>{const C=j.target.value?Number(j.target.value):null;S.onChange(C)}})}),e.jsx(M,{children:s("email.email_port.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"email_encryption",render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("email.email_encryption.title")}),e.jsxs(G,{onValueChange:S.onChange,value:S.value||"none",children:[e.jsx(w,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择加密方式"})})}),e.jsxs(B,{children:[e.jsx(L,{value:"none",children:s("email.email_encryption.none")}),e.jsx(L,{value:"ssl",children:s("email.email_encryption.ssl")}),e.jsx(L,{value:"tls",children:s("email.email_encryption.tls")})]})]}),e.jsx(M,{children:s("email.email_encryption.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"email_username",render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("email.email_username.title")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("common.placeholder"),...S,value:S.value||""})}),e.jsx(M,{children:s("email.email_username.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"email_password",render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("email.email_password.title")}),e.jsx(w,{children:e.jsx(D,{type:"password",placeholder:s("common.placeholder"),...S,value:S.value||""})}),e.jsx(M,{children:s("email.email_password.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"email_from_address",render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("email.email_from.title")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("common.placeholder"),...S,value:S.value||""})}),e.jsx(M,{children:s("email.email_from.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"email_template",render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("email.email_template.title")}),e.jsxs(G,{onValueChange:j=>{S.onChange(j),g(x.getValues())},value:S.value||void 0,children:[e.jsx(w,{children:e.jsx(U,{className:"w-[200px]",children:e.jsx(Y,{placeholder:s("email.email_template.placeholder")})})}),e.jsx(B,{children:d?.data?.map(j=>e.jsx(L,{value:j,children:j},j))})]}),e.jsx(M,{children:s("email.email_template.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"remind_mail_enable",render:({field:S})=>e.jsxs(b,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(N,{className:"text-base",children:s("email.remind_mail.title")}),e.jsx(M,{children:s("email.remind_mail.description")})]}),e.jsx(w,{children:e.jsx(K,{checked:S.value||!1,onCheckedChange:j=>{S.onChange(j),g(x.getValues())}})})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(V,{onClick:()=>P(),loading:R,disabled:R,children:s(R?"test.sending":"test.title")})})]})}),c&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("saving")}),n&&e.jsx(zm,{open:l,onOpenChange:r,result:n})]})}function $m(){const{t:s}=I("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(ye,{}),e.jsx(Am,{})]})}const qm=Object.freeze(Object.defineProperty({__proto__:null,default:$m},Symbol.toStringTag,{value:"Module"})),Hm=h.object({telegram_bot_enable:h.boolean().nullable(),telegram_bot_token:h.string().nullable(),telegram_discuss_link:h.string().nullable()}),Km={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function Um(){const{t:s}=I("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=de({resolver:ue(Hm),defaultValues:Km,mode:"onBlur"}),{data:i}=se({queryKey:["settings","telegram"],queryFn:()=>hs("telegram")}),{mutateAsync:c}=as({mutationFn:fs,onSuccess:p=>{p.data&&$.success(s("common.autoSaved"))}}),{mutate:m,isPending:x}=as({mutationFn:zd,onSuccess:p=>{p.data&&$.success(s("telegram.webhook.success"))}});u.useEffect(()=>{if(i?.data.telegram){const p=i.data.telegram;Object.entries(p).forEach(([P,R])=>{r.setValue(P,R)}),l.current=p}},[i]);const o=u.useCallback(ve.debounce(async p=>{if(!ve.isEqual(p,l.current)){a(!0);try{await c(p),l.current=p}finally{a(!1)}}},1e3),[c]),d=u.useCallback(p=>{o(p)},[o]);return u.useEffect(()=>{const p=r.watch(P=>{d(P)});return()=>p.unsubscribe()},[r.watch,d]),e.jsx(xe,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{control:r.control,name:"telegram_bot_token",render:({field:p})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("telegram.bot_token.title")}),e.jsx(w,{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(b,{children:[e.jsx(N,{className:"text-base",children:s("telegram.webhook.title")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(V,{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(y,{control:r.control,name:"telegram_bot_enable",render:({field:p})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("telegram.bot_enable.title")}),e.jsx(M,{children:s("telegram.bot_enable.description")}),e.jsx(w,{children:e.jsx(K,{checked:p.value||!1,onCheckedChange:P=>{p.onChange(P),d(r.getValues())}})}),e.jsx(E,{})]})}),e.jsx(y,{control:r.control,name:"telegram_discuss_link",render:({field:p})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("telegram.discuss_link.title")}),e.jsx(w,{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 Bm(){const{t:s}=I("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(ye,{}),e.jsx(Um,{})]})}const Gm=Object.freeze(Object.defineProperty({__proto__:null,default:Bm},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()}),Wm={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function Jm(){const{t:s}=I("settings"),[n,a]=u.useState(!1),l=u.useRef(null),r=de({resolver:ue(Ym),defaultValues:Wm,mode:"onBlur"}),{data:i}=se({queryKey:["settings","app"],queryFn:()=>hs("app")}),{mutateAsync:c}=as({mutationFn:fs,onSuccess:o=>{o.data&&$.success(s("app.save_success"))}});u.useEffect(()=>{if(i?.data.app){const o=i.data.app;Object.entries(o).forEach(([d,p])=>{r.setValue(d,p)}),l.current=o}},[i]);const m=u.useCallback(ve.debounce(async o=>{if(!ve.isEqual(o,l.current)){a(!0);try{await c(o),l.current=o}finally{a(!1)}}},1e3),[c]),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(xe,{...r,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{control:r.control,name:"windows_version",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("app.windows.version.title")}),e.jsx(w,{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(y,{control:r.control,name:"windows_download_url",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("app.windows.download.title")}),e.jsx(w,{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(y,{control:r.control,name:"macos_version",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("app.macos.version.title")}),e.jsx(w,{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(y,{control:r.control,name:"macos_download_url",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("app.macos.download.title")}),e.jsx(w,{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(y,{control:r.control,name:"android_version",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("app.android.version.title")}),e.jsx(w,{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(y,{control:r.control,name:"android_download_url",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{className:"text-base",children:s("app.android.download.title")}),e.jsx(w,{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 Qm(){const{t:s}=I("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(ye,{}),e.jsx(Jm,{})]})}const Zm=Object.freeze(Object.defineProperty({__proto__:null,default:Qm},Symbol.toStringTag,{value:"Module"})),pa=u.forwardRef(({className:s,...n},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:_("w-full caption-bottom text-sm",s),...n})}));pa.displayName="Table";const ga=u.forwardRef(({className:s,...n},a)=>e.jsx("thead",{ref:a,className:_("[&_tr]:border-b",s),...n}));ga.displayName="TableHeader";const ja=u.forwardRef(({className:s,...n},a)=>e.jsx("tbody",{ref:a,className:_("[&_tr:last-child]:border-0",s),...n}));ja.displayName="TableBody";const Xm=u.forwardRef(({className:s,...n},a)=>e.jsx("tfoot",{ref:a,className:_("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...n}));Xm.displayName="TableFooter";const ys=u.forwardRef(({className:s,...n},a)=>e.jsx("tr",{ref:a,className:_("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...n}));ys.displayName="TableRow";const va=u.forwardRef(({className:s,...n},a)=>e.jsx("th",{ref:a,className:_("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}));va.displayName="TableHead";const Hs=u.forwardRef(({className:s,...n},a)=>e.jsx("td",{ref:a,className:_("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...n}));Hs.displayName="TableCell";const eu=u.forwardRef(({className:s,...n},a)=>e.jsx("caption",{ref:a,className:_("mt-4 text-sm text-muted-foreground",s),...n}));eu.displayName="TableCaption";function su({table:s}){const[n,a]=u.useState(""),{t:l}=I("common");u.useEffect(()=>{a((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const r=i=>{const c=parseInt(i);!isNaN(c)&&c>=1&&c<=s.getPageCount()?s.setPageIndex(c-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(G,{value:`${s.getState().pagination.pageSize}`,onValueChange:i=>{s.setPageSize(Number(i))},children:[e.jsx(U,{className:"h-8 w-[70px]",children:e.jsx(Y,{placeholder:s.getState().pagination.pageSize})}),e.jsx(B,{side:"top",children:[10,20,30,40,50,100,500].map(i=>e.jsx(L,{value:`${i}`,children:i},i))})]})]}),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:i=>a(i.target.value),onBlur:i=>r(i.target.value),onKeyDown:i=>{i.key==="Enter"&&r(i.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(V,{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(ci,{className:"h-4 w-4"})]}),e.jsxs(V,{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(Ln,{className:"h-4 w-4"})]}),e.jsxs(V,{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(ia,{className:"h-4 w-4"})]}),e.jsxs(V,{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(di,{className:"h-4 w-4"})]})]})]})]})}function es({table:s,toolbar:n,draggable:a=!1,onDragStart:l,onDragEnd:r,onDragOver:i,onDragLeave:c,onDrop:m,showPagination:x=!0,isLoading:o=!1}){const{t:d}=I("common"),p=u.useRef(null),P=s.getAllColumns().filter(S=>S.getIsPinned()==="left"),R=s.getAllColumns().filter(S=>S.getIsPinned()==="right"),f=S=>P.slice(0,S).reduce((j,C)=>j+(C.getSize()??0),0),g=S=>R.slice(S+1).reduce((j,C)=>j+(C.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(pa,{children:[e.jsx(ga,{children:s.getHeaderGroups().map(S=>e.jsx(ys,{className:"hover:bg-transparent",children:S.headers.map((j,C)=>{const k=j.column.getIsPinned()==="left",v=j.column.getIsPinned()==="right",T=k?f(P.indexOf(j.column)):void 0,z=v?g(R.indexOf(j.column)):void 0;return e.jsx(va,{colSpan:j.colSpan,style:{width:j.getSize(),...k&&{left:T},...v&&{right:z}},className:_("h-11 bg-card px-4 text-muted-foreground",(k||v)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",k&&"before:right-0",v&&"before:left-0"]),children:j.isPlaceholder?null:_t(j.column.columnDef.header,j.getContext())},j.id)})},S.id))}),e.jsx(ja,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((S,j)=>e.jsx(ys,{"data-state":S.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:a,onDragStart:C=>l?.(C,j),onDragEnd:r,onDragOver:i,onDragLeave:c,onDrop:C=>m?.(C,j),children:S.getVisibleCells().map((C,k)=>{const v=C.column.getIsPinned()==="left",T=C.column.getIsPinned()==="right",z=v?f(P.indexOf(C.column)):void 0,Q=T?g(R.indexOf(C.column)):void 0;return e.jsx(Hs,{style:{width:C.column.getSize(),...v&&{left:z},...T&&{right:Q}},className:_("bg-card",(v||T)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",v&&"before:right-0",T&&"before:left-0"]),children:_t(C.column.columnDef.cell,C.getContext())},C.id)})},S.id)):e.jsx(ys,{children:e.jsx(Hs,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:d("table.noData")})})})]})})}),x&&e.jsx(su,{table:s})]})}const tu=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())}),Za={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function Ir({refetch:s,dialogTrigger:n,type:a="add",defaultFormValues:l=Za}){const{t:r}=I("payment"),[i,c]=u.useState(!1),[m,x]=u.useState(!1),[o,d]=u.useState([]),[p,P]=u.useState([]),R=tu(r),f=de({resolver:ue(R),defaultValues:l,mode:"onChange"}),g=f.watch("payment");u.useEffect(()=>{i&&(async()=>{const{data:C}=await sd();d(C)})()},[i]),u.useEffect(()=>{if(!g||!i)return;(async()=>{const C={payment:g,...a==="edit"&&{id:Number(f.getValues("id"))}};td(C).then(({data:k})=>{P(k);const v=k.reduce((T,z)=>(z.field_name&&(T[z.field_name]=z.value??""),T),{});f.setValue("config",v)})})()},[g,i,f,a]);const S=async j=>{x(!0);try{(await ad(j)).data&&($.success(r("form.messages.success")),f.reset(Za),s(),c(!1))}finally{x(!1)}};return e.jsxs(ge,{open:i,onOpenChange:c,children:[e.jsx(ze,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Se,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add.button")})]})}),e.jsxs(fe,{className:"sm:max-w-[425px]",children:[e.jsx(be,{children:e.jsx(je,{children:r(a==="add"?"form.add.title":"form.edit.title")})}),e.jsx(xe,{...f,children:e.jsxs("form",{onSubmit:f.handleSubmit(S),className:"space-y-4",children:[e.jsx(y,{control:f.control,name:"name",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.name.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:r("form.fields.name.placeholder"),...j})}),e.jsx(M,{children:r("form.fields.name.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:f.control,name:"icon",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.icon.label")}),e.jsx(w,{children:e.jsx(D,{...j,value:j.value||"",placeholder:r("form.fields.icon.placeholder")})}),e.jsx(M,{children:r("form.fields.icon.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:f.control,name:"notify_domain",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.notify_domain.label")}),e.jsx(w,{children:e.jsx(D,{...j,value:j.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(y,{control:f.control,name:"handling_fee_percent",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.handling_fee_percent.label")}),e.jsx(w,{children:e.jsx(D,{type:"number",...j,value:j.value||"",placeholder:r("form.fields.handling_fee_percent.placeholder")})}),e.jsx(E,{})]})}),e.jsx(y,{control:f.control,name:"handling_fee_fixed",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.handling_fee_fixed.label")}),e.jsx(w,{children:e.jsx(D,{type:"number",...j,value:j.value||"",placeholder:r("form.fields.handling_fee_fixed.placeholder")})}),e.jsx(E,{})]})})]}),e.jsx(y,{control:f.control,name:"payment",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.payment.label")}),e.jsxs(G,{onValueChange:j.onChange,defaultValue:j.value,children:[e.jsx(w,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:r("form.fields.payment.placeholder")})})}),e.jsx(B,{children:o.map(C=>e.jsx(L,{value:C,children:C},C))})]}),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(j=>e.jsx(y,{control:f.control,name:`config.${j.field_name}`,render:({field:C})=>e.jsxs(b,{children:[e.jsx(N,{children:j.label}),e.jsx(w,{children:e.jsx(D,{...C,value:C.value||""})}),e.jsx(E,{})]})},j.field_name))}),e.jsxs(Le,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(V,{type:"button",variant:"outline",children:r("form.buttons.cancel")})}),e.jsx(V,{type:"submit",disabled:m,children:r("form.buttons.submit")})]})]})})]})]})}function O({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(V,{variant:"ghost",size:"default",className:_("-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(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx($a,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(te,{children:a})]})}),s.getIsSorted()==="asc"?e.jsx(Qt,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(Zt,{className:"h-4 w-4 text-foreground/70"}):e.jsx(mi,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-foreground/70"})]})})}):e.jsxs("div",{className:_("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(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{children:e.jsx($a,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(te,{children:a})]})})]})}const Fr=ui,Mr=xi,au=hi,Or=u.forwardRef(({className:s,...n},a)=>e.jsx(Yn,{className:_("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}));Or.displayName=Yn.displayName;const ba=u.forwardRef(({className:s,...n},a)=>e.jsxs(au,{children:[e.jsx(Or,{}),e.jsx(Wn,{ref:a,className:_("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})]}));ba.displayName=Wn.displayName;const ya=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col space-y-2 text-center sm:text-left",s),...n});ya.displayName="AlertDialogHeader";const Na=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Na.displayName="AlertDialogFooter";const _a=u.forwardRef(({className:s,...n},a)=>e.jsx(Jn,{ref:a,className:_("text-lg font-semibold",s),...n}));_a.displayName=Jn.displayName;const wa=u.forwardRef(({className:s,...n},a)=>e.jsx(Qn,{ref:a,className:_("text-sm text-muted-foreground",s),...n}));wa.displayName=Qn.displayName;const Ca=u.forwardRef(({className:s,...n},a)=>e.jsx(Zn,{ref:a,className:_(Us(),s),...n}));Ca.displayName=Zn.displayName;const Sa=u.forwardRef(({className:s,...n},a)=>e.jsx(Xn,{ref:a,className:_(Us({variant:"outline"}),"mt-2 sm:mt-0",s),...n}));Sa.displayName=Xn.displayName;function Ue({onConfirm:s,children:n,title:a="确认操作",description:l="确定要执行此操作吗?",cancelText:r="取消",confirmText:i="确认",variant:c="default",className:m}){return e.jsxs(Fr,{children:[e.jsx(Mr,{asChild:!0,children:n}),e.jsxs(ba,{className:_("sm:max-w-[425px]",m),children:[e.jsxs(ya,{children:[e.jsx(_a,{children:a}),e.jsx(wa,{children:l})]}),e.jsxs(Na,{children:[e.jsx(Sa,{asChild:!0,children:e.jsx(V,{variant:"outline",children:r})}),e.jsx(Ca,{asChild:!0,children:e.jsx(V,{variant:c,onClick:s,children:i})})]})]})]})}const zr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"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"})}),nu=({refetch:s,isSortMode:n=!1})=>{const{t:a}=I("payment");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(Vt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(O,{column:l,title:a("table.columns.id")}),cell:({row:l})=>e.jsx(H,{variant:"outline",children:l.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:l})=>e.jsx(O,{column:l,title:a("table.columns.enable")}),cell:({row:l})=>e.jsx(K,{defaultChecked:l.getValue("enable"),onCheckedChange:async()=>{const{data:r}=await rd({id:l.original.id});r||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:l})=>e.jsx(O,{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(O,{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(O,{column:l,title:a("table.columns.notify_url")}),e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{className:"ml-1",children:e.jsx(zr,{className:"h-4 w-4"})}),e.jsx(te,{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(O,{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(Ir,{refetch:s,dialogTrigger:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Is,{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(Ue,{title:a("table.actions.delete.title"),description:a("table.actions.delete.description"),onConfirm:async()=>{const{data:r}=await nd({id:l.original.id});r&&s()},children:e.jsxs(V,{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 ru({table:s,refetch:n,saveOrder:a,isSortMode:l}){const{t:r}=I("payment"),i=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(Ir,{refetch:n}),e.jsx(D,{placeholder:r("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:c=>s.getColumn("name")?.setFilterValue(c.target.value),className:"h-8 w-[250px]"}),i&&e.jsxs(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[r("table.toolbar.reset"),e.jsx(Ae,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(V,{variant:l?"default":"outline",onClick:a,size:"sm",children:r(l?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}function lu(){const[s,n]=u.useState([]),[a,l]=u.useState([]),[r,i]=u.useState(!1),[c,m]=u.useState([]),[x,o]=u.useState({"drag-handle":!1}),[d,p]=u.useState({pageSize:20,pageIndex:0}),{refetch:P}=se({queryKey:["paymentList"],queryFn:async()=>{const{data:j}=await ed();return m(j?.map(C=>({...C,enable:!!C.enable}))||[]),j}});u.useEffect(()=>{o({"drag-handle":r,actions:!r}),p({pageSize:r?99999:10,pageIndex:0})},[r]);const R=(j,C)=>{r&&(j.dataTransfer.setData("text/plain",C.toString()),j.currentTarget.classList.add("opacity-50"))},f=(j,C)=>{if(!r)return;j.preventDefault(),j.currentTarget.classList.remove("bg-muted");const k=parseInt(j.dataTransfer.getData("text/plain"));if(k===C)return;const v=[...c],[T]=v.splice(k,1);v.splice(C,0,T),m(v)},g=async()=>{r?ld({ids:c.map(j=>j.id)}).then(()=>{P(),i(!1),$.success("排序保存成功")}):i(!0)},S=He({data:c,columns:nu({refetch:P,isSortMode:r}),state:{sorting:a,columnFilters:s,columnVisibility:x,pagination:d},onSortingChange:l,onColumnFiltersChange:n,onColumnVisibilityChange:o,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),getSortedRowModel:Ze(),initialState:{columnPinning:{right:["actions"]}},pageCount:r?1:void 0});return e.jsx(es,{table:S,toolbar:j=>e.jsx(ru,{table:j,refetch:P,saveOrder:g,isSortMode:r}),draggable:r,onDragStart:R,onDragEnd:j=>j.currentTarget.classList.remove("opacity-50"),onDragOver:j=>{j.preventDefault(),j.currentTarget.classList.add("bg-muted")},onDragLeave:j=>j.currentTarget.classList.remove("bg-muted"),onDrop:f,showPagination:!r})}function ou(){const{t:s}=I("payment");return e.jsxs(we,{children:[e.jsxs(Ce,{className:"flex items-center justify-between",children:[e.jsx(Ie,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(lu,{})})]})]})}const iu=Object.freeze(Object.defineProperty({__proto__:null,default:ou},Symbol.toStringTag,{value:"Module"}));function cu({pluginName:s,onClose:n,onSuccess:a}){const{t:l}=I("plugin"),[r,i]=u.useState(!0),[c,m]=u.useState(!1),[x,o]=u.useState(null),d=fi({config:pi(gi())}),p=de({resolver:ue(d),defaultValues:{config:{}}});u.useEffect(()=>{(async()=>{try{const{data:g}=await Ds.getPluginConfig(s);o(g),p.reset({config:Object.fromEntries(Object.entries(g).map(([S,j])=>[S,j.value]))})}catch{$.error(l("messages.configLoadError"))}finally{i(!1)}})()},[s]);const P=async f=>{m(!0);try{await Ds.updatePluginConfig(s,f.config),$.success(l("messages.configSaveSuccess")),a()}catch{$.error(l("messages.configSaveError"))}finally{m(!1)}},R=(f,g)=>{switch(g.type){case"string":return e.jsx(y,{control:p.control,name:`config.${f}`,render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{children:g.label||g.description}),e.jsx(w,{children:e.jsx(D,{placeholder:g.placeholder,...S})}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description}),e.jsx(E,{})]})},f);case"number":case"percentage":return e.jsx(y,{control:p.control,name:`config.${f}`,render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{children:g.label||g.description}),e.jsx(w,{children:e.jsxs("div",{className:"relative",children:[e.jsx(D,{type:"number",placeholder:g.placeholder,...S,onChange:j=>{const C=Number(j.target.value);g.type==="percentage"?S.onChange(Math.min(100,Math.max(0,C))):S.onChange(C)},className:g.type==="percentage"?"pr-8":"",min:g.type==="percentage"?0:void 0,max:g.type==="percentage"?100:void 0,step:g.type==="percentage"?1:void 0}),g.type==="percentage"&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(ji,{className:"h-4 w-4 text-muted-foreground"})})]})}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description}),e.jsx(E,{})]})},f);case"select":return e.jsx(y,{control:p.control,name:`config.${f}`,render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{children:g.label||g.description}),e.jsxs(G,{onValueChange:S.onChange,defaultValue:S.value,children:[e.jsx(w,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:g.placeholder})})}),e.jsx(B,{children:g.options?.map(j=>e.jsx(L,{value:j.value,children:j.label},j.value))})]}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description}),e.jsx(E,{})]})},f);case"boolean":return e.jsx(y,{control:p.control,name:`config.${f}`,render:({field:S})=>e.jsxs(b,{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(N,{className:"text-base",children:g.label||g.description}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description})]}),e.jsx(w,{children:e.jsx(K,{checked:S.value,onCheckedChange:S.onChange})})]})},f);case"text":return e.jsx(y,{control:p.control,name:`config.${f}`,render:({field:S})=>e.jsxs(b,{children:[e.jsx(N,{children:g.label||g.description}),e.jsx(w,{children:e.jsx(ps,{placeholder:g.placeholder,...S})}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description}),e.jsx(E,{})]})},f);default:return null}};return r?e.jsxs("div",{className:"space-y-4",children:[e.jsx(le,{className:"h-4 w-[200px]"}),e.jsx(le,{className:"h-10 w-full"}),e.jsx(le,{className:"h-4 w-[200px]"}),e.jsx(le,{className:"h-10 w-full"})]}):e.jsx(xe,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(P),className:"space-y-4",children:[x&&Object.entries(x).map(([f,g])=>R(f,g)),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(V,{type:"button",variant:"outline",onClick:n,disabled:c,children:l("config.cancel")}),e.jsx(V,{type:"submit",loading:c,disabled:c,children:l("config.save")})]})]})})}function du(){const{t:s}=I("plugin"),[n,a]=u.useState(null),[l,r]=u.useState(!1),[i,c]=u.useState(null),[m,x]=u.useState(""),[o,d]=u.useState("all"),{data:p,isLoading:P,refetch:R}=se({queryKey:["pluginList"],queryFn:async()=>{const{data:v}=await Ds.getPluginList();return v}}),f=p?["all",...new Set(p.map(v=>v.category||"other"))]:["all"],g=p?.filter(v=>{const T=v.name.toLowerCase().includes(m.toLowerCase())||v.description.toLowerCase().includes(m.toLowerCase())||v.code.toLowerCase().includes(m.toLowerCase()),z=o==="all"||v.category===o;return T&&z}),S=async v=>{a(v),Ds.installPlugin(v).then(()=>{$.success(s("messages.installSuccess")),R()}).catch(T=>{$.error(T.message||s("messages.installError"))}).finally(()=>{a(null)})},j=async v=>{a(v),Ds.uninstallPlugin(v).then(()=>{$.success(s("messages.uninstallSuccess")),R()}).catch(T=>{$.error(T.message||s("messages.uninstallError"))}).finally(()=>{a(null)})},C=async(v,T)=>{a(v),(T?Ds.disablePlugin:Ds.enablePlugin)(v).then(()=>{$.success(s(T?"messages.disableSuccess":"messages.enableSuccess")),R()}).catch(Q=>{$.error(Q.message||s(T?"messages.disableError":"messages.enableError"))}).finally(()=>{a(null)})},k=v=>{p?.find(T=>T.code===v),c(v),r(!0)};return e.jsxs(we,{children:[e.jsxs(Ce,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(ca,{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(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(Cn,{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:v=>x(v.target.value),className:"pl-9"})]}),e.jsxs(G,{value:o,onValueChange:d,children:[e.jsx(U,{className:"w-[180px]",children:e.jsx(Y,{placeholder:s("category.placeholder")})}),e.jsx(B,{children:f.map(v=>e.jsx(L,{value:v,children:s(`category.${v}`)},v))})]})]}),e.jsxs(fa,{defaultValue:"all",className:"w-full",children:[e.jsxs(zt,{children:[e.jsx(Ns,{value:"all",children:s("tabs.all")}),e.jsx(Ns,{value:"installed",children:s("tabs.installed")}),e.jsx(Ns,{value:"available",children:s("tabs.available")})]}),e.jsx(yt,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:P?e.jsxs(e.Fragment,{children:[e.jsx(Ut,{}),e.jsx(Ut,{}),e.jsx(Ut,{})]}):g?.map(v=>e.jsx(Kt,{plugin:v,onInstall:S,onUninstall:j,onToggleEnable:C,onOpenConfig:k,isLoading:n===v.name},v.name))})}),e.jsx(yt,{value:"installed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:g?.filter(v=>v.is_installed).map(v=>e.jsx(Kt,{plugin:v,onInstall:S,onUninstall:j,onToggleEnable:C,onOpenConfig:k,isLoading:n===v.name},v.name))})}),e.jsx(yt,{value:"available",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:g?.filter(v=>!v.is_installed).map(v=>e.jsx(Kt,{plugin:v,onInstall:S,onUninstall:j,onToggleEnable:C,onOpenConfig:k,isLoading:n===v.name},v.code))})})]})]}),e.jsx(ge,{open:l,onOpenChange:r,children:e.jsxs(fe,{className:"sm:max-w-lg",children:[e.jsxs(be,{children:[e.jsxs(je,{children:[p?.find(v=>v.code===i)?.name," ",s("config.title")]}),e.jsx(Pe,{children:s("config.description")})]}),i&&e.jsx(cu,{pluginName:i,onClose:()=>r(!1),onSuccess:()=>{r(!1),R()}})]})})]})]})}function Kt({plugin:s,onInstall:n,onUninstall:a,onToggleEnable:l,onOpenConfig:r,isLoading:i}){const{t:c}=I("plugin");return e.jsxs(Me,{className:"group relative overflow-hidden transition-all hover:shadow-md",children:[e.jsxs($e,{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(cs,{children:s.name}),s.is_installed&&e.jsx(H,{variant:s.is_enabled?"success":"secondary",children:s.is_enabled?c("status.enabled"):c("status.disabled")})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ca,{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(Ks,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"mt-2",children:s.description}),e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-1",children:[c("author"),": ",s.author]})})]})})]}),e.jsx(qe,{children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.is_installed?e.jsxs(e.Fragment,{children:[e.jsxs(V,{variant:"outline",size:"sm",onClick:()=>r(s.code),disabled:!s.is_enabled||i,children:[e.jsx(vi,{className:"mr-2 h-4 w-4"}),c("button.config")]}),e.jsxs(V,{variant:s.is_enabled?"destructive":"default",size:"sm",onClick:()=>l(s.code,s.is_enabled),disabled:i,children:[e.jsx(bi,{className:"mr-2 h-4 w-4"}),s.is_enabled?c("button.disable"):c("button.enable")]}),e.jsx(Ue,{title:c("uninstall.title"),description:c("uninstall.description"),confirmText:c("uninstall.button"),variant:"destructive",onConfirm:()=>a(s.code),children:e.jsx(V,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",disabled:i,children:e.jsx(ns,{className:"h-4 w-4"})})})]}):e.jsx(V,{onClick:()=>n(s.code),disabled:i,loading:i,children:c("button.install")})})})]})}function Ut(){return e.jsxs(Me,{children:[e.jsxs($e,{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(le,{className:"h-6 w-[200px]"}),e.jsx(le,{className:"h-6 w-[80px]"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(le,{className:"h-5 w-[120px]"}),e.jsx(le,{className:"h-5 w-[60px]"})]})]})}),e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx(le,{className:"h-4 w-[300px]"}),e.jsx(le,{className:"h-4 w-[150px]"})]})]}),e.jsx(qe,{children:e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(le,{className:"h-9 w-[100px]"}),e.jsx(le,{className:"h-9 w-[100px]"}),e.jsx(le,{className:"h-8 w-8"})]})})]})}const mu=Object.freeze(Object.defineProperty({__proto__:null,default:du},Symbol.toStringTag,{value:"Module"})),uu=(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(ps,{placeholder:s.placeholder,...n});break;case"select":a=e.jsx("select",{className:_(Us({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 xu({themeKey:s,themeInfo:n}){const{t:a}=I("theme"),[l,r]=u.useState(!1),[i,c]=u.useState(!1),[m,x]=u.useState(!1),o=de({defaultValues:n.configs.reduce((P,R)=>(P[R.field_name]="",P),{})}),d=async()=>{c(!0),Ac(s).then(({data:P})=>{Object.entries(P).forEach(([R,f])=>{o.setValue(R,f)})}).finally(()=>{c(!1)})},p=async P=>{x(!0),$c(s,P).then(()=>{$.success(a("config.success")),r(!1)}).finally(()=>{x(!1)})};return e.jsxs(ge,{open:l,onOpenChange:P=>{r(P),P?d():o.reset()},children:[e.jsx(ze,{asChild:!0,children:e.jsx(V,{variant:"outline",children:a("card.configureTheme")})}),e.jsxs(fe,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(be,{children:[e.jsx(je,{children:a("config.title",{name:n.name})}),e.jsx(Pe,{children:a("config.description")})]}),i?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(ma,{className:"h-6 w-6 animate-spin"})}):e.jsx(xe,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(p),className:"space-y-4",children:[n.configs.map(P=>e.jsx(y,{control:o.control,name:P.field_name,render:({field:R})=>e.jsxs(b,{children:[e.jsx(N,{children:P.label}),e.jsx(w,{children:uu(P,R)}),e.jsx(E,{})]})},P.field_name)),e.jsxs(Le,{className:"mt-6 gap-2",children:[e.jsx(V,{type:"button",variant:"secondary",onClick:()=>r(!1),children:a("config.cancel")}),e.jsx(V,{type:"submit",loading:m,children:a("config.save")})]})]})})]})]})}function hu(){const{t:s}=I("theme"),[n,a]=u.useState(null),[l,r]=u.useState(!1),[i,c]=u.useState(!1),[m,x]=u.useState(!1),[o,d]=u.useState(null),p=u.useRef(null),[P,R]=u.useState(0),{data:f,isLoading:g,refetch:S}=se({queryKey:["themeList"],queryFn:async()=>{const{data:q}=await Lc();return q}}),j=async q=>{a(q),Kc({frontend_theme:q}).then(()=>{$.success("主题切换成功"),S()}).finally(()=>{a(null)})},C=async q=>{if(!q.name.endsWith(".zip")){$.error(s("upload.error.format"));return}r(!0),qc(q).then(()=>{$.success("主题上传成功"),c(!1),S()}).finally(()=>{r(!1),p.current&&(p.current.value="")})},k=q=>{q.preventDefault(),q.stopPropagation(),q.type==="dragenter"||q.type==="dragover"?x(!0):q.type==="dragleave"&&x(!1)},v=q=>{q.preventDefault(),q.stopPropagation(),x(!1),q.dataTransfer.files&&q.dataTransfer.files[0]&&C(q.dataTransfer.files[0])},T=()=>{o&&R(q=>q===0?o.images.length-1:q-1)},z=()=>{o&&R(q=>q===o.images.length-1?0:q+1)},Q=(q,X)=>{R(0),d({name:q,images:X})};return e.jsxs(we,{children:[e.jsxs(Ce,{className:"flex items-center justify-between",children:[e.jsx(Ie,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(V,{onClick:()=>c(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(Jt,{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:g?e.jsxs(e.Fragment,{children:[e.jsx(Xa,{}),e.jsx(Xa,{})]}):f?.themes&&Object.entries(f.themes).map(([q,X])=>e.jsx(Me,{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:_("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(Ue,{title:s("card.delete.title"),description:s("card.delete.description"),confirmText:s("card.delete.button"),variant:"destructive",onConfirm:async()=>{if(q===f?.active){$.error(s("card.delete.error.active"));return}a(q),Hc(q).then(()=>{$.success("主题删除成功"),S()}).finally(()=>{a(null)})},children:e.jsx(V,{disabled:n===q,loading:n===q,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($e,{children:[e.jsx(cs,{children:X.name}),e.jsx(Ks,{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(qe,{className:"flex items-center justify-end space-x-3",children:[X.images&&Array.isArray(X.images)&&X.images.length>0&&e.jsx(V,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Q(X.name,X.images),children:e.jsx(yi,{className:"h-4 w-4"})}),e.jsx(xu,{themeKey:q,themeInfo:X}),e.jsx(V,{onClick:()=>j(q),disabled:n===q||q===f.active,loading:n===q,variant:q===f.active?"secondary":"default",children:q===f.active?s("card.currentTheme"):s("card.activateTheme")})]})]})},q))}),e.jsx(ge,{open:i,onOpenChange:c,children:e.jsxs(fe,{className:"sm:max-w-md",children:[e.jsxs(be,{children:[e.jsx(je,{children:s("upload.title")}),e.jsx(Pe,{children:s("upload.description")})]}),e.jsxs("div",{className:_("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:k,onDragLeave:k,onDragOver:k,onDrop:v,children:[e.jsx("input",{type:"file",ref:p,className:"hidden",accept:".zip",onChange:q=>{const X=q.target.files?.[0];X&&C(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(Jt,{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(ge,{open:!!o,onOpenChange:q=>{q||(d(null),R(0))},children:e.jsxs(fe,{className:"max-w-4xl",children:[e.jsxs(be,{children:[e.jsxs(je,{children:[o?.name," ",s("preview.title")]}),e.jsx(Pe,{className:"text-center",children:o&&s("preview.imageCount",{current:P+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[P]&&e.jsx("img",{src:o.images[P],alt:`${o.name} 预览图 ${P+1}`,className:"h-full w-full object-contain"})}),o&&o.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(V,{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:T,children:e.jsx(Ni,{className:"h-4 w-4"})}),e.jsx(V,{variant:"outline",size:"icon",className:"absolute right-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:z,children:e.jsx(_i,{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((q,X)=>e.jsx("button",{onClick:()=>R(X),className:_("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",P===X?"border-primary":"border-transparent"),children:e.jsx("img",{src:q,alt:`缩略图 ${X+1}`,className:"h-full w-full object-cover"})},X))})]})})]})]})}function Xa(){return e.jsxs(Me,{children:[e.jsxs($e,{children:[e.jsx(le,{className:"h-6 w-[200px]"}),e.jsx(le,{className:"h-4 w-[300px]"})]}),e.jsxs(qe,{className:"flex items-center justify-end space-x-3",children:[e.jsx(le,{className:"h-10 w-[100px]"}),e.jsx(le,{className:"h-10 w-[100px]"})]})]})}const fu=Object.freeze(Object.defineProperty({__proto__:null,default:hu},Symbol.toStringTag,{value:"Module"})),ka=u.forwardRef(({className:s,value:n,onChange:a,...l},r)=>{const[i,c]=u.useState("");u.useEffect(()=>{if(i.includes(",")){const x=new Set([...n,...i.split(",").map(o=>o.trim())]);a(Array.from(x)),c("")}},[i,a,n]);const m=()=>{if(i){const x=new Set([...n,i]);a(Array.from(x)),c("")}};return e.jsxs("div",{className:_(" 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(H,{variant:"secondary",children:[x,e.jsx(J,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{a(n.filter(o=>o!==x))},children:e.jsx(Xt,{className:"w-3"})})]},x)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:i,onChange:x=>c(x.target.value),onKeyDown:x=>{x.key==="Enter"||x.key===","?(x.preventDefault(),m()):x.key==="Backspace"&&i.length===0&&n.length>0&&(x.preventDefault(),a(n.slice(0,-1)))},...l,ref:r})]})});ka.displayName="InputTags";const pu=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()}),gu={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function Lr({refetch:s,dialogTrigger:n,type:a="add",defaultFormValues:l=gu}){const{t:r}=I("notice"),[i,c]=u.useState(!1),m=de({resolver:ue(pu),defaultValues:l,mode:"onChange",shouldFocusError:!0}),x=new ua({html:!0});return e.jsx(xe,{...m,children:e.jsxs(ge,{onOpenChange:c,open:i,children:[e.jsx(ze,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Se,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add.button")})]})}),e.jsxs(fe,{className:"sm:max-w-[1025px]",children:[e.jsxs(be,{children:[e.jsx(je,{children:r(a==="add"?"form.add.title":"form.edit.title")}),e.jsx(Pe,{})]}),e.jsx(y,{control:m.control,name:"title",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.title.label")}),e.jsx("div",{className:"relative ",children:e.jsx(w,{children:e.jsx(D,{placeholder:r("form.fields.title.placeholder"),...o})})}),e.jsx(E,{})]})}),e.jsx(y,{control:m.control,name:"content",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.content.label")}),e.jsx(w,{children:e.jsx(xa,{style:{height:"500px"},value:o.value,renderHTML:d=>x.render(d),onChange:({text:d})=>{o.onChange(d)}})}),e.jsx(E,{})]})}),e.jsx(y,{control:m.control,name:"img_url",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.img_url.label")}),e.jsx("div",{className:"relative",children:e.jsx(w,{children:e.jsx(D,{type:"text",placeholder:r("form.fields.img_url.placeholder"),...o,value:o.value||""})})}),e.jsx(E,{})]})}),e.jsx(y,{control:m.control,name:"show",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.show.label")}),e.jsx("div",{className:"relative py-2",children:e.jsx(w,{children:e.jsx(K,{checked:o.value,onCheckedChange:o.onChange})})}),e.jsx(E,{})]})}),e.jsx(y,{control:m.control,name:"tags",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.fields.tags.label")}),e.jsx(w,{children:e.jsx(ka,{value:o.value,onChange:o.onChange,placeholder:r("form.fields.tags.placeholder"),className:"w-full"})}),e.jsx(E,{})]})}),e.jsxs(Le,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(V,{type:"button",variant:"outline",children:r("form.buttons.cancel")})}),e.jsx(V,{type:"submit",onClick:o=>{o.preventDefault(),m.handleSubmit(async d=>{od(d).then(({data:p})=>{p&&($.success(r("form.buttons.success")),s(),c(!1))})})()},children:r("form.buttons.submit")})]})]})]})})}function ju({table:s,refetch:n,saveOrder:a,isSortMode:l}){const{t:r}=I("notice"),i=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(Lr,{refetch:n}),!l&&e.jsx(D,{placeholder:r("table.toolbar.search"),value:s.getColumn("title")?.getFilterValue()??"",onChange:c=>s.getColumn("title")?.setFilterValue(c.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),i&&!l&&e.jsxs(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:[r("table.toolbar.reset"),e.jsx(Ae,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(V,{variant:l?"default":"outline",onClick:a,className:"h-8",size:"sm",children:r(l?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}const vu=s=>{const{t:n}=I("notice");return[{id:"drag-handle",header:"",cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(wi,{className:"h-4 w-4 text-muted-foreground cursor-move"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.id")}),cell:({row:a})=>e.jsx(H,{variant:"outline",className:"font-mono",children:a.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.show")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(K,{defaultChecked:a.getValue("show"),onCheckedChange:async()=>{const{data:l}=await cd({id:a.original.id});l||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:a})=>e.jsx(O,{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(O,{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(Lr,{refetch:s,dialogTrigger:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Is,{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(Ue,{title:n("table.actions.delete.title"),description:n("table.actions.delete.description"),onConfirm:async()=>{id({id:a.original.id}).then(()=>{$.success(n("table.actions.delete.success")),s()})},children:e.jsxs(V,{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 bu(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,i]=u.useState([]),[c,m]=u.useState([]),[x,o]=u.useState(!1),[d,p]=u.useState({}),[P,R]=u.useState({pageSize:50,pageIndex:0}),[f,g]=u.useState([]),{refetch:S}=se({queryKey:["notices"],queryFn:async()=>{const{data:T}=await Ja.getList();return g(T),T}});u.useEffect(()=>{l({"drag-handle":x,content:!x,created_at:!x,actions:!x}),R({pageSize:x?99999:50,pageIndex:0})},[x]);const j=(T,z)=>{x&&(T.dataTransfer.setData("text/plain",z.toString()),T.currentTarget.classList.add("opacity-50"))},C=(T,z)=>{if(!x)return;T.preventDefault(),T.currentTarget.classList.remove("bg-muted");const Q=parseInt(T.dataTransfer.getData("text/plain"));if(Q===z)return;const q=[...f],[X]=q.splice(Q,1);q.splice(z,0,X),g(q)},k=async()=>{if(!x){o(!0);return}Ja.sort(f.map(T=>T.id)).then(()=>{$.success("排序保存成功"),o(!1),S()}).finally(()=>{o(!1)})},v=He({data:f??[],columns:vu(S),state:{sorting:c,columnVisibility:a,rowSelection:s,columnFilters:r,columnSizing:d,pagination:P},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:i,onColumnVisibilityChange:l,onColumnSizingChange:p,onPaginationChange:R,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),getSortedRowModel:Ze(),getFacetedRowModel:us(),getFacetedUniqueValues:xs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(es,{table:v,toolbar:T=>e.jsx(ju,{table:T,refetch:S,saveOrder:k,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})})}function yu(){const{t:s}=I("notice");return e.jsxs(we,{children:[e.jsxs(Ce,{className:"flex items-center justify-between",children:[e.jsx(Ie,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(bu,{})})]})]})}const Nu=Object.freeze(Object.defineProperty({__proto__:null,default:yu},Symbol.toStringTag,{value:"Module"})),_u=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()}),wu={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function Ar({refreshData:s,dialogTrigger:n,type:a="add",defaultFormValues:l=wu}){const{t:r}=I("knowledge"),[i,c]=u.useState(!1),m=de({resolver:ue(_u),defaultValues:l,mode:"onChange",shouldFocusError:!0}),x=new ua({html:!0});return u.useEffect(()=>{i&&l.id&&md(l.id).then(({data:o})=>{m.reset(o)})},[l.id,m,i]),e.jsxs(ge,{onOpenChange:c,open:i,children:[e.jsx(ze,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Se,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add")})]})}),e.jsxs(fe,{className:"sm:max-w-[1025px]",children:[e.jsxs(be,{children:[e.jsx(je,{children:r(a==="add"?"form.add":"form.edit")}),e.jsx(Pe,{})]}),e.jsxs(xe,{...m,children:[e.jsx(y,{control:m.control,name:"title",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.title")}),e.jsx("div",{className:"relative ",children:e.jsx(w,{children:e.jsx(D,{placeholder:r("form.titlePlaceholder"),...o})})}),e.jsx(E,{})]})}),e.jsx(y,{control:m.control,name:"category",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.category")}),e.jsx("div",{className:"relative ",children:e.jsx(w,{children:e.jsx(D,{placeholder:r("form.categoryPlaceholder"),...o})})}),e.jsx(E,{})]})}),e.jsx(y,{control:m.control,name:"language",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.language")}),e.jsx(w,{children:e.jsxs(G,{value:o.value,onValueChange:o.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("form.languagePlaceholder")})}),e.jsx(B,{children:[{value:"en-US"},{value:"ja-JP"},{value:"ko-KR"},{value:"vi-VN"},{value:"zh-CN"},{value:"zh-TW"}].map(d=>e.jsx(L,{value:d.value,className:"cursor-pointer",children:r(`languages.${d.value}`)},d.value))})]})})]})}),e.jsx(y,{control:m.control,name:"body",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.content")}),e.jsx(w,{children:e.jsx(xa,{style:{height:"500px"},value:o.value,renderHTML:d=>x.render(d),onChange:({text:d})=>{o.onChange(d)}})}),e.jsx(E,{})]})}),e.jsx(y,{control:m.control,name:"show",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.show")}),e.jsx("div",{className:"relative py-2",children:e.jsx(w,{children:e.jsx(K,{checked:o.value,onCheckedChange:o.onChange})})}),e.jsx(E,{})]})}),e.jsxs(Le,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(V,{type:"button",variant:"outline",children:r("form.cancel")})}),e.jsx(V,{type:"submit",onClick:()=>{m.handleSubmit(o=>{ud(o).then(({data:d})=>{d&&(m.reset(),$.success(r("messages.operationSuccess")),c(!1),s())})})()},children:r("form.submit")})]})]})]})]})}function Cu({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(rs,{children:[e.jsx(ls,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(mt,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ye,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{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(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(i=>r.has(i.value)).map(i=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Cs,{children:[e.jsx(Fs,{placeholder:n}),e.jsxs(Ss,{children:[e.jsx(Ms,{children:"No results found."}),e.jsx(Oe,{children:a.map(i=>{const c=r.has(i.value);return e.jsxs(ke,{onSelect:()=>{c?r.delete(i.value):r.add(i.value);const m=Array.from(r);s?.setFilterValue(m.length?m:void 0)},children:[e.jsx("div",{className:_("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(Rs,{className:_("h-4 w-4")})}),i.icon&&e.jsx(i.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),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)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Gs,{}),e.jsx(Oe,{children:e.jsx(ke,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function Su({table:s,refetch:n,saveOrder:a,isSortMode:l}){const r=s.getState().columnFilters.length>0,{t:i}=I("knowledge");return e.jsxs("div",{className:"flex items-center justify-between",children:[l?e.jsx("p",{className:"text-sm text-muted-foreground",children:i("toolbar.sortModeHint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ar,{refreshData:n}),e.jsx(D,{placeholder:i("toolbar.searchPlaceholder"),value:s.getColumn("title")?.getFilterValue()??"",onChange:c=>s.getColumn("title")?.setFilterValue(c.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(Cu,{column:s.getColumn("category"),title:i("columns.category"),options:Array.from(new Set(s.getCoreRowModel().rows.map(c=>c.getValue("category")))).map(c=>({label:c,value:c}))}),r&&e.jsxs(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[i("toolbar.reset"),e.jsx(Ae,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(V,{variant:l?"default":"outline",onClick:a,size:"sm",children:i(l?"toolbar.saveSort":"toolbar.editSort")})})]})}const ku=({refetch:s,isSortMode:n=!1})=>{const{t:a}=I("knowledge");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(Vt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx(H,{variant:"outline",className:"justify-center",children:l.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.status")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center",children:e.jsx(K,{defaultChecked:l.getValue("show"),onCheckedChange:async()=>{hd({id:l.original.id}).then(({data:r})=>{r||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:l})=>e.jsx(O,{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(O,{column:l,title:a("columns.category")}),cell:({row:l})=>e.jsx(H,{variant:"secondary",className:"max-w-[180px] truncate",children:l.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:l})=>e.jsx(O,{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(Ar,{refreshData:s,dialogTrigger:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Is,{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(Ue,{title:a("messages.deleteConfirm"),description:a("messages.deleteDescription"),confirmText:a("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{xd({id:l.original.id}).then(({data:r})=>{r&&($.success(a("messages.operationSuccess")),s())})},children:e.jsxs(V,{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 Tu(){const[s,n]=u.useState([]),[a,l]=u.useState([]),[r,i]=u.useState(!1),[c,m]=u.useState([]),[x,o]=u.useState({"drag-handle":!1}),[d,p]=u.useState({pageSize:20,pageIndex:0}),{refetch:P,isLoading:R,data:f}=se({queryKey:["knowledge"],queryFn:async()=>{const{data:k}=await dd();return m(k||[]),k}});u.useEffect(()=>{o({"drag-handle":r,actions:!r}),p({pageSize:r?99999:10,pageIndex:0})},[r]);const g=(k,v)=>{r&&(k.dataTransfer.setData("text/plain",v.toString()),k.currentTarget.classList.add("opacity-50"))},S=(k,v)=>{if(!r)return;k.preventDefault(),k.currentTarget.classList.remove("bg-muted");const T=parseInt(k.dataTransfer.getData("text/plain"));if(T===v)return;const z=[...c],[Q]=z.splice(T,1);z.splice(v,0,Q),m(z)},j=async()=>{r?fd({ids:c.map(k=>k.id)}).then(()=>{P(),i(!1),$.success("排序保存成功")}):i(!0)},C=He({data:c,columns:ku({refetch:P,isSortMode:r}),state:{sorting:a,columnFilters:s,columnVisibility:x,pagination:d},onSortingChange:l,onColumnFiltersChange:n,onColumnVisibilityChange:o,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),getSortedRowModel:Ze(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(es,{table:C,toolbar:k=>e.jsx(Su,{table:k,refetch:P,saveOrder:j,isSortMode:r}),draggable:r,onDragStart:g,onDragEnd:k=>k.currentTarget.classList.remove("opacity-50"),onDragOver:k=>{k.preventDefault(),k.currentTarget.classList.add("bg-muted")},onDragLeave:k=>k.currentTarget.classList.remove("bg-muted"),onDrop:S,showPagination:!r})}function Pu(){const{t:s}=I("knowledge");return e.jsxs(we,{children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(Tu,{})})]})]})}const Du=Object.freeze(Object.defineProperty({__proto__:null,default:Pu},Symbol.toStringTag,{value:"Module"}));function Eu(s,n){const[a,l]=u.useState(s);return u.useEffect(()=>{const r=setTimeout(()=>l(s),n);return()=>{clearTimeout(r)}},[s,n]),a}function Bt(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 Ru(s,n){const a=JSON.parse(JSON.stringify(s));for(const[l,r]of Object.entries(a))a[l]=r.filter(i=>!n.find(c=>c.value===i.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 $r=u.forwardRef(({className:s,...n},a)=>Ci(r=>r.filtered.count===0)?e.jsx("div",{ref:a,className:_("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...n}):null);$r.displayName="CommandEmpty";const it=u.forwardRef(({value:s,onChange:n,placeholder:a,defaultOptions:l=[],options:r,delay:i,onSearch:c,loadingIndicator:m,emptyIndicator:x,maxSelected:o=Number.MAX_SAFE_INTEGER,onMaxSelected:d,hidePlaceholderWhenSelected:p,disabled:P,groupBy:R,className:f,badgeClassName:g,selectFirstItem:S=!0,creatable:j=!1,triggerSearchOnFocus:C=!1,commandProps:k,inputProps:v,hideClearAllButton:T=!1},z)=>{const Q=u.useRef(null),[q,X]=u.useState(!1),Ys=u.useRef(!1),[Va,Ia]=u.useState(!1),[ee,Ws]=u.useState(s||[]),[ks,Fa]=u.useState(Bt(l,R)),[gs,At]=u.useState(""),Js=Eu(gs,i||500);u.useImperativeHandle(z,()=>({selectedValue:[...ee],input:Q.current,focus:()=>Q.current?.focus()}),[ee]);const xt=u.useCallback(W=>{const ae=ee.filter(Ve=>Ve.value!==W.value);Ws(ae),n?.(ae)},[n,ee]),dl=u.useCallback(W=>{const ae=Q.current;ae&&((W.key==="Delete"||W.key==="Backspace")&&ae.value===""&&ee.length>0&&(ee[ee.length-1].fixed||xt(ee[ee.length-1])),W.key==="Escape"&&ae.blur())},[xt,ee]);u.useEffect(()=>{s&&Ws(s)},[s]),u.useEffect(()=>{if(!r||c)return;const W=Bt(r||[],R);JSON.stringify(W)!==JSON.stringify(ks)&&Fa(W)},[l,r,R,c,ks]),u.useEffect(()=>{const W=async()=>{Ia(!0);const Ve=await c?.(Js);Fa(Bt(Ve||[],R)),Ia(!1)};(async()=>{!c||!q||(C&&await W(),Js&&await W())})()},[Js,R,q,C]);const ml=()=>{if(!j||Vu(ks,[{value:gs,label:gs}])||ee.find(ae=>ae.value===gs))return;const W=e.jsx(ke,{value:gs,className:"cursor-pointer",onMouseDown:ae=>{ae.preventDefault(),ae.stopPropagation()},onSelect:ae=>{if(ee.length>=o){d?.(ee.length);return}At("");const Ve=[...ee,{value:ae,label:ae}];Ws(Ve),n?.(Ve)},children:`Create "${gs}"`});if(!c&&gs.length>0||c&&Js.length>0&&!Va)return W},ul=u.useCallback(()=>{if(x)return c&&!j&&Object.keys(ks).length===0?e.jsx(ke,{value:"-",disabled:!0,children:x}):e.jsx($r,{children:x})},[j,x,c,ks]),xl=u.useMemo(()=>Ru(ks,ee),[ks,ee]),hl=u.useCallback(()=>{if(k?.filter)return k.filter;if(j)return(W,ae)=>W.toLowerCase().includes(ae.toLowerCase())?1:-1},[j,k?.filter]),fl=u.useCallback(()=>{const W=ee.filter(ae=>ae.fixed);Ws(W),n?.(W)},[n,ee]);return e.jsxs(Cs,{...k,onKeyDown:W=>{dl(W),k?.onKeyDown?.(W)},className:_("h-auto overflow-visible bg-transparent",k?.className),shouldFilter:k?.shouldFilter!==void 0?k.shouldFilter:!c,filter:hl(),children:[e.jsx("div",{className:_("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":!P&&ee.length!==0},f),onClick:()=>{P||Q.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[ee.map(W=>e.jsxs(H,{className:_("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",g),"data-fixed":W.fixed,"data-disabled":P||void 0,children:[W.label,e.jsx("button",{className:_("ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",(P||W.fixed)&&"hidden"),onKeyDown:ae=>{ae.key==="Enter"&&xt(W)},onMouseDown:ae=>{ae.preventDefault(),ae.stopPropagation()},onClick:()=>xt(W),children:e.jsx(Xt,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},W.value)),e.jsx(De.Input,{...v,ref:Q,value:gs,disabled:P,onValueChange:W=>{At(W),v?.onValueChange?.(W)},onBlur:W=>{Ys.current===!1&&X(!1),v?.onBlur?.(W)},onFocus:W=>{X(!0),C&&c?.(Js),v?.onFocus?.(W)},placeholder:p&&ee.length!==0?"":a,className:_("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},v?.className)}),e.jsx("button",{type:"button",onClick:fl,className:_((T||P||ee.length<1||ee.filter(W=>W.fixed).length===ee.length)&&"hidden"),children:e.jsx(Xt,{})})]})}),e.jsx("div",{className:"relative",children:q&&e.jsx(Ss,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{Ys.current=!1},onMouseEnter:()=>{Ys.current=!0},onMouseUp:()=>{Q.current?.focus()},children:Va?e.jsx(e.Fragment,{children:m}):e.jsxs(e.Fragment,{children:[ul(),ml(),!S&&e.jsx(ke,{value:"-",className:"hidden"}),Object.entries(xl).map(([W,ae])=>e.jsx(Oe,{heading:W,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:ae.map(Ve=>e.jsx(ke,{value:Ve.value,disabled:Ve.disable,onMouseDown:Qs=>{Qs.preventDefault(),Qs.stopPropagation()},onSelect:()=>{if(ee.length>=o){d?.(ee.length);return}At("");const Qs=[...ee,Ve];Ws(Qs),n?.(Qs)},className:_("cursor-pointer",Ve.disable&&"cursor-default text-muted-foreground"),children:Ve.label},Ve.value))})},W))]})})})]})});it.displayName="MultipleSelector";const Iu=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 Lt({refetch:s,dialogTrigger:n,defaultValues:a={name:""},type:l="add"}){const{t:r}=I("group"),i=de({resolver:ue(Iu(r)),defaultValues:a,mode:"onChange"}),[c,m]=u.useState(!1),[x,o]=u.useState(!1),d=async p=>{o(!0),Jc(p).then(()=>{$.success(r(l==="edit"?"messages.updateSuccess":"messages.createSuccess")),s&&s(),i.reset(),m(!1)}).finally(()=>{o(!1)})};return e.jsxs(ge,{open:c,onOpenChange:m,children:[e.jsx(ze,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Se,{icon:"ion:add"}),e.jsx("span",{children:r("form.add")})]})}),e.jsxs(fe,{className:"sm:max-w-[425px]",children:[e.jsxs(be,{children:[e.jsx(je,{children:r(l==="edit"?"form.edit":"form.create")}),e.jsx(Pe,{children:r(l==="edit"?"form.editDescription":"form.createDescription")})]}),e.jsx(xe,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(d),className:"space-y-4",children:[e.jsx(y,{control:i.control,name:"name",render:({field:p})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.name")}),e.jsx(w,{children:e.jsx(D,{placeholder:r("form.namePlaceholder"),...p,className:"w-full"})}),e.jsx(M,{children:r("form.nameDescription")}),e.jsx(E,{})]})}),e.jsxs(Le,{className:"gap-2",children:[e.jsx(ut,{asChild:!0,children:e.jsx(V,{type:"button",variant:"outline",children:r("form.cancel")})}),e.jsxs(V,{type:"submit",disabled:x||!i.formState.isValid,children:[x&&e.jsx(ma,{className:"mr-2 h-4 w-4 animate-spin"}),r(l==="edit"?"form.update":"form.create")]})]})]})})]})]})}const qr=u.createContext(void 0);function Fu({children:s,refetch:n}){const[a,l]=u.useState(!1),[r,i]=u.useState(null),[c,m]=u.useState(Ne.Shadowsocks);return e.jsx(qr.Provider,{value:{isOpen:a,setIsOpen:l,editingServer:r,setEditingServer:i,serverType:c,setServerType:m,refetch:n},children:s})}function Hr(){const s=u.useContext(qr);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function Gt({dialogTrigger:s,value:n,setValue:a,templateType:l}){const{t:r}=I("server");u.useEffect(()=>{console.log(n)},[n]);const[i,c]=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=j=>{if(!j)return null;try{const C=JSON.parse(j);return typeof C!="object"||C===null?r("network_settings.validation.must_be_object"):null}catch{return r("network_settings.validation.invalid_json")}},P={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"}}}},R=()=>{switch(l){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];default:return[]}},f=()=>{const j=p(m||"");if(j){$.error(j);return}try{if(!m){a(null),c(!1);return}a(JSON.parse(m)),c(!1)}catch{$.error(r("network_settings.errors.save_failed"))}},g=j=>{x(j),d(p(j))},S=j=>{const C=P[j];if(C){const k=JSON.stringify(C.content,null,2);x(k),d(null)}};return u.useEffect(()=>{i&&console.log(n)},[i,n]),u.useEffect(()=>{i&&n&&Object.keys(n).length>0&&x(JSON.stringify(n,null,2))},[i,n]),e.jsxs(ge,{open:i,onOpenChange:j=>{!j&&i&&f(),c(j)},children:[e.jsx(ze,{asChild:!0,children:s??e.jsx(J,{variant:"link",children:r("network_settings.edit_protocol")})}),e.jsxs(fe,{className:"sm:max-w-[425px]",children:[e.jsx(be,{children:e.jsx(je,{children:r("network_settings.edit_protocol_config")})}),e.jsxs("div",{className:"space-y-4",children:[R().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:R().map(j=>e.jsx(J,{variant:"outline",size:"sm",onClick:()=>S(j),children:r("network_settings.use_template",{template:P[j].label})},j))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ps,{className:`min-h-[200px] font-mono text-sm ${o?"border-red-500 focus-visible:ring-red-500":""}`,value:m,placeholder:R().length>0?r("network_settings.json_config_placeholder_with_template"):r("network_settings.json_config_placeholder"),onChange:j=>g(j.target.value)}),o&&e.jsx("p",{className:"text-sm text-red-500",children:o})]})]}),e.jsxs(Le,{className:"gap-2",children:[e.jsx(J,{variant:"outline",onClick:()=>c(!1),children:r("common.cancel")}),e.jsx(J,{onClick:f,disabled:!!o,children:r("common.confirm")})]})]})]})}function Oh(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 Mu={},Ou=Object.freeze(Object.defineProperty({__proto__:null,default:Mu},Symbol.toStringTag,{value:"Module"})),zh=Li(Ou),en=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),zu=()=>{try{const s=Si.box.keyPair(),n=en(qa.encodeBase64(s.secretKey)),a=en(qa.encodeBase64(s.publicKey));return{privateKey:n,publicKey:a}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},Lu=()=>{try{return zu()}catch(s){throw console.error("Error generating key pair:",s),s}},Au=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)},$u=()=>{const s=Math.floor(Math.random()*8)*2+2;return Au(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({})}),Hu=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({})}),Ku=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({})}),Uu=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({})}),Bu=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("")}),os={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:Hu,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:Ku,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Uu,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:Bu,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"]}},Gu=({serverType:s,value:n,onChange:a})=>{const{t:l}=I("server"),r=s?os[s]:null,i=r?.schema||h.record(h.any()),c=s?i.parse({}):{},m=de({resolver:ue(i),defaultValues:c,mode:"onChange"});if(u.useEffect(()=>{if(!n||Object.keys(n).length===0){if(s){const f=i.parse({});m.reset(f)}}else m.reset(n)},[s,n,a,m,i]),u.useEffect(()=>{const f=m.watch(g=>{a(g)});return()=>f.unsubscribe()},[m,a]),!s||!r)return null;const R={shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(y,{control:m.control,name:"cipher",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.shadowsocks.cipher.label")}),e.jsx(w,{children:e.jsxs(G,{onValueChange:f.onChange,value:f.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.shadowsocks.cipher.placeholder")})}),e.jsx(B,{children:e.jsx(js,{children:os.shadowsocks.ciphers.map(g=>e.jsx(L,{value:g,children:g},g))})})]})})]})}),e.jsx(y,{control:m.control,name:"obfs",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.shadowsocks.obfs.label")}),e.jsx(w,{children:e.jsxs(G,{onValueChange:f.onChange,value:f.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.shadowsocks.obfs.placeholder")})}),e.jsx(B,{children:e.jsxs(js,{children:[e.jsx(L,{value:"0",children:l("dynamic_form.shadowsocks.obfs.none")}),e.jsx(L,{value:"http",children:l("dynamic_form.shadowsocks.obfs.http")})]})})]})})]})}),m.watch("obfs")==="http"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{control:m.control,name:"obfs_settings.path",render:({field:f})=>e.jsxs(b,{className:"flex-1",children:[e.jsx(w,{children:e.jsx(D,{type:"text",placeholder:l("dynamic_form.shadowsocks.obfs_settings.path"),...f})}),e.jsx(E,{})]})}),e.jsx(y,{control:m.control,name:"obfs_settings.host",render:({field:f})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(w,{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(y,{control:m.control,name:"tls",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.vmess.tls.label")}),e.jsx(w,{children:e.jsxs(G,{value:f.value?.toString(),onValueChange:g=>f.onChange(Number(g)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vmess.tls.placeholder")})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:l("dynamic_form.vmess.tls.disabled")}),e.jsx(L,{value:"1",children:l("dynamic_form.vmess.tls.enabled")})]})]})})]})}),m.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{control:m.control,name:"tls_settings.server_name",render:({field:f})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(N,{children:l("dynamic_form.vmess.tls_settings.server_name.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:l("dynamic_form.vmess.tls_settings.server_name.placeholder"),...f})})]})}),e.jsx(y,{control:m.control,name:"tls_settings.allow_insecure",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.vmess.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(w,{children:e.jsx(K,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),e.jsx(y,{control:m.control,name:"network",render:({field:f})=>e.jsxs(b,{children:[e.jsxs(N,{children:[l("dynamic_form.vmess.network.label"),e.jsx(Gt,{value:m.watch("network_settings"),setValue:g=>m.setValue("network_settings",g),templateType:m.watch("network")})]}),e.jsx(w,{children:e.jsxs(G,{onValueChange:f.onChange,value:f.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vmess.network.placeholder")})}),e.jsx(B,{children:e.jsx(js,{children:os.vmess.networkOptions.map(g=>e.jsx(L,{value:g.value,className:"cursor-pointer",children:g.label},g.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{control:m.control,name:"server_name",render:({field:f})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(N,{children:l("dynamic_form.trojan.server_name.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:l("dynamic_form.trojan.server_name.placeholder"),...f,value:f.value||""})})]})}),e.jsx(y,{control:m.control,name:"allow_insecure",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.trojan.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(w,{children:e.jsx(K,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})})]}),e.jsx(y,{control:m.control,name:"network",render:({field:f})=>e.jsxs(b,{children:[e.jsxs(N,{children:[l("dynamic_form.trojan.network.label"),e.jsx(Gt,{value:m.watch("network_settings")||{},setValue:g=>m.setValue("network_settings",g),templateType:m.watch("network")||"tcp"})]}),e.jsx(w,{children:e.jsxs(G,{onValueChange:f.onChange,value:f.value||"tcp",children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.trojan.network.placeholder")})}),e.jsx(B,{children:e.jsx(js,{children:os.trojan.networkOptions.map(g=>e.jsx(L,{value:g.value,className:"cursor-pointer",children:g.label},g.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{control:m.control,name:"version",render:({field:f})=>e.jsxs(b,{className:"flex-1",children:[e.jsx(N,{children:l("dynamic_form.hysteria.version.label")}),e.jsx(w,{children:e.jsxs(G,{value:(f.value||2).toString(),onValueChange:g=>f.onChange(Number(g)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.hysteria.version.placeholder")})}),e.jsx(B,{children:e.jsx(js,{children:os.hysteria.versions.map(g=>e.jsxs(L,{value:g,className:"cursor-pointer",children:["V",g]},g))})})]})})]})}),m.watch("version")==1&&e.jsx(y,{control:m.control,name:"alpn",render:({field:f})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(N,{children:l("dynamic_form.hysteria.alpn.label")}),e.jsx(w,{children:e.jsxs(G,{value:f.value||"h2",onValueChange:f.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.hysteria.alpn.placeholder")})}),e.jsx(B,{children:e.jsx(js,{children:os.hysteria.alpnOptions.map(g=>e.jsx(L,{value:g,children:g},g))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{control:m.control,name:"obfs.open",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.hysteria.obfs.label")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(w,{children:e.jsx(K,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})}),!!m.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[m.watch("version")=="2"&&e.jsx(y,{control:m.control,name:"obfs.type",render:({field:f})=>e.jsxs(b,{className:"flex-1",children:[e.jsx(N,{children:l("dynamic_form.hysteria.obfs.type.label")}),e.jsx(w,{children:e.jsxs(G,{value:f.value||"salamander",onValueChange:f.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.hysteria.obfs.type.placeholder")})}),e.jsx(B,{children:e.jsx(js,{children:e.jsx(L,{value:"salamander",children:l("dynamic_form.hysteria.obfs.type.salamander")})})})]})})]})}),e.jsx(y,{control:m.control,name:"obfs.password",render:({field:f})=>e.jsxs(b,{className:m.watch("version")==2?"w-full":"flex-[2]",children:[e.jsx(N,{children:l("dynamic_form.hysteria.obfs.password.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{children:e.jsx(D,{placeholder:l("dynamic_form.hysteria.obfs.password.placeholder"),...f,value:f.value||"",className:"pr-9"})}),e.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",S=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(j=>g[j%g.length]).join("");m.setValue("obfs.password",S),$.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(Se,{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(y,{control:m.control,name:"tls.server_name",render:({field:f})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(N,{children:l("dynamic_form.hysteria.tls.server_name.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:l("dynamic_form.hysteria.tls.server_name.placeholder"),...f,value:f.value||""})})]})}),e.jsx(y,{control:m.control,name:"tls.allow_insecure",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.hysteria.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(w,{children:e.jsx(K,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})})]}),e.jsx(y,{control:m.control,name:"bandwidth.up",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.hysteria.bandwidth.up.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(w,{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(y,{control:m.control,name:"bandwidth.down",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.hysteria.bandwidth.down.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(w,{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(y,{control:m.control,name:"tls",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.vless.tls.label")}),e.jsx(w,{children:e.jsxs(G,{value:f.value?.toString(),onValueChange:g=>f.onChange(Number(g)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vless.tls.placeholder")})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:l("dynamic_form.vless.tls.none")}),e.jsx(L,{value:"1",children:l("dynamic_form.vless.tls.tls")}),e.jsx(L,{value:"2",children:l("dynamic_form.vless.tls.reality")})]})]})})]})}),m.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{control:m.control,name:"tls_settings.server_name",render:({field:f})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(N,{children:l("dynamic_form.vless.tls_settings.server_name.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:l("dynamic_form.vless.tls_settings.server_name.placeholder"),...f})})]})}),e.jsx(y,{control:m.control,name:"tls_settings.allow_insecure",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.vless.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(w,{children:e.jsx(K,{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(y,{control:m.control,name:"reality_settings.server_name",render:({field:f})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(N,{children:l("dynamic_form.vless.reality_settings.server_name.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:l("dynamic_form.vless.reality_settings.server_name.placeholder"),...f})})]})}),e.jsx(y,{control:m.control,name:"reality_settings.server_port",render:({field:f})=>e.jsxs(b,{className:"flex-1",children:[e.jsx(N,{children:l("dynamic_form.vless.reality_settings.server_port.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:l("dynamic_form.vless.reality_settings.server_port.placeholder"),...f})})]})}),e.jsx(y,{control:m.control,name:"reality_settings.allow_insecure",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.vless.reality_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(w,{children:e.jsx(K,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx(y,{control:m.control,name:"reality_settings.private_key",render:({field:f})=>e.jsxs(b,{className:"flex-1",children:[e.jsx(N,{children:l("dynamic_form.vless.reality_settings.private_key.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{children:e.jsx(D,{...f,className:"pr-9"})}),e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>{try{const g=Lu();m.setValue("reality_settings.private_key",g.privateKey),m.setValue("reality_settings.public_key",g.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(Se,{icon:"ion:key-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(wt,{children:e.jsx(te,{children:e.jsx("p",{children:l("dynamic_form.vless.reality_settings.key_pair.generate")})})})]})]})]})})}),e.jsx(y,{control:m.control,name:"reality_settings.public_key",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.vless.reality_settings.public_key.label")}),e.jsx(w,{children:e.jsx(D,{...f})})]})}),e.jsx(y,{control:m.control,name:"reality_settings.short_id",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.vless.reality_settings.short_id.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{children:e.jsx(D,{...f,className:"pr-9",placeholder:l("dynamic_form.vless.reality_settings.short_id.placeholder")})}),e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(J,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const g=$u();m.setValue("reality_settings.short_id",g),$.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(Se,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(wt,{children:e.jsx(te,{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(y,{control:m.control,name:"network",render:({field:f})=>e.jsxs(b,{children:[e.jsxs(N,{children:[l("dynamic_form.vless.network.label"),e.jsx(Gt,{value:m.watch("network_settings"),setValue:g=>m.setValue("network_settings",g),templateType:m.watch("network")})]}),e.jsx(w,{children:e.jsxs(G,{onValueChange:f.onChange,value:f.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vless.network.placeholder")})}),e.jsx(B,{children:e.jsx(js,{children:os.vless.networkOptions.map(g=>e.jsx(L,{value:g.value,className:"cursor-pointer",children:g.label},g.value))})})]})})]})}),e.jsx(y,{control:m.control,name:"flow",render:({field:f})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dynamic_form.vless.flow.label")}),e.jsx(w,{children:e.jsxs(G,{onValueChange:g=>f.onChange(g==="none"?null:g),value:f.value||"none",children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vless.flow.placeholder")})}),e.jsx(B,{children:os.vless.flowOptions.map(g=>e.jsx(L,{value:g,children:g},g))})]})})]})})]})};return e.jsx(ce,{children:R[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()}),pt={id:null,code:"",name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null};function Wu(){const{t:s}=I("server"),{isOpen:n,setIsOpen:a,editingServer:l,setEditingServer:r,serverType:i,setServerType:c,refetch:m}=Hr(),[x,o]=u.useState([]),[d,p]=u.useState([]),[P,R]=u.useState([]),f=de({resolver:ue(Yu),defaultValues:pt,mode:"onChange"});u.useEffect(()=>{g()},[n]),u.useEffect(()=>{l?.type&&l.type!==i&&c(l.type)},[l,i,c]),u.useEffect(()=>{l?l.type===i&&f.reset({...pt,...l}):f.reset({...pt,protocol_settings:os[i].schema.parse({})})},[l,f,i]);const g=async()=>{if(!n)return;const[v,T,z]=await Promise.all([Ot(),Pr(),Tr()]);o(v.data?.map(Q=>({label:Q.name,value:Q.id.toString()}))||[]),p(T.data?.map(Q=>({label:Q.remarks,value:Q.id.toString()}))||[]),R(z.data||[])},S=u.useMemo(()=>P?.filter(v=>(v.parent_id===0||v.parent_id===null)&&v.type===i&&v.id!==f.watch("id")),[i,P,f]),j=()=>e.jsxs(_s,{children:[e.jsx(ws,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Se,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(ds,{align:"start",children:e.jsx(vc,{children:Ps.map(({type:v,label:T})=>e.jsx(pe,{onClick:()=>{c(v),a(!0)},className:"cursor-pointer",children:e.jsx(H,{variant:"outline",className:"text-white",style:{background:is[v]},children:T})},v))})})]}),C=()=>{a(!1),r(null),f.reset(pt)},k=async()=>{const v=f.getValues();(await Uc({...v,type:i})).data&&(C(),$.success(s("form.success")),m())};return e.jsxs(ge,{open:n,onOpenChange:C,children:[j(),e.jsxs(fe,{className:"sm:max-w-[425px]",children:[e.jsxs(be,{children:[e.jsx(je,{children:s(l?"form.edit_node":"form.new_node")}),e.jsx(Pe,{})]}),e.jsxs(xe,{...f,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{control:f.control,name:"name",render:({field:v})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(N,{children:s("form.name.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("form.name.placeholder"),...v})}),e.jsx(E,{})]})}),e.jsx(y,{control:f.control,name:"rate",render:({field:v})=>e.jsxs(b,{className:"flex-[1]",children:[e.jsx(N,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(w,{children:e.jsx(D,{type:"number",min:"0",step:"0.1",...v})})}),e.jsx(E,{})]})})]}),e.jsx(y,{control:f.control,name:"code",render:({field:v})=>e.jsxs(b,{children:[e.jsxs(N,{children:[s("form.code.label"),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:s("form.code.optional")})]}),e.jsx(w,{children:e.jsx(D,{placeholder:s("form.code.placeholder"),...v,value:v.value||""})}),e.jsx(E,{})]})}),e.jsx(y,{control:f.control,name:"tags",render:({field:v})=>e.jsxs(b,{children:[e.jsx(N,{children:s("form.tags.label")}),e.jsx(w,{children:e.jsx(ka,{value:v.value,onChange:v.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(E,{})]})}),e.jsx(y,{control:f.control,name:"group_ids",render:({field:v})=>e.jsxs(b,{children:[e.jsxs(N,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(Lt,{dialogTrigger:e.jsx(V,{variant:"link",children:s("form.groups.add")}),refetch:g})]}),e.jsx(w,{children:e.jsx(it,{options:x,onChange:T=>v.onChange(T.map(z=>z.value)),value:x?.filter(T=>v.value.includes(T.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(y,{control:f.control,name:"host",render:({field:v})=>e.jsxs(b,{children:[e.jsx(N,{children:s("form.host.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:s("form.host.placeholder"),...v})}),e.jsx(E,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(y,{control:f.control,name:"port",render:({field:v})=>e.jsxs(b,{className:"flex-1",children:[e.jsxs(N,{className:"flex items-center gap-1.5",children:[s("form.port.label"),e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(Se,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(wt,{children:e.jsx(te,{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(w,{children:e.jsx(D,{placeholder:s("form.port.placeholder"),...v})}),e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(V,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const T=v.value;T&&f.setValue("server_port",T)},children:e.jsx(Se,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(te,{side:"right",children:e.jsx("p",{children:s("form.port.sync")})})]})})]}),e.jsx(E,{})]})}),e.jsx(y,{control:f.control,name:"server_port",render:({field:v})=>e.jsxs(b,{className:"flex-1",children:[e.jsxs(N,{className:"flex items-center gap-1.5",children:[s("form.server_port.label"),e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(Se,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(wt,{children:e.jsx(te,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.server_port.tooltip")})})})]})})]}),e.jsx(w,{children:e.jsx(D,{placeholder:s("form.server_port.placeholder"),...v})}),e.jsx(E,{})]})})]})]}),n&&e.jsx(Gu,{serverType:i,value:f.watch("protocol_settings"),onChange:v=>f.setValue("protocol_settings",v,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(y,{control:f.control,name:"parent_id",render:({field:v})=>e.jsxs(b,{children:[e.jsx(N,{children:s("form.parent.label")}),e.jsxs(G,{onValueChange:v.onChange,value:v.value?.toString()||"0",children:[e.jsx(w,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:s("form.parent.placeholder")})})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:s("form.parent.none")}),S?.map(T=>e.jsx(L,{value:T.id.toString(),className:"cursor-pointer",children:T.name},T.id))]})]}),e.jsx(E,{})]})}),e.jsx(y,{control:f.control,name:"route_ids",render:({field:v})=>e.jsxs(b,{children:[e.jsx(N,{children:s("form.route.label")}),e.jsx(w,{children:e.jsx(it,{options:d,onChange:T=>v.onChange(T.map(z=>z.value)),value:d?.filter(T=>v.value.includes(T.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(Le,{className:"mt-6",children:[e.jsx(V,{type:"button",variant:"outline",onClick:C,children:s("form.cancel")}),e.jsx(V,{type:"submit",onClick:k,children:s("form.submit")})]})]})]})]})}function sn({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(rs,{children:[e.jsx(ls,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(mt,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ye,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{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(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(i=>r.has(i.value)).map(i=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Cs,{children:[e.jsx(Fs,{placeholder:n}),e.jsxs(Ss,{children:[e.jsx(Ms,{children:"No results found."}),e.jsx(Oe,{children:a.map(i=>{const c=r.has(i.value);return e.jsxs(ke,{onSelect:()=>{c?r.delete(i.value):r.add(i.value);const m=Array.from(r);s?.setFilterValue(m.length?m:void 0)},className:"cursor-pointer",children:[e.jsx("div",{className:_("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(Rs,{className:_("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)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Gs,{}),e.jsx(Oe,{children:e.jsx(ke,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Ju=[{value:Ne.Shadowsocks,label:Ps.find(s=>s.type===Ne.Shadowsocks)?.label,color:is[Ne.Shadowsocks]},{value:Ne.Vmess,label:Ps.find(s=>s.type===Ne.Vmess)?.label,color:is[Ne.Vmess]},{value:Ne.Trojan,label:Ps.find(s=>s.type===Ne.Trojan)?.label,color:is[Ne.Trojan]},{value:Ne.Hysteria,label:Ps.find(s=>s.type===Ne.Hysteria)?.label,color:is[Ne.Hysteria]},{value:Ne.Vless,label:Ps.find(s=>s.type===Ne.Vless)?.label,color:is[Ne.Vless]}];function Qu({table:s,saveOrder:n,isSortMode:a,groups:l}){const r=s.getState().columnFilters.length>0,{t:i}=I("server"),c=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(Wu,{}),e.jsx(D,{placeholder:i("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(sn,{column:s.getColumn("type"),title:i("toolbar.type"),options:Ju}),s.getColumn("groups")&&e.jsx(sn,{column:s.getColumn("groups"),title:i("columns.groups.title"),options:c})]}),r&&e.jsxs(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[i("toolbar.reset"),e.jsx(Ae,{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:i("toolbar.sort.tip")})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(V,{variant:a?"default":"outline",onClick:n,size:"sm",children:i(a?"toolbar.sort.save":"toolbar.sort.edit")})})]})}const ct=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"})}),gt={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"},Zu=s=>{const{t:n}=I("server");return[{id:"drag-handle",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.sort")}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Vt,{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(O,{column:a,title:n("columns.nodeId")}),cell:({row:a})=>{const l=a.getValue("id"),r=a.original.code;return e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(H,{variant:"outline",className:_("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:is[a.original.type]},children:[e.jsx(er,{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(V,{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:i=>{i.stopPropagation(),kt(r||l.toString()).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(Ha,{className:"size-3"})})]})}),e.jsxs(te,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[Ps.find(i=>i.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(O,{column:a,title:n("columns.show")}),cell:({row:a})=>{const[l,r]=u.useState(!!a.getValue("show"));return e.jsx(K,{checked:l,onCheckedChange:async i=>{r(i),Yc({id:a.original.id,type:a.original.type,show:i?1:0}).catch(()=>{r(!i),s()})},style:{backgroundColor:l?is[a.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(O,{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:_("h-2.5 w-2.5 rounded-full",gt[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:_("h-2.5 w-2.5 rounded-full",gt[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:_("h-2.5 w-2.5 rounded-full",gt[2])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.2")})]})]})})}),cell:({row:a})=>e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{children:e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:_("size-2.5 flex-shrink-0 rounded-full transition-all duration-200",gt[a.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:a.getValue("name")})]})}),e.jsx(te,{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(O,{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(ce,{delayDuration:0,children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(V,{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:i=>{i.stopPropagation(),kt(l).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(Ha,{className:"size-3"})})}),e.jsx(te,{side:"top",sideOffset:10,children:n("columns.copyAddress")})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:a})=>e.jsx(O,{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(ct,{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(O,{column:a,title:n("columns.rate.title"),tooltip:n("columns.rate.tooltip")}),cell:({row:a})=>e.jsxs(H,{variant:"secondary",className:"font-medium",children:[a.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"groups",header:({column:a})=>e.jsx(O,{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,i)=>e.jsx(H,{variant:"secondary",className:_("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},i)):e.jsx("span",{className:"text-sm text-muted-foreground",children:n("columns.groups.empty")})})},enableSorting:!1,size:600,filterFn:(a,l,r)=>{const i=a.getValue(l);return i?r.some(c=>i.includes(c)):!1}},{accessorKey:"type",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.type")}),cell:({row:a})=>{const l=a.getValue("type");return e.jsx(H,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:is[l]},children:l})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:a})=>e.jsx(O,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>{const{setIsOpen:l,setEditingServer:r,setServerType:i}=Hr();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(_s,{modal:!1,children:[e.jsx(ws,{asChild:!0,children:e.jsx(V,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":n("columns.actions"),children:e.jsx(Ct,{className:"size-4"})})}),e.jsxs(ds,{align:"end",className:"w-40",children:[e.jsx(pe,{className:"cursor-pointer",onClick:()=>{i(a.original.type),r(a.original),l(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(ki,{className:"mr-2 size-4"}),n("columns.actions_dropdown.edit")]})}),e.jsxs(pe,{className:"cursor-pointer",onClick:async()=>{Gc({id:a.original.id}).then(({data:c})=>{c&&($.success(n("columns.actions_dropdown.copy_success")),s())})},children:[e.jsx(Ti,{className:"mr-2 size-4"}),n("columns.actions_dropdown.copy")]}),e.jsx(lt,{}),e.jsx(pe,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:c=>c.preventDefault(),children:e.jsx(Ue,{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()=>{Bc({id:a.original.id}).then(({data:c})=>{c&&($.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 Xu(){const[s,n]=u.useState({}),[a,l]=u.useState({"drag-handle":!1}),[r,i]=u.useState([]),[c,m]=u.useState({pageSize:500,pageIndex:0}),[x,o]=u.useState([]),[d,p]=u.useState(!1),[P,R]=u.useState({}),[f,g]=u.useState([]),{refetch:S}=se({queryKey:["nodeList"],queryFn:async()=>{const{data:z}=await Tr();return g(z),z}}),j=u.useMemo(()=>{const z=new Set;return f.forEach(Q=>{Q.groups&&Q.groups.forEach(q=>z.add(q.name))}),Array.from(z).sort()},[f]);u.useEffect(()=>{l({"drag-handle":d,show:!d,host:!d,online:!d,rate:!d,groups:!d,type:!1,actions:!d}),R({name:d?2e3:200}),m({pageSize:d?99999:500,pageIndex:0})},[d]);const C=(z,Q)=>{d&&(z.dataTransfer.setData("text/plain",Q.toString()),z.currentTarget.classList.add("opacity-50"))},k=(z,Q)=>{if(!d)return;z.preventDefault(),z.currentTarget.classList.remove("bg-muted");const q=parseInt(z.dataTransfer.getData("text/plain"));if(q===Q)return;const X=[...f],[Ys]=X.splice(q,1);X.splice(Q,0,Ys),g(X)},v=async()=>{if(!d){p(!0);return}const z=f?.map((Q,q)=>({id:Q.id,order:q+1}));Wc(z).then(()=>{$.success("排序保存成功"),p(!1),S()}).finally(()=>{p(!1)})},T=He({data:f||[],columns:Zu(S),state:{sorting:x,columnVisibility:a,rowSelection:s,columnFilters:r,columnSizing:P,pagination:c},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:o,onColumnFiltersChange:i,onColumnVisibilityChange:l,onColumnSizingChange:R,onPaginationChange:m,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),getSortedRowModel:Ze(),getFacetedRowModel:us(),getFacetedUniqueValues:xs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Fu,{refetch:S,children:e.jsx("div",{className:"space-y-4",children:e.jsx(es,{table:T,toolbar:z=>e.jsx(Qu,{table:z,refetch:S,saveOrder:v,isSortMode:d,groups:j}),draggable:d,onDragStart:C,onDragEnd:z=>z.currentTarget.classList.remove("opacity-50"),onDragOver:z=>{z.preventDefault(),z.currentTarget.classList.add("bg-muted")},onDragLeave:z=>z.currentTarget.classList.remove("bg-muted"),onDrop:k,showPagination:!d})})})}function ex(){const{t:s}=I("server");return e.jsxs(we,{children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(Xu,{})})]})]})}const sx=Object.freeze(Object.defineProperty({__proto__:null,default:ex},Symbol.toStringTag,{value:"Module"}));function tx({table:s,refetch:n}){const a=s.getState().columnFilters.length>0,{t:l}=I("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(Lt,{refetch:n}),e.jsx(D,{placeholder:l("toolbar.searchPlaceholder"),value:s.getColumn("name")?.getFilterValue()??"",onChange:r=>s.getColumn("name")?.setFilterValue(r.target.value),className:_("h-8 w-[150px] lg:w-[250px]",a&&"border-primary/50 ring-primary/20")}),a&&e.jsxs(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(Ae,{className:"ml-2 h-4 w-4"})]})]})})}const ax=s=>{const{t:n}=I("group");return[{accessorKey:"id",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.id")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(H,{variant:"outline",children:a.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:a})=>e.jsx(O,{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(O,{column:a,title:n("columns.usersCount")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(ct,{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(O,{column:a,title:n("columns.serverCount")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(er,{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(O,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Lt,{defaultValues:a.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Is,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(Ue,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{Qc({id:a.original.id}).then(({data:l})=>{l&&($.success(n("messages.updateSuccess")),s())})},children:e.jsxs(V,{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 nx(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,i]=u.useState([]),[c,m]=u.useState([]),{data:x,refetch:o,isLoading:d}=se({queryKey:["serverGroupList"],queryFn:async()=>{const{data:P}=await Ot();return P}}),p=He({data:x||[],columns:ax(o),state:{sorting:c,columnVisibility:a,rowSelection:s,columnFilters:r},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:i,onColumnVisibilityChange:l,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),getSortedRowModel:Ze(),getFacetedRowModel:us(),getFacetedUniqueValues:xs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(es,{table:p,toolbar:P=>e.jsx(tx,{table:P,refetch:o}),isLoading:d})}function rx(){const{t:s}=I("group");return e.jsxs(we,{children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(nx,{})})]})]})}const lx=Object.freeze(Object.defineProperty({__proto__:null,default:rx},Symbol.toStringTag,{value:"Module"})),ox=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 Kr({refetch:s,dialogTrigger:n,defaultValues:a={remarks:"",match:[],action:"block",action_value:""},type:l="add"}){const{t:r}=I("route"),i=de({resolver:ue(ox(r)),defaultValues:a,mode:"onChange"}),[c,m]=u.useState(!1);return e.jsxs(ge,{open:c,onOpenChange:m,children:[e.jsx(ze,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Se,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add")})]})}),e.jsxs(fe,{className:"sm:max-w-[425px]",children:[e.jsxs(be,{children:[e.jsx(je,{children:r(l==="edit"?"form.edit":"form.create")}),e.jsx(Pe,{})]}),e.jsxs(xe,{...i,children:[e.jsx(y,{control:i.control,name:"remarks",render:({field:x})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(N,{children:r("form.remarks")}),e.jsx("div",{className:"relative",children:e.jsx(w,{children:e.jsx(D,{type:"text",placeholder:r("form.remarksPlaceholder"),...x})})}),e.jsx(E,{})]})}),e.jsx(y,{control:i.control,name:"match",render:({field:x})=>e.jsxs(b,{className:"flex-[2]",children:[e.jsx(N,{children:r("form.match")}),e.jsx("div",{className:"relative",children:e.jsx(w,{children:e.jsx(ps,{className:"min-h-[120px]",placeholder:r("form.matchPlaceholder"),value:x.value.join(` +`).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(K,{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(K,{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(K,{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(Ne,{}),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]=m.useState(!1),l=m.useRef(null),r=ue({resolver:he(vm),defaultValues:bm,mode:"onBlur"}),{data:c}=te({queryKey:["settings","subscribe"],queryFn:()=>gs("subscribe")}),{mutateAsync:i}=ls({mutationFn:js,onSuccess:o=>{o.data&&$.success(s("common.autoSaved"))}});m.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 u=m.useCallback(be.debounce(async o=>{if(!be.isEqual(o,l.current)){a(!0);try{await i(o),l.current=o}finally{a(!1)}}},1e3),[i]),x=m.useCallback(o=>{u(o)},[u]);return m.useEffect(()=>{const o=r.watch(d=>{x(d)});return()=>o.unsubscribe()},[r.watch,x]),e.jsx(fe,{...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(K,{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(W,{onValueChange:o.onChange,value:o.value?.toString()||"0",children:[e.jsx(_,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择重置方式"})})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:s("subscribe.reset_traffic_method.options.monthly_first")}),e.jsx(A,{value:"1",children:s("subscribe.reset_traffic_method.options.monthly_reset")}),e.jsx(A,{value:"2",children:s("subscribe.reset_traffic_method.options.no_reset")}),e.jsx(A,{value:"3",children:s("subscribe.reset_traffic_method.options.yearly_first")}),e.jsx(A,{value:"4",children:s("subscribe.reset_traffic_method.options.yearly_reset")})]})]}),e.jsx(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(K,{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(W,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:s("subscribe.new_order_event.options.no_action")}),e.jsx(A,{value:"1",children:s("subscribe.new_order_event.options.reset_traffic")})]})]})})}),e.jsx(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(W,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:s("subscribe.renew_order_event.options.no_action")}),e.jsx(A,{value:"1",children:s("subscribe.renew_order_event.options.reset_traffic")})]})]})})}),e.jsx(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(W,{onValueChange:o.onChange,value:o.value?.toString(),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择"})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:s("subscribe.change_order_event.options.no_action")}),e.jsx(A,{value:"1",children:s("subscribe.change_order_event.options.reset_traffic")})]})]})})}),e.jsx(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(K,{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(K,{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(Ne,{}),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]=m.useState(!1),l=m.useRef(null),r=ue({resolver:he(wm),defaultValues:Cm,mode:"onBlur"}),{data:c}=te({queryKey:["settings","invite"],queryFn:()=>gs("invite")}),{mutateAsync:i}=ls({mutationFn:js,onSuccess:o=>{o.data&&$.success(s("common.autoSaved"))}});m.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 u=m.useCallback(be.debounce(async o=>{if(!be.isEqual(o,l.current)){a(!0);try{await i(o),l.current=o}finally{a(!1)}}},1e3),[i]),x=m.useCallback(o=>{u(o)},[u]);return m.useEffect(()=>{const o=r.watch(d=>{x(d)});return()=>o.unsubscribe()},[r.watch,x]),e.jsx(fe,{...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(K,{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(K,{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(K,{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(K,{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(K,{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(K,{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(Ne,{}),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}=te({queryKey:["settings","frontend"],queryFn:()=>gs("frontend")}),n=ue({resolver:he(Pm),defaultValues:Dm,mode:"onChange"});m.useEffect(()=>{if(s?.data?.frontend){const l=s?.data?.frontend;Object.entries(l).forEach(([r,c])=>{n.setValue(r,c)})}},[s]);function a(l){js(l).then(({data:r})=>{r&&$.success("更新成功")})}return e.jsx(fe,{...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(K,{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(K,{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(Zs({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(V,{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(Ne,{}),e.jsx(Em,{})]})}const Vm=Object.freeze(Object.defineProperty({__proto__:null,default:Rm},Symbol.toStringTag,{value:"Module"})),Im=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]=m.useState(!1),l=m.useRef(null),r=ue({resolver:he(Im),defaultValues:Fm,mode:"onBlur"}),{data:c}=te({queryKey:["settings","server"],queryFn:()=>gs("server")}),{mutateAsync:i}=ls({mutationFn:js,onSuccess:d=>{d.data&&$.success(s("common.AutoSaved"))}});m.useEffect(()=>{if(c?.data.server){const d=c.data.server;Object.entries(d).forEach(([p,T])=>{r.setValue(p,T)}),l.current=d}},[c]);const u=m.useCallback(be.debounce(async d=>{if(!be.isEqual(d,l.current)){a(!0);try{await i(d),l.current=d}finally{a(!1)}}},1e3),[i]),x=m.useCallback(d=>{u(d)},[u]);m.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 T="";for(let R=0;Re.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(me,{children:e.jsxs(ce,{children:[e.jsx(de,{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(),o()},children:e.jsx(ci,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(re,{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 T=p.target.value?Number(p.target.value):null;d.onChange(T)}})}),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 T=p.target.value?Number(p.target.value):null;d.onChange(T)}})}),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(W,{onValueChange:d.onChange,value:d.value?.toString()||"0",children:[e.jsx(_,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:s("server.device_limit_mode.placeholder")})})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:s("server.device_limit_mode.strict")}),e.jsx(A,{value:"1",children:s("server.device_limit_mode.relaxed")})]})]}),e.jsx(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(Ne,{}),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(je,{open:s,onOpenChange:n,children:e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(ye,{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(ve,{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(Js,{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]=m.useState(null),[l,r]=m.useState(!1),c=m.useRef(null),[i,u]=m.useState(!1),x=ue({resolver:he(Am),defaultValues:{},mode:"onBlur"}),{data:o}=te({queryKey:["settings","email"],queryFn:()=>gs("email")}),{data:d}=te({queryKey:["emailTemplate"],queryFn:()=>Od()}),{mutateAsync:p}=ls({mutationFn:js,onSuccess:S=>{S.data&&$.success(s("common.autoSaved"))}}),{mutate:T,isPending:R}=ls({mutationFn:zd,onMutate:()=>{a(null),r(!1)},onSuccess:S=>{a(S.data),r(!0),S.data.error?$.error(s("email.test.error")):$.success(s("email.test.success"))}});m.useEffect(()=>{if(o?.data.email){const S=o.data.email;Object.entries(S).forEach(([j,C])=>{x.setValue(j,C)}),c.current=S}},[o]);const f=m.useCallback(be.debounce(async S=>{if(!be.isEqual(S,c.current)){u(!0);try{await p(S),c.current=S}finally{u(!1)}}},1e3),[p]),g=m.useCallback(S=>{f(S)},[f]);return m.useEffect(()=>{const S=x.watch(j=>{g(j)});return()=>S.unsubscribe()},[x.watch,g]),e.jsxs(e.Fragment,{children:[e.jsx(fe,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:x.control,name:"email_host",render:({field:S})=>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"),...S,value:S.value||""})}),e.jsx(M,{children:s("email.email_host.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_port",render:({field:S})=>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"),...S,value:S.value||"",onChange:j=>{const C=j.target.value?Number(j.target.value):null;S.onChange(C)}})}),e.jsx(M,{children:s("email.email_port.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_encryption",render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_encryption.title")}),e.jsxs(W,{onValueChange:S.onChange,value:S.value||"none",children:[e.jsx(_,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:"请选择加密方式"})})}),e.jsxs(B,{children:[e.jsx(A,{value:"none",children:s("email.email_encryption.none")}),e.jsx(A,{value:"ssl",children:s("email.email_encryption.ssl")}),e.jsx(A,{value:"tls",children:s("email.email_encryption.tls")})]})]}),e.jsx(M,{children:s("email.email_encryption.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_username",render:({field:S})=>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"),...S,value:S.value||""})}),e.jsx(M,{children:s("email.email_username.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_password",render:({field:S})=>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"),...S,value:S.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:S})=>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"),...S,value:S.value||""})}),e.jsx(M,{children:s("email.email_from.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"email_template",render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("email.email_template.title")}),e.jsxs(W,{onValueChange:j=>{S.onChange(j),g(x.getValues())},value:S.value||void 0,children:[e.jsx(_,{children:e.jsx(U,{className:"w-[200px]",children:e.jsx(Y,{placeholder:s("email.email_template.placeholder")})})}),e.jsx(B,{children:d?.data?.map(j=>e.jsx(A,{value:j,children:j},j))})]}),e.jsx(M,{children:s("email.email_template.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"remind_mail_enable",render:({field:S})=>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(K,{checked:S.value||!1,onCheckedChange:j=>{S.onChange(j),g(x.getValues())}})})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(V,{onClick:()=>T(),loading:R,disabled:R,children:s(R?"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(Ne,{}),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]=m.useState(!1),l=m.useRef(null),r=ue({resolver:he(Km),defaultValues:Um,mode:"onBlur"}),{data:c}=te({queryKey:["settings","telegram"],queryFn:()=>gs("telegram")}),{mutateAsync:i}=ls({mutationFn:js,onSuccess:p=>{p.data&&$.success(s("common.autoSaved"))}}),{mutate:u,isPending:x}=ls({mutationFn:Ld,onSuccess:p=>{p.data&&$.success(s("telegram.webhook.success"))}});m.useEffect(()=>{if(c?.data.telegram){const p=c.data.telegram;Object.entries(p).forEach(([T,R])=>{r.setValue(T,R)}),l.current=p}},[c]);const o=m.useCallback(be.debounce(async p=>{if(!be.isEqual(p,l.current)){a(!0);try{await i(p),l.current=p}finally{a(!1)}}},1e3),[i]),d=m.useCallback(p=>{o(p)},[o]);return m.useEffect(()=>{const p=r.watch(T=>{d(T)});return()=>p.unsubscribe()},[r.watch,d]),e.jsx(fe,{...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(V,{loading:x,disabled:x,onClick:()=>u(),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(K,{checked:p.value||!1,onCheckedChange:T=>{p.onChange(T),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(Ne,{}),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]=m.useState(!1),l=m.useRef(null),r=ue({resolver:he(Ym),defaultValues:Qm,mode:"onBlur"}),{data:c}=te({queryKey:["settings","app"],queryFn:()=>gs("app")}),{mutateAsync:i}=ls({mutationFn:js,onSuccess:o=>{o.data&&$.success(s("app.save_success"))}});m.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 u=m.useCallback(be.debounce(async o=>{if(!be.isEqual(o,l.current)){a(!0);try{await i(o),l.current=o}finally{a(!1)}}},1e3),[i]),x=m.useCallback(o=>{u(o)},[u]);return m.useEffect(()=>{const o=r.watch(d=>{x(d)});return()=>o.unsubscribe()},[r.watch,x]),e.jsx(fe,{...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(Ne,{}),e.jsx(Jm,{})]})}const Xm=Object.freeze(Object.defineProperty({__proto__:null,default:Zm},Symbol.toStringTag,{value:"Module"})),ba=m.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=m.forwardRef(({className:s,...n},a)=>e.jsx("thead",{ref:a,className:N("[&_tr]:border-b",s),...n}));ya.displayName="TableHeader";const Na=m.forwardRef(({className:s,...n},a)=>e.jsx("tbody",{ref:a,className:N("[&_tr:last-child]:border-0",s),...n}));Na.displayName="TableBody";const eu=m.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 ws=m.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}));ws.displayName="TableRow";const _a=m.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 Ws=m.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}));Ws.displayName="TableCell";const su=m.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]=m.useState(""),{t:l}=F("common");m.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(W,{value:`${s.getState().pagination.pageSize}`,onValueChange:c=>{s.setPageSize(Number(c))},children:[e.jsx(U,{className:"h-8 w-[70px]",children:e.jsx(Y,{placeholder:s.getState().pagination.pageSize})}),e.jsx(B,{side:"top",children:[10,20,30,40,50,100,500].map(c=>e.jsx(A,{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(V,{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(V,{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(V,{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(V,{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 as({table:s,toolbar:n,draggable:a=!1,onDragStart:l,onDragEnd:r,onDragOver:c,onDragLeave:i,onDrop:u,showPagination:x=!0,isLoading:o=!1}){const{t:d}=F("common"),p=m.useRef(null),T=s.getAllColumns().filter(S=>S.getIsPinned()==="left"),R=s.getAllColumns().filter(S=>S.getIsPinned()==="right"),f=S=>T.slice(0,S).reduce((j,C)=>j+(C.getSize()??0),0),g=S=>R.slice(S+1).reduce((j,C)=>j+(C.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(S=>e.jsx(ws,{className:"hover:bg-transparent",children:S.headers.map((j,C)=>{const P=j.column.getIsPinned()==="left",w=j.column.getIsPinned()==="right",k=P?f(T.indexOf(j.column)):void 0,L=w?g(R.indexOf(j.column)):void 0;return e.jsx(_a,{colSpan:j.colSpan,style:{width:j.getSize(),...P&&{left:k},...w&&{right:L}},className:N("h-11 bg-card px-4 text-muted-foreground",(P||w)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",P&&"before:right-0",w&&"before:left-0"]),children:j.isPlaceholder?null:kt(j.column.columnDef.header,j.getContext())},j.id)})},S.id))}),e.jsx(Na,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((S,j)=>e.jsx(ws,{"data-state":S.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:a,onDragStart:C=>l?.(C,j),onDragEnd:r,onDragOver:c,onDragLeave:i,onDrop:C=>u?.(C,j),children:S.getVisibleCells().map((C,P)=>{const w=C.column.getIsPinned()==="left",k=C.column.getIsPinned()==="right",L=w?f(T.indexOf(C.column)):void 0,J=k?g(R.indexOf(C.column)):void 0;return e.jsx(Ws,{style:{width:C.column.getSize(),...w&&{left:L},...k&&{right:J}},className:N("bg-card",(w||k)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",w&&"before:right-0",k&&"before:left-0"]),children:kt(C.column.columnDef.cell,C.getContext())},C.id)})},S.id)):e.jsx(ws,{children:e.jsx(Ws,{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]=m.useState(!1),[u,x]=m.useState(!1),[o,d]=m.useState([]),[p,T]=m.useState([]),R=au(r),f=ue({resolver:he(R),defaultValues:l,mode:"onChange"}),g=f.watch("payment");m.useEffect(()=>{c&&(async()=>{const{data:C}=await td();d(C)})()},[c]),m.useEffect(()=>{if(!g||!c)return;(async()=>{const C={payment:g,...a==="edit"&&{id:Number(f.getValues("id"))}};ad(C).then(({data:P})=>{T(P);const w=P.reduce((k,L)=>(L.field_name&&(k[L.field_name]=L.value??""),k),{});f.setValue("config",w)})})()},[g,c,f,a]);const S=async j=>{x(!0);try{(await nd(j)).data&&($.success(r("form.messages.success")),f.reset(Xa),s(),i(!1))}finally{x(!1)}};return e.jsxs(je,{open:c,onOpenChange:i,children:[e.jsx($e,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ke,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add.button")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsx(ye,{children:e.jsx(ve,{children:r(a==="add"?"form.add.title":"form.edit.title")})}),e.jsx(fe,{...f,children:e.jsxs("form",{onSubmit:f.handleSubmit(S),className:"space-y-4",children:[e.jsx(b,{control:f.control,name:"name",render:({field:j})=>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"),...j})}),e.jsx(M,{children:r("form.fields.name.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"icon",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.icon.label")}),e.jsx(_,{children:e.jsx(D,{...j,value:j.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:j})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.notify_domain.label")}),e.jsx(_,{children:e.jsx(D,{...j,value:j.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:j})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.handling_fee_percent.label")}),e.jsx(_,{children:e.jsx(D,{type:"number",...j,value:j.value||"",placeholder:r("form.fields.handling_fee_percent.placeholder")})}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"handling_fee_fixed",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.handling_fee_fixed.label")}),e.jsx(_,{children:e.jsx(D,{type:"number",...j,value:j.value||"",placeholder:r("form.fields.handling_fee_fixed.placeholder")})}),e.jsx(E,{})]})})]}),e.jsx(b,{control:f.control,name:"payment",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.fields.payment.label")}),e.jsxs(W,{onValueChange:j.onChange,defaultValue:j.value,children:[e.jsx(_,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:r("form.fields.payment.placeholder")})})}),e.jsx(B,{children:o.map(C=>e.jsx(A,{value:C,children:C},C))})]}),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(j=>e.jsx(b,{control:f.control,name:`config.${j.field_name}`,render:({field:C})=>e.jsxs(v,{children:[e.jsx(y,{children:j.label}),e.jsx(_,{children:e.jsx(D,{...C,value:C.value||""})}),e.jsx(E,{})]})},j.field_name))}),e.jsxs(qe,{children:[e.jsx(pt,{asChild:!0,children:e.jsx(V,{type:"button",variant:"outline",children:r("form.buttons.cancel")})}),e.jsx(V,{type:"submit",disabled:u,children:r("form.buttons.submit")})]})]})})]})]})}function O({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(V,{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(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(qa,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(re,{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(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{children:e.jsx(qa,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(re,{children:a})]})})]})}const Mr=xi,Or=hi,nu=fi,zr=m.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=m.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=m.forwardRef(({className:s,...n},a)=>e.jsx(Zn,{ref:a,className:N("text-lg font-semibold",s),...n}));ka.displayName=Zn.displayName;const Ta=m.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=m.forwardRef(({className:s,...n},a)=>e.jsx(er,{ref:a,className:N(Qs(),s),...n}));Pa.displayName=er.displayName;const Da=m.forwardRef(({className:s,...n},a)=>e.jsx(sr,{ref:a,className:N(Qs({variant:"outline"}),"mt-2 sm:mt-0",s),...n}));Da.displayName=sr.displayName;function We({onConfirm:s,children:n,title:a="确认操作",description:l="确定要执行此操作吗?",cancelText:r="取消",confirmText:c="确认",variant:i="default",className:u}){return e.jsxs(Mr,{children:[e.jsx(Or,{asChild:!0,children:n}),e.jsxs(wa,{className:N("sm:max-w-[425px]",u),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(V,{variant:"outline",children:r})}),e.jsx(Pa,{asChild:!0,children:e.jsx(V,{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(Ot,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(O,{column:l,title:a("table.columns.id")}),cell:({row:l})=>e.jsx(H,{variant:"outline",children:l.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:l})=>e.jsx(O,{column:l,title:a("table.columns.enable")}),cell:({row:l})=>e.jsx(K,{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(O,{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(O,{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(O,{column:l,title:a("table.columns.notify_url")}),e.jsx(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{className:"ml-1",children:e.jsx(Lr,{className:"h-4 w-4"})}),e.jsx(re,{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(O,{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(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(zs,{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(We,{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(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(os,{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(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[r("table.toolbar.reset"),e.jsx(He,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(V,{variant:l?"default":"outline",onClick:a,size:"sm",children:r(l?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}function ou(){const[s,n]=m.useState([]),[a,l]=m.useState([]),[r,c]=m.useState(!1),[i,u]=m.useState([]),[x,o]=m.useState({"drag-handle":!1}),[d,p]=m.useState({pageSize:20,pageIndex:0}),{refetch:T}=te({queryKey:["paymentList"],queryFn:async()=>{const{data:j}=await sd();return u(j?.map(C=>({...C,enable:!!C.enable}))||[]),j}});m.useEffect(()=>{o({"drag-handle":r,actions:!r}),p({pageSize:r?99999:10,pageIndex:0})},[r]);const R=(j,C)=>{r&&(j.dataTransfer.setData("text/plain",C.toString()),j.currentTarget.classList.add("opacity-50"))},f=(j,C)=>{if(!r)return;j.preventDefault(),j.currentTarget.classList.remove("bg-muted");const P=parseInt(j.dataTransfer.getData("text/plain"));if(P===C)return;const w=[...i],[k]=w.splice(P,1);w.splice(C,0,k),u(w)},g=async()=>{r?od({ids:i.map(j=>j.id)}).then(()=>{T(),c(!1),$.success("排序保存成功")}):c(!0)},S=Be({data:i,columns:ru({refetch:T,isSortMode:r}),state:{sorting:a,columnFilters:s,columnVisibility:x,pagination:d},onSortingChange:l,onColumnFiltersChange:n,onColumnVisibilityChange:o,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),getSortedRowModel:ss(),initialState:{columnPinning:{right:["actions"]}},pageCount:r?1:void 0});return e.jsx(as,{table:S,toolbar:j=>e.jsx(lu,{table:j,refetch:T,saveOrder:g,isSortMode:r}),draggable:r,onDragStart:R,onDragEnd:j=>j.currentTarget.classList.remove("opacity-50"),onDragOver:j=>{j.preventDefault(),j.currentTarget.classList.add("bg-muted")},onDragLeave:j=>j.currentTarget.classList.remove("bg-muted"),onDrop:f,showPagination:!r})}function iu(){const{t:s}=F("payment");return e.jsxs(Ce,{children:[e.jsxs(Se,{className:"flex items-center justify-between",children:[e.jsx(Oe,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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]=m.useState(!0),[i,u]=m.useState(!1),[x,o]=m.useState(null),d=pi({config:gi(ji())}),p=ue({resolver:he(d),defaultValues:{config:{}}});m.useEffect(()=>{(async()=>{try{const{data:g}=await Is.getPluginConfig(s);o(g),p.reset({config:Object.fromEntries(Object.entries(g).map(([S,j])=>[S,j.value]))})}catch{$.error(l("messages.configLoadError"))}finally{c(!1)}})()},[s]);const T=async f=>{u(!0);try{await Is.updatePluginConfig(s,f.config),$.success(l("messages.configSaveSuccess")),a()}catch{$.error(l("messages.configSaveError"))}finally{u(!1)}},R=(f,g)=>{switch(g.type){case"string":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{children:g.label||g.description}),e.jsx(_,{children:e.jsx(D,{placeholder:g.placeholder,...S})}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description}),e.jsx(E,{})]})},f);case"number":case"percentage":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{children:g.label||g.description}),e.jsx(_,{children:e.jsxs("div",{className:"relative",children:[e.jsx(D,{type:"number",placeholder:g.placeholder,...S,onChange:j=>{const C=Number(j.target.value);g.type==="percentage"?S.onChange(Math.min(100,Math.max(0,C))):S.onChange(C)},className:g.type==="percentage"?"pr-8":"",min:g.type==="percentage"?0:void 0,max:g.type==="percentage"?100:void 0,step:g.type==="percentage"?1:void 0}),g.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"})})]})}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description}),e.jsx(E,{})]})},f);case"select":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{children:g.label||g.description}),e.jsxs(W,{onValueChange:S.onChange,defaultValue:S.value,children:[e.jsx(_,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:g.placeholder})})}),e.jsx(B,{children:g.options?.map(j=>e.jsx(A,{value:j.value,children:j.label},j.value))})]}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description}),e.jsx(E,{})]})},f);case"boolean":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:S})=>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:g.label||g.description}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description})]}),e.jsx(_,{children:e.jsx(K,{checked:S.value,onCheckedChange:S.onChange})})]})},f);case"text":return e.jsx(b,{control:p.control,name:`config.${f}`,render:({field:S})=>e.jsxs(v,{children:[e.jsx(y,{children:g.label||g.description}),e.jsx(_,{children:e.jsx(vs,{placeholder:g.placeholder,...S})}),g.description&&g.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:g.description}),e.jsx(E,{})]})},f);default:return null}};return r?e.jsxs("div",{className:"space-y-4",children:[e.jsx(ae,{className:"h-4 w-[200px]"}),e.jsx(ae,{className:"h-10 w-full"}),e.jsx(ae,{className:"h-4 w-[200px]"}),e.jsx(ae,{className:"h-10 w-full"})]}):e.jsx(fe,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(T),className:"space-y-4",children:[x&&Object.entries(x).map(([f,g])=>R(f,g)),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(V,{type:"button",variant:"outline",onClick:n,disabled:i,children:l("config.cancel")}),e.jsx(V,{type:"submit",loading:i,disabled:i,children:l("config.save")})]})]})})}function mu(){const{t:s}=F("plugin"),[n,a]=m.useState(null),[l,r]=m.useState(!1),[c,i]=m.useState(null),[u,x]=m.useState(""),[o,d]=m.useState("all"),{data:p,isLoading:T,refetch:R}=te({queryKey:["pluginList"],queryFn:async()=>{const{data:w}=await Is.getPluginList();return w}}),f=p?["all",...new Set(p.map(w=>w.category||"other"))]:["all"],g=p?.filter(w=>{const k=w.name.toLowerCase().includes(u.toLowerCase())||w.description.toLowerCase().includes(u.toLowerCase())||w.code.toLowerCase().includes(u.toLowerCase()),L=o==="all"||w.category===o;return k&&L}),S=async w=>{a(w),Is.installPlugin(w).then(()=>{$.success(s("messages.installSuccess")),R()}).catch(k=>{$.error(k.message||s("messages.installError"))}).finally(()=>{a(null)})},j=async w=>{a(w),Is.uninstallPlugin(w).then(()=>{$.success(s("messages.uninstallSuccess")),R()}).catch(k=>{$.error(k.message||s("messages.uninstallError"))}).finally(()=>{a(null)})},C=async(w,k)=>{a(w),(k?Is.disablePlugin:Is.enablePlugin)(w).then(()=>{$.success(s(k?"messages.disableSuccess":"messages.enableSuccess")),R()}).catch(J=>{$.error(J.message||s(k?"messages.disableError":"messages.enableError"))}).finally(()=>{a(null)})},P=w=>{p?.find(k=>k.code===w),i(w),r(!0)};return e.jsxs(Ce,{children:[e.jsxs(Se,{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(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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:u,onChange:w=>x(w.target.value),className:"pl-9"})]}),e.jsxs(W,{value:o,onValueChange:d,children:[e.jsx(U,{className:"w-[180px]",children:e.jsx(Y,{placeholder:s("category.placeholder")})}),e.jsx(B,{children:f.map(w=>e.jsx(A,{value:w,children:s(`category.${w}`)},w))})]})]}),e.jsxs(va,{defaultValue:"all",className:"w-full",children:[e.jsxs(qt,{children:[e.jsx(Cs,{value:"all",children:s("tabs.all")}),e.jsx(Cs,{value:"installed",children:s("tabs.installed")}),e.jsx(Cs,{value:"available",children:s("tabs.available")})]}),e.jsx(Ct,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:T?e.jsxs(e.Fragment,{children:[e.jsx(Yt,{}),e.jsx(Yt,{}),e.jsx(Yt,{})]}):g?.map(w=>e.jsx(Wt,{plugin:w,onInstall:S,onUninstall:j,onToggleEnable:C,onOpenConfig:P,isLoading:n===w.name},w.name))})}),e.jsx(Ct,{value:"installed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:g?.filter(w=>w.is_installed).map(w=>e.jsx(Wt,{plugin:w,onInstall:S,onUninstall:j,onToggleEnable:C,onOpenConfig:P,isLoading:n===w.name},w.name))})}),e.jsx(Ct,{value:"available",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:g?.filter(w=>!w.is_installed).map(w=>e.jsx(Wt,{plugin:w,onInstall:S,onUninstall:j,onToggleEnable:C,onOpenConfig:P,isLoading:n===w.name},w.code))})})]})]}),e.jsx(je,{open:l,onOpenChange:r,children:e.jsxs(pe,{className:"sm:max-w-lg",children:[e.jsxs(ye,{children:[e.jsxs(ve,{children:[p?.find(w=>w.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),R()}})]})})]})]})}function Wt({plugin:s,onInstall:n,onUninstall:a,onToggleEnable:l,onOpenConfig:r,isLoading:c}){const{t:i}=F("plugin");return e.jsxs(Le,{className:"group relative overflow-hidden transition-all hover:shadow-md",children:[e.jsxs(Ke,{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(us,{children:s.name}),s.is_installed&&e.jsx(H,{variant:s.is_enabled?"success":"secondary",children:s.is_enabled?i("status.enabled"):i("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(Ys,{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:[i("author"),": ",s.author]})})]})})]}),e.jsx(Ue,{children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.is_installed?e.jsxs(e.Fragment,{children:[e.jsxs(V,{variant:"outline",size:"sm",onClick:()=>r(s.code),disabled:!s.is_enabled||c,children:[e.jsx(bi,{className:"mr-2 h-4 w-4"}),i("button.config")]}),e.jsxs(V,{variant:s.is_enabled?"destructive":"default",size:"sm",onClick:()=>l(s.code,s.is_enabled),disabled:c,children:[e.jsx(yi,{className:"mr-2 h-4 w-4"}),s.is_enabled?i("button.disable"):i("button.enable")]}),e.jsx(We,{title:i("uninstall.title"),description:i("uninstall.description"),confirmText:i("uninstall.button"),variant:"destructive",onConfirm:()=>a(s.code),children:e.jsx(V,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",disabled:c,children:e.jsx(os,{className:"h-4 w-4"})})})]}):e.jsx(V,{onClick:()=>n(s.code),disabled:c,loading:c,children:i("button.install")})})})]})}function Yt(){return e.jsxs(Le,{children:[e.jsxs(Ke,{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(ae,{className:"h-6 w-[200px]"}),e.jsx(ae,{className:"h-6 w-[80px]"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ae,{className:"h-5 w-[120px]"}),e.jsx(ae,{className:"h-5 w-[60px]"})]})]})}),e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx(ae,{className:"h-4 w-[300px]"}),e.jsx(ae,{className:"h-4 w-[150px]"})]})]}),e.jsx(Ue,{children:e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(ae,{className:"h-9 w-[100px]"}),e.jsx(ae,{className:"h-9 w-[100px]"}),e.jsx(ae,{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(vs,{placeholder:s.placeholder,...n});break;case"select":a=e.jsx("select",{className:N(Qs({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]=m.useState(!1),[c,i]=m.useState(!1),[u,x]=m.useState(!1),o=ue({defaultValues:n.configs.reduce((T,R)=>(T[R.field_name]="",T),{})}),d=async()=>{i(!0),$c(s).then(({data:T})=>{Object.entries(T).forEach(([R,f])=>{o.setValue(R,f)})}).finally(()=>{i(!1)})},p=async T=>{x(!0),qc(s,T).then(()=>{$.success(a("config.success")),r(!1)}).finally(()=>{x(!1)})};return e.jsxs(je,{open:l,onOpenChange:T=>{r(T),T?d():o.reset()},children:[e.jsx($e,{asChild:!0,children:e.jsx(V,{variant:"outline",children:a("card.configureTheme")})}),e.jsxs(pe,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(ye,{children:[e.jsx(ve,{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(fe,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(p),className:"space-y-4",children:[n.configs.map(T=>e.jsx(b,{control:o.control,name:T.field_name,render:({field:R})=>e.jsxs(v,{children:[e.jsx(y,{children:T.label}),e.jsx(_,{children:xu(T,R)}),e.jsx(E,{})]})},T.field_name)),e.jsxs(qe,{className:"mt-6 gap-2",children:[e.jsx(V,{type:"button",variant:"secondary",onClick:()=>r(!1),children:a("config.cancel")}),e.jsx(V,{type:"submit",loading:u,children:a("config.save")})]})]})})]})]})}function fu(){const{t:s}=F("theme"),[n,a]=m.useState(null),[l,r]=m.useState(!1),[c,i]=m.useState(!1),[u,x]=m.useState(!1),[o,d]=m.useState(null),p=m.useRef(null),[T,R]=m.useState(0),{data:f,isLoading:g,refetch:S}=te({queryKey:["themeList"],queryFn:async()=>{const{data:z}=await Ac();return z}}),j=async z=>{a(z),Uc({frontend_theme:z}).then(()=>{$.success("主题切换成功"),S()}).finally(()=>{a(null)})},C=async z=>{if(!z.name.endsWith(".zip")){$.error(s("upload.error.format"));return}r(!0),Hc(z).then(()=>{$.success("主题上传成功"),i(!1),S()}).finally(()=>{r(!1),p.current&&(p.current.value="")})},P=z=>{z.preventDefault(),z.stopPropagation(),z.type==="dragenter"||z.type==="dragover"?x(!0):z.type==="dragleave"&&x(!1)},w=z=>{z.preventDefault(),z.stopPropagation(),x(!1),z.dataTransfer.files&&z.dataTransfer.files[0]&&C(z.dataTransfer.files[0])},k=()=>{o&&R(z=>z===0?o.images.length-1:z-1)},L=()=>{o&&R(z=>z===o.images.length-1?0:z+1)},J=(z,X)=>{R(0),d({name:z,images:X})};return e.jsxs(Ce,{children:[e.jsxs(Se,{className:"flex items-center justify-between",children:[e.jsx(Oe,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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(V,{onClick:()=>i(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(ea,{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:g?e.jsxs(e.Fragment,{children:[e.jsx(en,{}),e.jsx(en,{})]}):f?.themes&&Object.entries(f.themes).map(([z,X])=>e.jsx(Le,{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(We,{title:s("card.delete.title"),description:s("card.delete.description"),confirmText:s("card.delete.button"),variant:"destructive",onConfirm:async()=>{if(z===f?.active){$.error(s("card.delete.error.active"));return}a(z),Kc(z).then(()=>{$.success("主题删除成功"),S()}).finally(()=>{a(null)})},children:e.jsx(V,{disabled:n===z,loading:n===z,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(os,{className:"h-4 w-4"})})})}),e.jsxs(Ke,{children:[e.jsx(us,{children:X.name}),e.jsx(Ys,{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(Ue,{className:"flex items-center justify-end space-x-3",children:[X.images&&Array.isArray(X.images)&&X.images.length>0&&e.jsx(V,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>J(X.name,X.images),children:e.jsx(Ni,{className:"h-4 w-4"})}),e.jsx(hu,{themeKey:z,themeInfo:X}),e.jsx(V,{onClick:()=>j(z),disabled:n===z||z===f.active,loading:n===z,variant:z===f.active?"secondary":"default",children:z===f.active?s("card.currentTheme"):s("card.activateTheme")})]})]})},z))}),e.jsx(je,{open:c,onOpenChange:i,children:e.jsxs(pe,{className:"sm:max-w-md",children:[e.jsxs(ye,{children:[e.jsx(ve,{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",u&&"border-primary/50 bg-muted/50"),onDragEnter:P,onDragLeave:P,onDragOver:P,onDrop:w,children:[e.jsx("input",{type:"file",ref:p,className:"hidden",accept:".zip",onChange:z=>{const X=z.target.files?.[0];X&&C(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(ea,{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(je,{open:!!o,onOpenChange:z=>{z||(d(null),R(0))},children:e.jsxs(pe,{className:"max-w-4xl",children:[e.jsxs(ye,{children:[e.jsxs(ve,{children:[o?.name," ",s("preview.title")]}),e.jsx(Ee,{className:"text-center",children:o&&s("preview.imageCount",{current:T+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[T]&&e.jsx("img",{src:o.images[T],alt:`${o.name} 预览图 ${T+1}`,className:"h-full w-full object-contain"})}),o&&o.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(V,{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:k,children:e.jsx(_i,{className:"h-4 w-4"})}),e.jsx(V,{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((z,X)=>e.jsx("button",{onClick:()=>R(X),className:N("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",T===X?"border-primary":"border-transparent"),children:e.jsx("img",{src:z,alt:`缩略图 ${X+1}`,className:"h-full w-full object-cover"})},X))})]})})]})]})}function en(){return e.jsxs(Le,{children:[e.jsxs(Ke,{children:[e.jsx(ae,{className:"h-6 w-[200px]"}),e.jsx(ae,{className:"h-4 w-[300px]"})]}),e.jsxs(Ue,{className:"flex items-center justify-end space-x-3",children:[e.jsx(ae,{className:"h-10 w-[100px]"}),e.jsx(ae,{className:"h-10 w-[100px]"})]})]})}const pu=Object.freeze(Object.defineProperty({__proto__:null,default:fu},Symbol.toStringTag,{value:"Module"})),Ea=m.forwardRef(({className:s,value:n,onChange:a,...l},r)=>{const[c,i]=m.useState("");m.useEffect(()=>{if(c.includes(",")){const x=new Set([...n,...c.split(",").map(o=>o.trim())]);a(Array.from(x)),i("")}},[c,a,n]);const u=()=>{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(H,{variant:"secondary",children:[x,e.jsx(G,{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(),u()):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]=m.useState(!1),u=ue({resolver:he(gu),defaultValues:l,mode:"onChange",shouldFocusError:!0}),x=new pa({html:!0});return e.jsx(fe,{...u,children:e.jsxs(je,{onOpenChange:i,open:c,children:[e.jsx($e,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ke,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add.button")})]})}),e.jsxs(pe,{className:"sm:max-w-[1025px]",children:[e.jsxs(ye,{children:[e.jsx(ve,{children:r(a==="add"?"form.add.title":"form.edit.title")}),e.jsx(Ee,{})]}),e.jsx(b,{control:u.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:u.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:u.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:u.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(K,{checked:o.value,onCheckedChange:o.onChange})})}),e.jsx(E,{})]})}),e.jsx(b,{control:u.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(qe,{children:[e.jsx(pt,{asChild:!0,children:e.jsx(V,{type:"button",variant:"outline",children:r("form.buttons.cancel")})}),e.jsx(V,{type:"submit",onClick:o=>{o.preventDefault(),u.handleSubmit(async d=>{id(d).then(({data:p})=>{p&&($.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(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:[r("table.toolbar.reset"),e.jsx(He,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(V,{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(O,{column:a,title:n("table.columns.id")}),cell:({row:a})=>e.jsx(H,{variant:"outline",className:"font-mono",children:a.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.show")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(K,{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(O,{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(O,{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(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(zs,{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(We,{title:n("table.actions.delete.title"),description:n("table.actions.delete.description"),onConfirm:async()=>{cd({id:a.original.id}).then(()=>{$.success(n("table.actions.delete.success")),s()})},children:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(os,{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]=m.useState({}),[a,l]=m.useState({}),[r,c]=m.useState([]),[i,u]=m.useState([]),[x,o]=m.useState(!1),[d,p]=m.useState({}),[T,R]=m.useState({pageSize:50,pageIndex:0}),[f,g]=m.useState([]),{refetch:S}=te({queryKey:["notices"],queryFn:async()=>{const{data:k}=await Ja.getList();return g(k),k}});m.useEffect(()=>{l({"drag-handle":x,content:!x,created_at:!x,actions:!x}),R({pageSize:x?99999:50,pageIndex:0})},[x]);const j=(k,L)=>{x&&(k.dataTransfer.setData("text/plain",L.toString()),k.currentTarget.classList.add("opacity-50"))},C=(k,L)=>{if(!x)return;k.preventDefault(),k.currentTarget.classList.remove("bg-muted");const J=parseInt(k.dataTransfer.getData("text/plain"));if(J===L)return;const z=[...f],[X]=z.splice(J,1);z.splice(L,0,X),g(z)},P=async()=>{if(!x){o(!0);return}Ja.sort(f.map(k=>k.id)).then(()=>{$.success("排序保存成功"),o(!1),S()}).finally(()=>{o(!1)})},w=Be({data:f??[],columns:bu(S),state:{sorting:i,columnVisibility:a,rowSelection:s,columnFilters:r,columnSizing:d,pagination:T},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:u,onColumnFiltersChange:c,onColumnVisibilityChange:l,onColumnSizingChange:p,onPaginationChange:R,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),getSortedRowModel:ss(),getFacetedRowModel:fs(),getFacetedUniqueValues:ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(as,{table:w,toolbar:k=>e.jsx(vu,{table:k,refetch:S,saveOrder:P,isSortMode:x}),draggable:x,onDragStart:j,onDragEnd:k=>k.currentTarget.classList.remove("opacity-50"),onDragOver:k=>{k.preventDefault(),k.currentTarget.classList.add("bg-muted")},onDragLeave:k=>k.currentTarget.classList.remove("bg-muted"),onDrop:C,showPagination:!x})})}function Nu(){const{t:s}=F("notice");return e.jsxs(Ce,{children:[e.jsxs(Se,{className:"flex items-center justify-between",children:[e.jsx(Oe,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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]=m.useState(!1),u=ue({resolver:he(wu),defaultValues:l,mode:"onChange",shouldFocusError:!0}),x=new pa({html:!0});return m.useEffect(()=>{c&&l.id&&ud(l.id).then(({data:o})=>{u.reset(o)})},[l.id,u,c]),e.jsxs(je,{onOpenChange:i,open:c,children:[e.jsx($e,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ke,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add")})]})}),e.jsxs(pe,{className:"sm:max-w-[1025px]",children:[e.jsxs(ye,{children:[e.jsx(ve,{children:r(a==="add"?"form.add":"form.edit")}),e.jsx(Ee,{})]}),e.jsxs(fe,{...u,children:[e.jsx(b,{control:u.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:u.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:u.control,name:"language",render:({field:o})=>e.jsxs(v,{children:[e.jsx(y,{children:r("form.language")}),e.jsx(_,{children:e.jsxs(W,{value:o.value,onValueChange:o.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("form.languagePlaceholder")})}),e.jsx(B,{children:[{value:"en-US"},{value:"ja-JP"},{value:"ko-KR"},{value:"vi-VN"},{value:"zh-CN"},{value:"zh-TW"}].map(d=>e.jsx(A,{value:d.value,className:"cursor-pointer",children:r(`languages.${d.value}`)},d.value))})]})})]})}),e.jsx(b,{control:u.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:u.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(K,{checked:o.value,onCheckedChange:o.onChange})})}),e.jsx(E,{})]})}),e.jsxs(qe,{children:[e.jsx(pt,{asChild:!0,children:e.jsx(V,{type:"button",variant:"outline",children:r("form.cancel")})}),e.jsx(V,{type:"submit",onClick:()=>{u.handleSubmit(o=>{xd(o).then(({data:d})=>{d&&(u.reset(),$.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(is,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(ft,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{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(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(c=>r.has(c.value)).map(c=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(ts,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Ps,{children:[e.jsx(Ls,{placeholder:n}),e.jsxs(Ds,{children:[e.jsx(As,{children:"No results found."}),e.jsx(Ae,{children:a.map(c=>{const i=r.has(c.value);return e.jsxs(Te,{onSelect:()=>{i?r.delete(c.value):r.add(c.value);const u=Array.from(r);s?.setFilterValue(u.length?u: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(Ms,{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(Xs,{}),e.jsx(Ae,{children:e.jsx(Te,{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(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[c("toolbar.reset"),e.jsx(He,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(V,{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(Ot,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx(H,{variant:"outline",className:"justify-center",children:l.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.status")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center",children:e.jsx(K,{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(O,{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(O,{column:l,title:a("columns.category")}),cell:({row:l})=>e.jsx(H,{variant:"secondary",className:"max-w-[180px] truncate",children:l.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:l})=>e.jsx(O,{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(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(zs,{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(We,{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&&($.success(a("messages.operationSuccess")),s())})},children:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(os,{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]=m.useState([]),[a,l]=m.useState([]),[r,c]=m.useState(!1),[i,u]=m.useState([]),[x,o]=m.useState({"drag-handle":!1}),[d,p]=m.useState({pageSize:20,pageIndex:0}),{refetch:T,isLoading:R,data:f}=te({queryKey:["knowledge"],queryFn:async()=>{const{data:P}=await md();return u(P||[]),P}});m.useEffect(()=>{o({"drag-handle":r,actions:!r}),p({pageSize:r?99999:10,pageIndex:0})},[r]);const g=(P,w)=>{r&&(P.dataTransfer.setData("text/plain",w.toString()),P.currentTarget.classList.add("opacity-50"))},S=(P,w)=>{if(!r)return;P.preventDefault(),P.currentTarget.classList.remove("bg-muted");const k=parseInt(P.dataTransfer.getData("text/plain"));if(k===w)return;const L=[...i],[J]=L.splice(k,1);L.splice(w,0,J),u(L)},j=async()=>{r?pd({ids:i.map(P=>P.id)}).then(()=>{T(),c(!1),$.success("排序保存成功")}):c(!0)},C=Be({data:i,columns:Tu({refetch:T,isSortMode:r}),state:{sorting:a,columnFilters:s,columnVisibility:x,pagination:d},onSortingChange:l,onColumnFiltersChange:n,onColumnVisibilityChange:o,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),getSortedRowModel:ss(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(as,{table:C,toolbar:P=>e.jsx(ku,{table:P,refetch:T,saveOrder:j,isSortMode:r}),draggable:r,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:S,showPagination:!r})}function Du(){const{t:s}=F("knowledge");return e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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]=m.useState(s);return m.useEffect(()=>{const r=setTimeout(()=>l(s),n);return()=>{clearTimeout(r)}},[s,n]),a}function Qt(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 Vu(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 Iu(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=m.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 ut=m.forwardRef(({value:s,onChange:n,placeholder:a,defaultOptions:l=[],options:r,delay:c,onSearch:i,loadingIndicator:u,emptyIndicator:x,maxSelected:o=Number.MAX_SAFE_INTEGER,onMaxSelected:d,hidePlaceholderWhenSelected:p,disabled:T,groupBy:R,className:f,badgeClassName:g,selectFirstItem:S=!0,creatable:j=!1,triggerSearchOnFocus:C=!1,commandProps:P,inputProps:w,hideClearAllButton:k=!1},L)=>{const J=m.useRef(null),[z,X]=m.useState(!1),bs=m.useRef(!1),[Hs,et]=m.useState(!1),[ee,Es]=m.useState(s||[]),[Fe,se]=m.useState(Qt(l,R)),[ns,st]=m.useState(""),tt=Ru(ns,c||500);m.useImperativeHandle(L,()=>({selectedValue:[...ee],input:J.current,focus:()=>J.current?.focus()}),[ee]);const gt=m.useCallback(Q=>{const le=ee.filter(Me=>Me.value!==Q.value);Es(le),n?.(le)},[n,ee]),ml=m.useCallback(Q=>{const le=J.current;le&&((Q.key==="Delete"||Q.key==="Backspace")&&le.value===""&&ee.length>0&&(ee[ee.length-1].fixed||gt(ee[ee.length-1])),Q.key==="Escape"&&le.blur())},[gt,ee]);m.useEffect(()=>{s&&Es(s)},[s]),m.useEffect(()=>{if(!r||i)return;const Q=Qt(r||[],R);JSON.stringify(Q)!==JSON.stringify(Fe)&&se(Q)},[l,r,R,i,Fe]),m.useEffect(()=>{const Q=async()=>{et(!0);const Me=await i?.(tt);se(Qt(Me||[],R)),et(!1)};(async()=>{!i||!z||(C&&await Q(),tt&&await Q())})()},[tt,R,z,C]);const ul=()=>{if(!j||Iu(Fe,[{value:ns,label:ns}])||ee.find(le=>le.value===ns))return;const Q=e.jsx(Te,{value:ns,className:"cursor-pointer",onMouseDown:le=>{le.preventDefault(),le.stopPropagation()},onSelect:le=>{if(ee.length>=o){d?.(ee.length);return}st("");const Me=[...ee,{value:le,label:le}];Es(Me),n?.(Me)},children:`Create "${ns}"`});if(!i&&ns.length>0||i&&tt.length>0&&!Hs)return Q},xl=m.useCallback(()=>{if(x)return i&&!j&&Object.keys(Fe).length===0?e.jsx(Te,{value:"-",disabled:!0,children:x}):e.jsx(qr,{children:x})},[j,x,i,Fe]),hl=m.useMemo(()=>Vu(Fe,ee),[Fe,ee]),fl=m.useCallback(()=>{if(P?.filter)return P.filter;if(j)return(Q,le)=>Q.toLowerCase().includes(le.toLowerCase())?1:-1},[j,P?.filter]),pl=m.useCallback(()=>{const Q=ee.filter(le=>le.fixed);Es(Q),n?.(Q)},[n,ee]);return e.jsxs(Ps,{...P,onKeyDown:Q=>{ml(Q),P?.onKeyDown?.(Q)},className:N("h-auto overflow-visible bg-transparent",P?.className),shouldFilter:P?.shouldFilter!==void 0?P.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":!T&&ee.length!==0},f),onClick:()=>{T||J.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[ee.map(Q=>e.jsxs(H,{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",g),"data-fixed":Q.fixed,"data-disabled":T||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",(T||Q.fixed)&&"hidden"),onKeyDown:le=>{le.key==="Enter"&>(Q)},onMouseDown:le=>{le.preventDefault(),le.stopPropagation()},onClick:()=>gt(Q),children:e.jsx(aa,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},Q.value)),e.jsx(Re.Input,{...w,ref:J,value:ns,disabled:T,onValueChange:Q=>{st(Q),w?.onValueChange?.(Q)},onBlur:Q=>{bs.current===!1&&X(!1),w?.onBlur?.(Q)},onFocus:Q=>{X(!0),C&&i?.(tt),w?.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},w?.className)}),e.jsx("button",{type:"button",onClick:pl,className:N((k||T||ee.length<1||ee.filter(Q=>Q.fixed).length===ee.length)&&"hidden"),children:e.jsx(aa,{})})]})}),e.jsx("div",{className:"relative",children:z&&e.jsx(Ds,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{bs.current=!1},onMouseEnter:()=>{bs.current=!0},onMouseUp:()=>{J.current?.focus()},children:Hs?e.jsx(e.Fragment,{children:u}):e.jsxs(e.Fragment,{children:[xl(),ul(),!S&&e.jsx(Te,{value:"-",className:"hidden"}),Object.entries(hl).map(([Q,le])=>e.jsx(Ae,{heading:Q,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:le.map(Me=>e.jsx(Te,{value:Me.value,disabled:Me.disable,onMouseDown:at=>{at.preventDefault(),at.stopPropagation()},onSelect:()=>{if(ee.length>=o){d?.(ee.length);return}st("");const at=[...ee,Me];Es(at),n?.(at)},className:N("cursor-pointer",Me.disable&&"cursor-default text-muted-foreground"),children:Me.label},Me.value))})},Q))]})})})]})});ut.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 Ht({refetch:s,dialogTrigger:n,defaultValues:a={name:""},type:l="add"}){const{t:r}=F("group"),c=ue({resolver:he(Fu(r)),defaultValues:a,mode:"onChange"}),[i,u]=m.useState(!1),[x,o]=m.useState(!1),d=async p=>{o(!0),Jc(p).then(()=>{$.success(r(l==="edit"?"messages.updateSuccess":"messages.createSuccess")),s&&s(),c.reset(),u(!1)}).finally(()=>{o(!1)})};return e.jsxs(je,{open:i,onOpenChange:u,children:[e.jsx($e,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ke,{icon:"ion:add"}),e.jsx("span",{children:r("form.add")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(ye,{children:[e.jsx(ve,{children:r(l==="edit"?"form.edit":"form.create")}),e.jsx(Ee,{children:r(l==="edit"?"form.editDescription":"form.createDescription")})]}),e.jsx(fe,{...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(qe,{className:"gap-2",children:[e.jsx(pt,{asChild:!0,children:e.jsx(V,{type:"button",variant:"outline",children:r("form.cancel")})}),e.jsxs(V,{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=m.createContext(void 0);function Mu({children:s,refetch:n}){const[a,l]=m.useState(!1),[r,c]=m.useState(null),[i,u]=m.useState(_e.Shadowsocks);return e.jsx(Hr.Provider,{value:{isOpen:a,setIsOpen:l,editingServer:r,setEditingServer:c,serverType:i,setServerType:u,refetch:n},children:s})}function Kr(){const s=m.useContext(Hr);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function Jt({dialogTrigger:s,value:n,setValue:a,templateType:l}){const{t:r}=F("server");m.useEffect(()=>{console.log(n)},[n]);const[c,i]=m.useState(!1),[u,x]=m.useState(()=>{if(!n||Object.keys(n).length===0)return"";try{return JSON.stringify(n,null,2)}catch{return""}}),[o,d]=m.useState(null),p=j=>{if(!j)return null;try{const C=JSON.parse(j);return typeof C!="object"||C===null?r("network_settings.validation.must_be_object"):null}catch{return r("network_settings.validation.invalid_json")}},T={tcp:{label:"TCP",content:{acceptProxyProtocol:!1,header:{type:"none"}}},"tcp-http":{label:"TCP + HTTP",content:{acceptProxyProtocol:!1,header:{type:"http",request:{version:"1.1",method:"GET",path:["/"],headers:{Host:["www.example.com"]}},response:{version:"1.1",status:"200",reason:"OK"}}}},grpc:{label:"gRPC",content:{serviceName:"GunService"}},ws:{label:"WebSocket",content:{path:"/",headers:{Host:"v2ray.com"}}}},R=()=>{switch(l){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];default:return[]}},f=()=>{const j=p(u||"");if(j){$.error(j);return}try{if(!u){a(null),i(!1);return}a(JSON.parse(u)),i(!1)}catch{$.error(r("network_settings.errors.save_failed"))}},g=j=>{x(j),d(p(j))},S=j=>{const C=T[j];if(C){const P=JSON.stringify(C.content,null,2);x(P),d(null)}};return m.useEffect(()=>{c&&console.log(n)},[c,n]),m.useEffect(()=>{c&&n&&Object.keys(n).length>0&&x(JSON.stringify(n,null,2))},[c,n]),e.jsxs(je,{open:c,onOpenChange:j=>{!j&&c&&f(),i(j)},children:[e.jsx($e,{asChild:!0,children:s??e.jsx(G,{variant:"link",children:r("network_settings.edit_protocol")})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsx(ye,{children:e.jsx(ve,{children:r("network_settings.edit_protocol_config")})}),e.jsxs("div",{className:"space-y-4",children:[R().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:R().map(j=>e.jsx(G,{variant:"outline",size:"sm",onClick:()=>S(j),children:r("network_settings.use_template",{template:T[j].label})},j))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(vs,{className:`min-h-[200px] font-mono text-sm ${o?"border-red-500 focus-visible:ring-red-500":""}`,value:u,placeholder:R().length>0?r("network_settings.json_config_placeholder_with_template"):r("network_settings.json_config_placeholder"),onChange:j=>g(j.target.value)}),o&&e.jsx("p",{className:"text-sm text-red-500",children:o})]})]}),e.jsxs(qe,{className:"gap-2",children:[e.jsx(G,{variant:"outline",onClick:()=>i(!1),children:r("common.cancel")}),e.jsx(G,{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("")}),ds={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?ds[s]:null,c=r?.schema||h.record(h.any()),i=s?c.parse({}):{},u=ue({resolver:he(c),defaultValues:i,mode:"onChange"});if(m.useEffect(()=>{if(!n||Object.keys(n).length===0){if(s){const f=c.parse({});u.reset(f)}}else u.reset(n)},[s,n,a,u,c]),m.useEffect(()=>{const f=u.watch(g=>{a(g)});return()=>f.unsubscribe()},[u,a]),!s||!r)return null;const R={shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(b,{control:u.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(W,{onValueChange:f.onChange,value:f.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.shadowsocks.cipher.placeholder")})}),e.jsx(B,{children:e.jsx(ys,{children:ds.shadowsocks.ciphers.map(g=>e.jsx(A,{value:g,children:g},g))})})]})})]})}),e.jsx(b,{control:u.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(W,{onValueChange:f.onChange,value:f.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.shadowsocks.obfs.placeholder")})}),e.jsx(B,{children:e.jsxs(ys,{children:[e.jsx(A,{value:"0",children:l("dynamic_form.shadowsocks.obfs.none")}),e.jsx(A,{value:"http",children:l("dynamic_form.shadowsocks.obfs.http")})]})})]})})]})}),u.watch("obfs")==="http"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:u.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:u.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:u.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(W,{value:f.value?.toString(),onValueChange:g=>f.onChange(Number(g)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vmess.tls.placeholder")})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:l("dynamic_form.vmess.tls.disabled")}),e.jsx(A,{value:"1",children:l("dynamic_form.vmess.tls.enabled")})]})]})})]})}),u.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:u.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:u.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(K,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),e.jsx(b,{control:u.control,name:"network",render:({field:f})=>e.jsxs(v,{children:[e.jsxs(y,{children:[l("dynamic_form.vmess.network.label"),e.jsx(Jt,{value:u.watch("network_settings"),setValue:g=>u.setValue("network_settings",g),templateType:u.watch("network")})]}),e.jsx(_,{children:e.jsxs(W,{onValueChange:f.onChange,value:f.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vmess.network.placeholder")})}),e.jsx(B,{children:e.jsx(ys,{children:ds.vmess.networkOptions.map(g=>e.jsx(A,{value:g.value,className:"cursor-pointer",children:g.label},g.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:u.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:u.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(K,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})})]}),e.jsx(b,{control:u.control,name:"network",render:({field:f})=>e.jsxs(v,{children:[e.jsxs(y,{children:[l("dynamic_form.trojan.network.label"),e.jsx(Jt,{value:u.watch("network_settings")||{},setValue:g=>u.setValue("network_settings",g),templateType:u.watch("network")||"tcp"})]}),e.jsx(_,{children:e.jsxs(W,{onValueChange:f.onChange,value:f.value||"tcp",children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.trojan.network.placeholder")})}),e.jsx(B,{children:e.jsx(ys,{children:ds.trojan.networkOptions.map(g=>e.jsx(A,{value:g.value,className:"cursor-pointer",children:g.label},g.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:u.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(W,{value:(f.value||2).toString(),onValueChange:g=>f.onChange(Number(g)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.hysteria.version.placeholder")})}),e.jsx(B,{children:e.jsx(ys,{children:ds.hysteria.versions.map(g=>e.jsxs(A,{value:g,className:"cursor-pointer",children:["V",g]},g))})})]})})]})}),u.watch("version")==1&&e.jsx(b,{control:u.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(W,{value:f.value||"h2",onValueChange:f.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.hysteria.alpn.placeholder")})}),e.jsx(B,{children:e.jsx(ys,{children:ds.hysteria.alpnOptions.map(g=>e.jsx(A,{value:g,children:g},g))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:u.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(K,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})}),!!u.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[u.watch("version")=="2"&&e.jsx(b,{control:u.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(W,{value:f.value||"salamander",onValueChange:f.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.hysteria.obfs.type.placeholder")})}),e.jsx(B,{children:e.jsx(ys,{children:e.jsx(A,{value:"salamander",children:l("dynamic_form.hysteria.obfs.type.salamander")})})})]})})]})}),e.jsx(b,{control:u.control,name:"obfs.password",render:({field:f})=>e.jsxs(v,{className:u.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(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",S=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(j=>g[j%g.length]).join("");u.setValue("obfs.password",S),$.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(ke,{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:u.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:u.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(K,{checked:f.value||!1,onCheckedChange:f.onChange})})})]})})]}),e.jsx(b,{control:u.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")+(u.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:u.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")+(u.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:u.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(W,{value:f.value?.toString(),onValueChange:g=>f.onChange(Number(g)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vless.tls.placeholder")})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:l("dynamic_form.vless.tls.none")}),e.jsx(A,{value:"1",children:l("dynamic_form.vless.tls.tls")}),e.jsx(A,{value:"2",children:l("dynamic_form.vless.tls.reality")})]})]})})]})}),u.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:u.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:u.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(K,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),u.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:u.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:u.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:u.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(K,{checked:f.value,onCheckedChange:f.onChange})})})]})})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx(b,{control:u.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(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{try{const g=Au();u.setValue("reality_settings.private_key",g.privateKey),u.setValue("reality_settings.public_key",g.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(ke,{icon:"ion:key-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(Tt,{children:e.jsx(re,{children:e.jsx("p",{children:l("dynamic_form.vless.reality_settings.key_pair.generate")})})})]})]})]})})}),e.jsx(b,{control:u.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:u.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(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const g=qu();u.setValue("reality_settings.short_id",g),$.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(ke,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(Tt,{children:e.jsx(re,{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:u.control,name:"network",render:({field:f})=>e.jsxs(v,{children:[e.jsxs(y,{children:[l("dynamic_form.vless.network.label"),e.jsx(Jt,{value:u.watch("network_settings"),setValue:g=>u.setValue("network_settings",g),templateType:u.watch("network")})]}),e.jsx(_,{children:e.jsxs(W,{onValueChange:f.onChange,value:f.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vless.network.placeholder")})}),e.jsx(B,{children:e.jsx(ys,{children:ds.vless.networkOptions.map(g=>e.jsx(A,{value:g.value,className:"cursor-pointer",children:g.label},g.value))})})]})})]})}),e.jsx(b,{control:u.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(W,{onValueChange:g=>f.onChange(g==="none"?null:g),value:f.value||"none",children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dynamic_form.vless.flow.placeholder")})}),e.jsx(B,{children:ds.vless.flowOptions.map(g=>e.jsx(A,{value:g,children:g},g))})]})})]})})]})};return e.jsx(me,{children:R[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()}),bt={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:u}=Kr(),[x,o]=m.useState([]),[d,p]=m.useState([]),[T,R]=m.useState([]),f=ue({resolver:he(Yu),defaultValues:bt,mode:"onChange"});m.useEffect(()=>{g()},[n]),m.useEffect(()=>{l?.type&&l.type!==c&&i(l.type)},[l,c,i]),m.useEffect(()=>{l?l.type===c&&f.reset({...bt,...l}):f.reset({...bt,protocol_settings:ds[c].schema.parse({})})},[l,f,c]);const g=async()=>{if(!n)return;const[w,k,L]=await Promise.all([$t(),Er(),Dr()]);o(w.data?.map(J=>({label:J.name,value:J.id.toString()}))||[]),p(k.data?.map(J=>({label:J.remarks,value:J.id.toString()}))||[]),R(L.data||[])},S=m.useMemo(()=>T?.filter(w=>(w.parent_id===0||w.parent_id===null)&&w.type===c&&w.id!==f.watch("id")),[c,T,f]),j=()=>e.jsxs(ks,{children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ke,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(xs,{align:"start",children:e.jsx(bc,{children:Vs.map(({type:w,label:k})=>e.jsx(ge,{onClick:()=>{i(w),a(!0)},className:"cursor-pointer",children:e.jsx(H,{variant:"outline",className:"text-white",style:{background:ms[w]},children:k})},w))})})]}),C=()=>{a(!1),r(null),f.reset(bt)},P=async()=>{const w=f.getValues();(await Bc({...w,type:c})).data&&(C(),$.success(s("form.success")),u())};return e.jsxs(je,{open:n,onOpenChange:C,children:[j(),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(ye,{children:[e.jsx(ve,{children:s(l?"form.edit_node":"form.new_node")}),e.jsx(Ee,{})]}),e.jsxs(fe,{...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:w})=>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"),...w})}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"rate",render:({field:w})=>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",...w})})}),e.jsx(E,{})]})})]}),e.jsx(b,{control:f.control,name:"code",render:({field:w})=>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"),...w,value:w.value||""})}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"tags",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.tags.label")}),e.jsx(_,{children:e.jsx(Ea,{value:w.value,onChange:w.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"group_ids",render:({field:w})=>e.jsxs(v,{children:[e.jsxs(y,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(Ht,{dialogTrigger:e.jsx(V,{variant:"link",children:s("form.groups.add")}),refetch:g})]}),e.jsx(_,{children:e.jsx(ut,{options:x,onChange:k=>w.onChange(k.map(L=>L.value)),value:x?.filter(k=>w.value.includes(k.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:w})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.host.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("form.host.placeholder"),...w})}),e.jsx(E,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(b,{control:f.control,name:"port",render:({field:w})=>e.jsxs(v,{className:"flex-1",children:[e.jsxs(y,{className:"flex items-center gap-1.5",children:[s("form.port.label"),e.jsx(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(ke,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Tt,{children:e.jsx(re,{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"),...w})}),e.jsx(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(V,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const k=w.value;k&&f.setValue("server_port",k)},children:e.jsx(ke,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(re,{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:w})=>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(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(ke,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Tt,{children:e.jsx(re,{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"),...w})}),e.jsx(E,{})]})})]})]}),n&&e.jsx(Wu,{serverType:c,value:f.watch("protocol_settings"),onChange:w=>f.setValue("protocol_settings",w,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(b,{control:f.control,name:"parent_id",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.parent.label")}),e.jsxs(W,{onValueChange:w.onChange,value:w.value?.toString()||"0",children:[e.jsx(_,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:s("form.parent.placeholder")})})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:s("form.parent.none")}),S?.map(k=>e.jsx(A,{value:k.id.toString(),className:"cursor-pointer",children:k.name},k.id))]})]}),e.jsx(E,{})]})}),e.jsx(b,{control:f.control,name:"route_ids",render:({field:w})=>e.jsxs(v,{children:[e.jsx(y,{children:s("form.route.label")}),e.jsx(_,{children:e.jsx(ut,{options:d,onChange:k=>w.onChange(k.map(L=>L.value)),value:d?.filter(k=>w.value.includes(k.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(qe,{className:"mt-6",children:[e.jsx(V,{type:"button",variant:"outline",onClick:C,children:s("form.cancel")}),e.jsx(V,{type:"submit",onClick:P,children:s("form.submit")})]})]})]})]})}function tn({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(is,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(ft,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{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(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(c=>r.has(c.value)).map(c=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(ts,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Ps,{children:[e.jsx(Ls,{placeholder:n}),e.jsxs(Ds,{children:[e.jsx(As,{children:"No results found."}),e.jsx(Ae,{children:a.map(c=>{const i=r.has(c.value);return e.jsxs(Te,{onSelect:()=>{i?r.delete(c.value):r.add(c.value);const u=Array.from(r);s?.setFilterValue(u.length?u: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(Ms,{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(Xs,{}),e.jsx(Ae,{children:e.jsx(Te,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Ju=[{value:_e.Shadowsocks,label:Vs.find(s=>s.type===_e.Shadowsocks)?.label,color:ms[_e.Shadowsocks]},{value:_e.Vmess,label:Vs.find(s=>s.type===_e.Vmess)?.label,color:ms[_e.Vmess]},{value:_e.Trojan,label:Vs.find(s=>s.type===_e.Trojan)?.label,color:ms[_e.Trojan]},{value:_e.Hysteria,label:Vs.find(s=>s.type===_e.Hysteria)?.label,color:ms[_e.Hysteria]},{value:_e.Vless,label:Vs.find(s=>s.type===_e.Vless)?.label,color:ms[_e.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(u=>({label:u,value:u}));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:u=>s.getColumn("name")?.setFilterValue(u.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(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[c("toolbar.reset"),e.jsx(He,{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(V,{variant:a?"default":"outline",onClick:n,size:"sm",children:c(a?"toolbar.sort.save":"toolbar.sort.edit")})})]})}const xt=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"})}),yt={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(O,{column:a,title:n("columns.sort")}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Ot,{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(O,{column:a,title:n("columns.nodeId")}),cell:({row:a})=>{const l=a.getValue("id"),r=a.original.code;return e.jsx(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(H,{variant:"outline",className:N("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:ms[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(V,{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(),Et(r||l.toString()).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(Ka,{className:"size-3"})})]})}),e.jsxs(re,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[Vs.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(O,{column:a,title:n("columns.show")}),cell:({row:a})=>{const[l,r]=m.useState(!!a.getValue("show"));return e.jsx(K,{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?ms[a.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(O,{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",yt[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",yt[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",yt[2])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.2")})]})]})})}),cell:({row:a})=>e.jsx(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{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",yt[a.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:a.getValue("name")})]})}),e.jsx(re,{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(O,{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(me,{delayDuration:0,children:e.jsxs(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(V,{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(),Et(l).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(Ka,{className:"size-3"})})}),e.jsx(re,{side:"top",sideOffset:10,children:n("columns.copyAddress")})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:a})=>e.jsx(O,{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(xt,{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(O,{column:a,title:n("columns.rate.title"),tooltip:n("columns.rate.tooltip")}),cell:({row:a})=>e.jsxs(H,{variant:"secondary",className:"font-medium",children:[a.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"groups",header:({column:a})=>e.jsx(O,{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(H,{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(O,{column:a,title:n("columns.type")}),cell:({row:a})=>{const l=a.getValue("type");return e.jsx(H,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:ms[l]},children:l})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:a})=>e.jsx(O,{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(ks,{modal:!1,children:[e.jsx(Ts,{asChild:!0,children:e.jsx(V,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":n("columns.actions"),children:e.jsx(Pt,{className:"size-4"})})}),e.jsxs(xs,{align:"end",className:"w-40",children:[e.jsx(ge,{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(ge,{className:"cursor-pointer",onClick:async()=>{Wc({id:a.original.id}).then(({data:i})=>{i&&($.success(n("columns.actions_dropdown.copy_success")),s())})},children:[e.jsx(Pi,{className:"mr-2 size-4"}),n("columns.actions_dropdown.copy")]}),e.jsx(mt,{}),e.jsx(ge,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:i=>i.preventDefault(),children:e.jsx(We,{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&&($.success(n("columns.actions_dropdown.delete_success")),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(os,{className:"mr-2 size-4"}),n("columns.actions_dropdown.delete.confirm")]})})})]})]})})},size:50}]};function ex(){const[s,n]=m.useState({}),[a,l]=m.useState({"drag-handle":!1}),[r,c]=m.useState([]),[i,u]=m.useState({pageSize:500,pageIndex:0}),[x,o]=m.useState([]),[d,p]=m.useState(!1),[T,R]=m.useState({}),[f,g]=m.useState([]),{refetch:S}=te({queryKey:["nodeList"],queryFn:async()=>{const{data:L}=await Dr();return g(L),L}}),j=m.useMemo(()=>{const L=new Set;return f.forEach(J=>{J.groups&&J.groups.forEach(z=>L.add(z.name))}),Array.from(L).sort()},[f]);m.useEffect(()=>{l({"drag-handle":d,show:!d,host:!d,online:!d,rate:!d,groups:!d,type:!1,actions:!d}),R({name:d?2e3:200}),u({pageSize:d?99999:500,pageIndex:0})},[d]);const C=(L,J)=>{d&&(L.dataTransfer.setData("text/plain",J.toString()),L.currentTarget.classList.add("opacity-50"))},P=(L,J)=>{if(!d)return;L.preventDefault(),L.currentTarget.classList.remove("bg-muted");const z=parseInt(L.dataTransfer.getData("text/plain"));if(z===J)return;const X=[...f],[bs]=X.splice(z,1);X.splice(J,0,bs),g(X)},w=async()=>{if(!d){p(!0);return}const L=f?.map((J,z)=>({id:J.id,order:z+1}));Qc(L).then(()=>{$.success("排序保存成功"),p(!1),S()}).finally(()=>{p(!1)})},k=Be({data:f||[],columns:Xu(S),state:{sorting:x,columnVisibility:a,rowSelection:s,columnFilters:r,columnSizing:T,pagination:i},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:o,onColumnFiltersChange:c,onColumnVisibilityChange:l,onColumnSizingChange:R,onPaginationChange:u,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),getSortedRowModel:ss(),getFacetedRowModel:fs(),getFacetedUniqueValues:ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Mu,{refetch:S,children:e.jsx("div",{className:"space-y-4",children:e.jsx(as,{table:k,toolbar:L=>e.jsx(Zu,{table:L,refetch:S,saveOrder:w,isSortMode:d,groups:j}),draggable:d,onDragStart:C,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:P,showPagination:!d})})})}function sx(){const{t:s}=F("server");return e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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(Ht,{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(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(He,{className:"ml-2 h-4 w-4"})]})]})})}const nx=s=>{const{t:n}=F("group");return[{accessorKey:"id",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.id")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(H,{variant:"outline",children:a.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:a})=>e.jsx(O,{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(O,{column:a,title:n("columns.usersCount")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(xt,{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(O,{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(O,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Ht,{defaultValues:a.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(zs,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(We,{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&&($.success(n("messages.updateSuccess")),s())})},children:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(os,{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]=m.useState({}),[a,l]=m.useState({}),[r,c]=m.useState([]),[i,u]=m.useState([]),{data:x,refetch:o,isLoading:d}=te({queryKey:["serverGroupList"],queryFn:async()=>{const{data:T}=await $t();return T}}),p=Be({data:x||[],columns:nx(o),state:{sorting:i,columnVisibility:a,rowSelection:s,columnFilters:r},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:u,onColumnFiltersChange:c,onColumnVisibilityChange:l,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),getSortedRowModel:ss(),getFacetedRowModel:fs(),getFacetedUniqueValues:ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(as,{table:p,toolbar:T=>e.jsx(ax,{table:T,refetch:o}),isLoading:d})}function lx(){const{t:s}=F("group");return e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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=ue({resolver:he(ix(r)),defaultValues:a,mode:"onChange"}),[i,u]=m.useState(!1);return e.jsxs(je,{open:i,onOpenChange:u,children:[e.jsx($e,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(ke,{icon:"ion:add"})," ",e.jsx("div",{children:r("form.add")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(ye,{children:[e.jsx(ve,{children:r(l==="edit"?"form.edit":"form.create")}),e.jsx(Ee,{})]}),e.jsxs(fe,{...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(vs,{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(y,{control:i.control,name:"action",render:({field:x})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(w,{children:e.jsxs(G,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("form.actionPlaceholder")})}),e.jsxs(B,{children:[e.jsx(L,{value:"block",children:r("actions.block")}),e.jsx(L,{value:"dns",children:r("actions.dns")})]})]})})}),e.jsx(E,{})]})}),i.watch("action")==="dns"&&e.jsx(y,{control:i.control,name:"action_value",render:({field:x})=>e.jsxs(b,{children:[e.jsx(N,{children:r("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(w,{children:e.jsx(D,{type:"text",placeholder:r("form.dnsPlaceholder"),...x})})})]})}),e.jsxs(Le,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(V,{variant:"outline",children:r("form.cancel")})}),e.jsx(V,{type:"submit",onClick:()=>{Zc(i.getValues()).then(({data:x})=>{x&&(m(!1),s&&s(),toast.success(r(l==="edit"?"messages.updateSuccess":"messages.createSuccess")),i.reset())})},children:r("form.submit")})]})]})]})]})}function ix({table:s,refetch:n}){const a=s.getState().columnFilters.length>0,{t:l}=I("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(Kr,{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(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(Ae,{className:"ml-2 h-4 w-4"})]})]})})}function cx({columns:s,data:n,refetch:a}){const[l,r]=u.useState({}),[i,c]=u.useState({}),[m,x]=u.useState([]),[o,d]=u.useState([]),p=He({data:n,columns:s,state:{sorting:o,columnVisibility:i,rowSelection:l,columnFilters:m},enableRowSelection:!0,onRowSelectionChange:r,onSortingChange:d,onColumnFiltersChange:x,onColumnVisibilityChange:c,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),getSortedRowModel:Ze(),getFacetedRowModel:us(),getFacetedUniqueValues:xs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(es,{table:p,toolbar:P=>e.jsx(ix,{table:P,refetch:a})})}const dx=s=>{const{t:n}=I("route"),a={block:{icon:Pi,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:Di,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(O,{column:l,title:n("columns.id")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(H,{variant:"outline",children:l.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:l})=>e.jsx(O,{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(O,{column:l,title:n("columns.action")}),cell:({row:l})=>{const r=l.getValue("action"),i=a[r]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(H,{variant:a[r]?.variant||"default",className:_("flex items-center gap-1.5 px-3 py-1 capitalize",a[r]?.className),children:[i&&e.jsx(i,{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(Kr,{defaultValues:l.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(Is,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(Ue,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{Xc({id:l.original.id}).then(({data:r})=>{r&&($.success(n("messages.deleteSuccess")),s())})},children:e.jsxs(V,{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 mx(){const{t:s}=I("route"),[n,a]=u.useState([]);function l(){Pr().then(({data:r})=>{a(r)})}return u.useEffect(()=>{l()},[]),e.jsxs(we,{children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(cx,{data:n,columns:dx(l),refetch:l})})]})]})}const ux=Object.freeze(Object.defineProperty({__proto__:null,default:mx},Symbol.toStringTag,{value:"Module"})),Ur=u.createContext(void 0);function xx({children:s,refreshData:n}){const[a,l]=u.useState(!1),[r,i]=u.useState(null);return e.jsx(Ur.Provider,{value:{isOpen:a,setIsOpen:l,editingPlan:r,setEditingPlan:i,refreshData:n},children:s})}function Ta(){const s=u.useContext(Ur);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function hx({table:s,saveOrder:n,isSortMode:a}){const{setIsOpen:l}=Ta(),{t:r}=I("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(V,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>l(!0),children:[e.jsx(Se,{icon:"ion:add"}),e.jsx("div",{children:r("plan.add")})]}),e.jsx(D,{placeholder:r("plan.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:i=>s.getColumn("name")?.setFilterValue(i.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(V,{variant:a?"default":"outline",onClick:n,size:"sm",children:r(a?"plan.sort.save":"plan.sort.edit")})})]})}const tn={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"}},fx=s=>{const{t:n}=I("subscribe");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(Vt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(O,{column:a,title:n("plan.columns.id")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(H,{variant:"outline",children:a.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:a})=>e.jsx(O,{column:a,title:n("plan.columns.show")}),cell:({row:a})=>e.jsx(K,{defaultChecked:a.getValue("show"),onCheckedChange:l=>{Ht({id:a.original.id,show:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:a})=>e.jsx(O,{column:a,title:n("plan.columns.sell")}),cell:({row:a})=>e.jsx(K,{defaultChecked:a.getValue("sell"),onCheckedChange:l=>{Ht({id:a.original.id,sell:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:a})=>e.jsx(O,{column:a,title:n("plan.columns.renew"),tooltip:n("plan.columns.renew_tooltip")}),cell:({row:a})=>e.jsx(K,{defaultChecked:a.getValue("renew"),onCheckedChange:l=>{Ht({id:a.original.id,renew:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:a})=>e.jsx(O,{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(O,{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(ct,{}),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(O,{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(H,{variant:"secondary",className:_("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(O,{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:i,key:c,unit:m})=>l[c]!=null&&e.jsxs(H,{variant:"secondary",className:_("px-2 py-0.5 font-medium transition-colors text-nowrap",tn[c].color,tn[c].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[i," ¥",l[c],m]},c))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:a})=>e.jsx(O,{className:"justify-end",column:a,title:n("plan.columns.actions")}),cell:({row:a})=>{const{setIsOpen:l,setEditingPlan:r}=Ta();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{r(a.original),l(!0)},children:[e.jsx(Is,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.edit")})]}),e.jsx(Ue,{title:n("plan.columns.delete_confirm.title"),description:n("plan.columns.delete_confirm.description"),confirmText:n("plan.columns.delete"),variant:"destructive",onConfirm:async()=>{gd({id:a.original.id}).then(({data:i})=>{i&&($.success(n("plan.columns.delete_confirm.success")),s())})},children:e.jsxs(V,{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")})]})})]})}}]},px=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()}),Br=u.forwardRef(({className:s,...n},a)=>e.jsx(sr,{ref:a,className:_("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(Ei,{className:_("flex items-center justify-center text-current"),children:e.jsx(Rs,{className:"h-4 w-4"})})}));Br.displayName=sr.displayName;const jt={id:null,group_id:null,name:"",content:"",transfer_enable:"",prices:{monthly:"",quarterly:"",half_yearly:"",yearly:"",two_yearly:"",three_yearly:"",onetime:"",reset_traffic:""},speed_limit:"",capacity_limit:"",device_limit:"",force_update:!1,reset_traffic_method:null},vt={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}},gx=[{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 jx(){const{isOpen:s,setIsOpen:n,editingPlan:a,setEditingPlan:l,refreshData:r}=Ta(),[i,c]=u.useState(!1),{t:m}=I("subscribe"),x=de({resolver:ue(px),defaultValues:{...jt,...a||{}},mode:"onChange"});u.useEffect(()=>{a?x.reset({...jt,...a}):x.reset(jt)},[a,x]);const o=new ua({html:!0}),[d,p]=u.useState();async function P(){Ot().then(({data:g})=>{p(g)})}u.useEffect(()=>{s&&P()},[s]);const R=g=>{if(isNaN(g))return;const S=Object.entries(vt).reduce((j,[C,k])=>{const v=g*k.months*k.discount;return{...j,[C]:v.toFixed(2)}},{});x.setValue("prices",S,{shouldDirty:!0})},f=()=>{n(!1),l(null),x.reset(jt)};return e.jsx(ge,{open:s,onOpenChange:f,children:e.jsxs(fe,{children:[e.jsxs(be,{children:[e.jsx(je,{children:m(a?"plan.form.edit_title":"plan.form.add_title")}),e.jsx(Pe,{})]}),e.jsxs(xe,{...x,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{control:x.control,name:"name",render:({field:g})=>e.jsxs(b,{children:[e.jsx(N,{children:m("plan.form.name.label")}),e.jsx(w,{children:e.jsx(D,{placeholder:m("plan.form.name.placeholder"),...g})}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"group_id",render:({field:g})=>e.jsxs(b,{children:[e.jsxs(N,{className:"flex items-center justify-between",children:[m("plan.form.group.label"),e.jsx(Lt,{dialogTrigger:e.jsx(V,{variant:"link",children:m("plan.form.group.add")}),refetch:P})]}),e.jsxs(G,{value:g.value?.toString()??"",onValueChange:S=>g.onChange(S?Number(S):null),children:[e.jsx(w,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:m("plan.form.group.placeholder")})})}),e.jsx(B,{children:d?.map(S=>e.jsx(L,{value:S.id.toString(),children:S.name},S.id))})]}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"transfer_enable",render:({field:g})=>e.jsxs(b,{className:"flex-1",children:[e.jsx(N,{children:m("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(w,{children:e.jsx(D,{type:"number",min:0,placeholder:m("plan.form.transfer.placeholder"),className:"rounded-r-none",...g})}),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(y,{control:x.control,name:"speed_limit",render:({field:g})=>e.jsxs(b,{className:"flex-1",children:[e.jsx(N,{children:m("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(w,{children:e.jsx(D,{type:"number",min:0,placeholder:m("plan.form.speed.placeholder"),className:"rounded-r-none",...g,value:g.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:g=>{const S=parseFloat(g.target.value);R(S)}})]}),e.jsx(ce,{children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(V,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const g=Object.keys(vt).reduce((S,j)=>({...S,[j]:""}),{});x.setValue("prices",g,{shouldDirty:!0})},children:m("plan.form.price.clear.button")})}),e.jsx(te,{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(vt).filter(([g])=>!["onetime","reset_traffic"].includes(g)).map(([g,S])=>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(y,{control:x.control,name:`prices.${g}`,render:({field:j})=>e.jsxs(b,{children:[e.jsxs(N,{className:"text-xs font-medium text-muted-foreground",children:[m(`plan.columns.price_period.${g}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",S.months===1?m("plan.form.price.period.monthly"):m("plan.form.price.period.months",{count:S.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(w,{children:e.jsx(D,{type:"number",placeholder:"0.00",min:0,...j,value:j.value??"",onChange:C=>j.onChange(C.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"})})]})]})})},g))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(vt).filter(([g])=>["onetime","reset_traffic"].includes(g)).map(([g,S])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(y,{control:x.control,name:`prices.${g}`,render:({field:j})=>e.jsx(b,{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(N,{className:"text-xs font-medium",children:m(`plan.columns.price_period.${g}`)}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:m(g==="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(w,{children:e.jsx(D,{type:"number",placeholder:"0.00",min:0,...j,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"})})]})]})})})},g))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(y,{control:x.control,name:"device_limit",render:({field:g})=>e.jsxs(b,{className:"flex-1",children:[e.jsx(N,{children:m("plan.form.device.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(w,{children:e.jsx(D,{type:"number",min:0,placeholder:m("plan.form.device.placeholder"),className:"rounded-r-none",...g,value:g.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(y,{control:x.control,name:"capacity_limit",render:({field:g})=>e.jsxs(b,{className:"flex-1",children:[e.jsx(N,{children:m("plan.form.capacity.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(w,{children:e.jsx(D,{type:"number",min:0,placeholder:m("plan.form.capacity.placeholder"),className:"rounded-r-none",...g,value:g.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(y,{control:x.control,name:"reset_traffic_method",render:({field:g})=>e.jsxs(b,{children:[e.jsx(N,{children:m("plan.form.reset_method.label")}),e.jsxs(G,{value:g.value?.toString()??"null",onValueChange:S=>g.onChange(S=="null"?null:Number(S)),children:[e.jsx(w,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:m("plan.form.reset_method.placeholder")})})}),e.jsx(B,{children:gx.map(S=>e.jsx(L,{value:S.value?.toString()??"null",children:m(`plan.form.reset_method.options.${S.label}`)},S.value))})]}),e.jsx(M,{className:"text-xs",children:m("plan.form.reset_method.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:x.control,name:"content",render:({field:g})=>{const[S,j]=u.useState(!1);return e.jsxs(b,{className:"space-y-2",children:[e.jsxs(N,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[m("plan.form.content.label"),e.jsx(ce,{children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(V,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>j(!S),children:S?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(te,{side:"top",children:e.jsx("p",{className:"text-xs",children:m(S?"plan.form.content.preview_button.hide":"plan.form.content.preview_button.show")})})]})})]}),e.jsx(ce,{children:e.jsxs(oe,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(V,{variant:"outline",size:"sm",onClick:()=>{g.onChange(m("plan.form.content.template.content"))},children:m("plan.form.content.template.button")})}),e.jsx(te,{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 ${S?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"}`,children:[e.jsx("div",{className:"space-y-2",children:e.jsx(w,{children:e.jsx(xa,{style:{height:"400px"},value:g.value||"",renderHTML:C=>o.render(C),onChange:({text:C})=>g.onChange(C),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"})})}),S&&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(g.value||"")}})})]})]}),e.jsx(M,{className:"text-xs",children:m("plan.form.content.description")}),e.jsx(E,{})]})}})]}),e.jsx(Le,{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(y,{control:x.control,name:"force_update",render:({field:g})=>e.jsxs(b,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(w,{children:e.jsx(Br,{checked:g.value,onCheckedChange:g.onChange})}),e.jsx("div",{className:"",children:e.jsx(N,{className:"text-sm",children:m("plan.form.force_update.label")})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(V,{type:"button",variant:"outline",onClick:f,children:m("plan.form.submit.cancel")}),e.jsx(V,{type:"submit",disabled:i,onClick:()=>{x.handleSubmit(async g=>{c(!0),(await pd(g)).data&&($.success(m(a?"plan.form.submit.success.update":"plan.form.submit.success.add")),f(),r()),c(!1)})()},children:m(i?"plan.form.submit.submitting":"plan.form.submit.submit")})]})]})})]})]})})}function vx(){const[s,n]=u.useState({}),[a,l]=u.useState({"drag-handle":!1}),[r,i]=u.useState([]),[c,m]=u.useState([]),[x,o]=u.useState(!1),[d,p]=u.useState({pageSize:20,pageIndex:0}),[P,R]=u.useState([]),{refetch:f}=se({queryKey:["planList"],queryFn:async()=>{const{data:k}=await Os();return R(k),k}});u.useEffect(()=>{l({"drag-handle":x}),p({pageSize:x?99999:10,pageIndex:0})},[x]);const g=(k,v)=>{x&&(k.dataTransfer.setData("text/plain",v.toString()),k.currentTarget.classList.add("opacity-50"))},S=(k,v)=>{if(!x)return;k.preventDefault(),k.currentTarget.classList.remove("bg-muted");const T=parseInt(k.dataTransfer.getData("text/plain"));if(T===v)return;const z=[...P],[Q]=z.splice(T,1);z.splice(v,0,Q),R(z)},j=async()=>{if(!x){o(!0);return}const k=P?.map(v=>v.id);jd(k).then(()=>{$.success("排序保存成功"),o(!1),f()}).finally(()=>{o(!1)})},C=He({data:P||[],columns:fx(f),state:{sorting:c,columnVisibility:a,rowSelection:s,columnFilters:r,pagination:d},enableRowSelection:!0,onPaginationChange:p,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:i,onColumnVisibilityChange:l,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),getSortedRowModel:Ze(),getFacetedRowModel:us(),getFacetedUniqueValues:xs(),initialState:{columnPinning:{right:["actions"]}},pageCount:x?1:void 0});return e.jsx(xx,{refreshData:f,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(es,{table:C,toolbar:k=>e.jsx(hx,{table:k,refetch:f,saveOrder:j,isSortMode:x}),draggable:x,onDragStart:g,onDragEnd:k=>k.currentTarget.classList.remove("opacity-50"),onDragOver:k=>{k.preventDefault(),k.currentTarget.classList.add("bg-muted")},onDragLeave:k=>k.currentTarget.classList.remove("bg-muted"),onDrop:S,showPagination:!x}),e.jsx(jx,{})]})})}function bx(){const{t:s}=I("subscribe");return e.jsxs(we,{children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(vx,{})})]})]})}const yx=Object.freeze(Object.defineProperty({__proto__:null,default:bx},Symbol.toStringTag,{value:"Module"})),$s=[{value:Z.PENDING,label:Zs[Z.PENDING],icon:Ri,color:Xs[Z.PENDING]},{value:Z.PROCESSING,label:Zs[Z.PROCESSING],icon:tr,color:Xs[Z.PROCESSING]},{value:Z.COMPLETED,label:Zs[Z.COMPLETED],icon:ea,color:Xs[Z.COMPLETED]},{value:Z.CANCELLED,label:Zs[Z.CANCELLED],icon:ar,color:Xs[Z.CANCELLED]},{value:Z.DISCOUNTED,label:Zs[Z.DISCOUNTED],icon:ea,color:Xs[Z.DISCOUNTED]}],st=[{value:re.PENDING,label:ht[re.PENDING],icon:Vi,color:ft[re.PENDING]},{value:re.PROCESSING,label:ht[re.PROCESSING],icon:tr,color:ft[re.PROCESSING]},{value:re.VALID,label:ht[re.VALID],icon:ea,color:ft[re.VALID]},{value:re.INVALID,label:ht[re.INVALID],icon:ar,color:ft[re.INVALID]}];function bt({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=s?.getFilterValue(),i=Array.isArray(r)?new Set(r):r!==void 0?new Set([r]):new Set;return e.jsxs(rs,{children:[e.jsx(ls,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(mt,{className:"mr-2 h-4 w-4"}),n,i?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ye,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:i.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:i.size>2?e.jsxs(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[i.size," selected"]}):a.filter(c=>i.has(c.value)).map(c=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Cs,{children:[e.jsx(Fs,{placeholder:n}),e.jsxs(Ss,{children:[e.jsx(Ms,{children:"No results found."}),e.jsx(Oe,{children:a.map(c=>{const m=i.has(c.value);return e.jsxs(ke,{onSelect:()=>{const x=new Set(i);m?x.delete(c.value):x.add(c.value);const o=Array.from(x);s?.setFilterValue(o.length?o:void 0)},children:[e.jsx("div",{className:_("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(Rs,{className:_("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)})}),i.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Gs,{}),e.jsx(Oe,{children:e.jsx(ke,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Nx=h.object({email:h.string().min(1),plan_id:h.number(),period:h.string(),total_amount:h.number()}),_x={email:"",plan_id:0,total_amount:0,period:""};function Gr({refetch:s,trigger:n,defaultValues:a}){const{t:l}=I("order"),[r,i]=u.useState(!1),c=de({resolver:ue(Nx),defaultValues:{..._x,...a},mode:"onChange"}),[m,x]=u.useState([]);return u.useEffect(()=>{r&&Os().then(({data:o})=>{x(o)})},[r]),e.jsxs(ge,{open:r,onOpenChange:i,children:[e.jsx(ze,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Se,{icon:"ion:add"}),e.jsx("div",{children:l("dialog.addOrder")})]})}),e.jsxs(fe,{className:"sm:max-w-[425px]",children:[e.jsxs(be,{children:[e.jsx(je,{children:l("dialog.assignOrder")}),e.jsx(Pe,{})]}),e.jsxs(xe,{...c,children:[e.jsx(y,{control:c.control,name:"email",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dialog.fields.userEmail")}),e.jsx(w,{children:e.jsx(D,{placeholder:l("dialog.placeholders.email"),...o})})]})}),e.jsx(y,{control:c.control,name:"plan_id",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dialog.fields.subscriptionPlan")}),e.jsx(w,{children:e.jsxs(G,{value:o.value?o.value?.toString():void 0,onValueChange:d=>o.onChange(parseInt(d)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dialog.placeholders.plan")})}),e.jsx(B,{children:m.map(d=>e.jsx(L,{value:d.id.toString(),children:d.name},d.id))})]})})]})}),e.jsx(y,{control:c.control,name:"period",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dialog.fields.orderPeriod")}),e.jsx(w,{children:e.jsxs(G,{value:o.value,onValueChange:o.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dialog.placeholders.period")})}),e.jsx(B,{children:Object.keys(Gd).map(d=>e.jsx(L,{value:d,children:l(`period.${d}`)},d))})]})})]})}),e.jsx(y,{control:c.control,name:"total_amount",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:l("dialog.fields.paymentAmount")}),e.jsx(w,{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(Le,{children:[e.jsx(V,{variant:"outline",onClick:()=>i(!1),children:l("dialog.actions.cancel")}),e.jsx(V,{type:"submit",onClick:()=>{c.handleSubmit(o=>{_d(o).then(({data:d})=>{d&&(s&&s(),c.reset(),i(!1),$.success(l("dialog.messages.addSuccess")))})})()},children:l("dialog.actions.confirm")})]})]})]})]})}function wx({table:s,refetch:n}){const{t:a}=I("order"),l=s.getState().columnFilters.length>0,r=Object.values(We).filter(x=>typeof x=="number").map(x=>({label:a(`type.${We[x]}`),value:x,color:x===We.NEW?"green-500":x===We.RENEWAL?"blue-500":x===We.UPGRADE?"purple-500":"orange-500"})),i=Object.values(_e).map(x=>({label:a(`period.${x}`),value:x,color:x===_e.MONTH_PRICE?"slate-500":x===_e.QUARTER_PRICE?"cyan-500":x===_e.HALF_YEAR_PRICE?"indigo-500":x===_e.YEAR_PRICE?"violet-500":x===_e.TWO_YEAR_PRICE?"fuchsia-500":x===_e.THREE_YEAR_PRICE?"pink-500":x===_e.ONETIME_PRICE?"rose-500":"orange-500"})),c=Object.values(Z).filter(x=>typeof x=="number").map(x=>({label:a(`status.${Z[x]}`),value:x,icon:x===Z.PENDING?$s[0].icon:x===Z.PROCESSING?$s[1].icon:x===Z.COMPLETED?$s[2].icon:x===Z.CANCELLED?$s[3].icon:$s[4].icon,color:x===Z.PENDING?"yellow-500":x===Z.PROCESSING?"blue-500":x===Z.COMPLETED?"green-500":x===Z.CANCELLED?"red-500":"green-500"})),m=Object.values(re).filter(x=>typeof x=="number").map(x=>({label:a(`commission.${re[x]}`),value:x,icon:x===re.PENDING?st[0].icon:x===re.PROCESSING?st[1].icon:x===re.VALID?st[2].icon:st[3].icon,color:x===re.PENDING?"yellow-500":x===re.PROCESSING?"blue-500":x===re.VALID?"green-500":"red-500"}));return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Gr,{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(bt,{column:s.getColumn("type"),title:a("table.columns.type"),options:r}),s.getColumn("period")&&e.jsx(bt,{column:s.getColumn("period"),title:a("table.columns.period"),options:i}),s.getColumn("status")&&e.jsx(bt,{column:s.getColumn("status"),title:a("table.columns.status"),options:c}),s.getColumn("commission_status")&&e.jsx(bt,{column:s.getColumn("commission_status"),title:a("table.columns.commissionStatus"),options:m})]}),l&&e.jsxs(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[a("actions.reset"),e.jsx(Ae,{className:"ml-2 h-4 w-4"})]})]})}function Be({label:s,value:n,className:a,valueClassName:l}){return e.jsxs("div",{className:_("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:_("text-sm",l),children:n||"-"})]})}function Cx({status:s}){const{t:n}=I("order"),a={[Z.PENDING]:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",[Z.PROCESSING]:"bg-blue-100 text-blue-800 hover:bg-blue-100",[Z.CANCELLED]:"bg-red-100 text-red-800 hover:bg-red-100",[Z.COMPLETED]:"bg-green-100 text-green-800 hover:bg-green-100",[Z.DISCOUNTED]:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(H,{variant:"secondary",className:_("font-medium",a[s]),children:n(`status.${Z[s]}`)})}function Sx({id:s,trigger:n}){const[a,l]=u.useState(!1),[r,i]=u.useState(),{t:c}=I("order");return u.useEffect(()=>{(async()=>{if(a){const{data:x}=await bd({id:s});i(x)}})()},[a,s]),e.jsxs(ge,{onOpenChange:l,open:a,children:[e.jsx(ze,{asChild:!0,children:n}),e.jsxs(fe,{className:"max-w-xl",children:[e.jsxs(be,{className:"space-y-2",children:[e.jsx(je,{className:"text-lg font-medium",children:c("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:[c("table.columns.tradeNo"),":",r?.trade_no]}),r?.status&&e.jsx(Cx,{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:c("dialog.basicInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Be,{label:c("dialog.fields.userEmail"),value:r?.user?.email?e.jsxs(Vs,{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(nr,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(Be,{label:c("dialog.fields.orderPeriod"),value:r&&c(`period.${r.period}`)}),e.jsx(Be,{label:c("dialog.fields.subscriptionPlan"),value:r?.plan?.name,valueClassName:"font-medium"}),e.jsx(Be,{label:c("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:c("dialog.amountInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Be,{label:c("dialog.fields.paymentAmount"),value:Ts(r?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(ye,{className:"my-2"}),e.jsx(Be,{label:c("dialog.fields.balancePayment"),value:Ts(r?.balance_amount||0)}),e.jsx(Be,{label:c("dialog.fields.discountAmount"),value:Ts(r?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(Be,{label:c("dialog.fields.refundAmount"),value:Ts(r?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(Be,{label:c("dialog.fields.deductionAmount"),value:Ts(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:c("dialog.timeInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Be,{label:c("dialog.fields.createdAt"),value:he(r?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(Be,{label:c("dialog.fields.updatedAt"),value:he(r?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const kx={[We.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[We.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[We.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[We.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Tx={[_e.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[_e.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[_e.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[_e.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[_e.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[_e.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[_e.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[_e.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Px=s=>Z[s],Dx=s=>re[s],Ex=s=>We[s],Rx=s=>{const{t:n}=I("order");return[{accessorKey:"trade_no",header:({column:a})=>e.jsx(O,{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(Sx,{trigger:e.jsxs(J,{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(nr,{className:"h-3.5 w-3.5 opacity-70"})]}),id:a.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.type")}),cell:({row:a})=>{const l=a.getValue("type"),r=kx[l];return e.jsx(H,{variant:"secondary",className:_("font-medium transition-colors text-nowrap",r.color,r.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:n(`type.${Ex(l)}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:a})=>e.jsx(O,{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(O,{column:a,title:n("table.columns.period")}),cell:({row:a})=>{const l=a.getValue("period"),r=Tx[l];return e.jsx(H,{variant:"secondary",className:_("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(O,{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(O,{column:a,title:n("table.columns.status")}),e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{children:e.jsx(zr,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(te,{side:"top",className:"max-w-[200px] text-sm",children:n("status.tooltip")})]})})]}),cell:({row:a})=>{const l=$s.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.${Px(l.value)}`)})]}),l.value===Z.PENDING&&e.jsxs(_s,{modal:!0,children:[e.jsx(ws,{asChild:!0,children:e.jsxs(J,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(ds,{align:"end",className:"w-[140px]",children:[e.jsx(pe,{className:"cursor-pointer",onClick:async()=>{await yd({trade_no:a.original.trade_no}),s()},children:n("actions.markAsPaid")}),e.jsx(pe,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Nd({trade_no:a.original.trade_no}),s()},children:n("actions.cancel")})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:a})=>e.jsx(O,{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(O,{column:a,title:n("table.columns.commissionStatus")}),cell:({row:a})=>{const l=a.original.status,r=a.original.commission_balance,i=st.find(c=>c.value===a.getValue("commission_status"));return r==0||!i?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:[i.icon&&e.jsx(i.icon,{className:`h-4 w-4 text-${i.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n(`commission.${Dx(i.value)}`)})]}),i.value===re.PENDING&&l===Z.COMPLETED&&e.jsxs(_s,{modal:!0,children:[e.jsx(ws,{asChild:!0,children:e.jsxs(J,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(ds,{align:"end",className:"w-[120px]",children:[e.jsx(pe,{className:"cursor-pointer",onClick:async()=>{await Ya({trade_no:a.original.trade_no,commission_status:re.PROCESSING}),s()},children:n("commission.PROCESSING")}),e.jsx(pe,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ya({trade_no:a.original.trade_no,commission_status:re.INVALID}),s()},children:n("commission.INVALID")})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.createdAt")}),cell:({row:a})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:he(a.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}]};function Vx(){const[s]=rr(),[n,a]=u.useState({}),[l,r]=u.useState({}),[i,c]=u.useState([]),[m,x]=u.useState([]),[o,d]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const S=Object.entries({user_id:"string",order_id:"string",commission_status:"number",status:"number",commission_balance:"string"}).map(([j,C])=>{const k=s.get(j);return k?{id:j,value:C==="number"?parseInt(k):k}:null}).filter(Boolean);S.length>0&&c(S)},[s]);const{refetch:p,data:P,isLoading:R}=se({queryKey:["orderList",o,i,m],queryFn:()=>vd({pageSize:o.pageSize,current:o.pageIndex+1,filter:i,sort:m})}),f=He({data:P?.data??[],columns:Rx(p),state:{sorting:m,columnVisibility:l,rowSelection:n,columnFilters:i,pagination:o},rowCount:P?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:r,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),onPaginationChange:d,getSortedRowModel:Ze(),getFacetedRowModel:us(),getFacetedUniqueValues:xs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(es,{table:f,toolbar:e.jsx(wx,{table:f,refetch:p}),showPagination:!0})}function Ix(){const{t:s}=I("order");return e.jsxs(we,{children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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 Fx=Object.freeze(Object.defineProperty({__proto__:null,default:Ix},Symbol.toStringTag,{value:"Module"}));function Mx({column:s,title:n,options:a}){const l=s?.getFacetedUniqueValues(),r=new Set(s?.getFilterValue());return e.jsxs(rs,{children:[e.jsx(ls,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(mt,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ye,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{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(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(i=>r.has(i.value)).map(i=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Cs,{children:[e.jsx(Fs,{placeholder:n}),e.jsxs(Ss,{children:[e.jsx(Ms,{children:"No results found."}),e.jsx(Oe,{children:a.map(i=>{const c=r.has(i.value);return e.jsxs(ke,{onSelect:()=>{c?r.delete(i.value):r.add(i.value);const m=Array.from(r);s?.setFilterValue(m.length?m:void 0)},children:[e.jsx("div",{className:_("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(Rs,{className:_("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)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Gs,{}),e.jsx(Oe,{children:e.jsx(ke,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Ox=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(nt)).default([]).nullable()}).refine(s=>s.ended_at>s.started_at,{message:"结束时间必须晚于开始时间",path:["ended_at"]}),an={name:"",code:"",type:Fe.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:i}){const{t:c}=I("coupon"),[m,x]=u.useState(!1),o=r??m,d=i??x,[p,P]=u.useState([]),R=de({resolver:ue(Ox),defaultValues:s||an});u.useEffect(()=>{s&&R.reset(s)},[s,R]),u.useEffect(()=>{Os().then(({data:j})=>P(j))},[]);const f=j=>{if(!j)return;const C=(k,v)=>{const T=new Date(v*1e3);return k.setHours(T.getHours(),T.getMinutes(),T.getSeconds()),Math.floor(k.getTime()/1e3)};j.from&&R.setValue("started_at",C(j.from,R.watch("started_at"))),j.to&&R.setValue("ended_at",C(j.to,R.watch("ended_at")))},g=async j=>{Cd(j).then(()=>{d(!1),a==="create"&&R.reset(an),n()})},S=(j,C)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:C}),e.jsx(D,{type:"datetime-local",step:"1",value:he(R.watch(j),"YYYY-MM-DDTHH:mm:ss"),onChange:k=>{const v=new Date(k.target.value);R.setValue(j,Math.floor(v.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(ge,{open:o,onOpenChange:d,children:[l&&e.jsx(ze,{asChild:!0,children:l}),e.jsxs(fe,{className:"sm:max-w-[425px]",children:[e.jsx(be,{children:e.jsx(je,{children:c(a==="create"?"form.add":"form.edit")})}),e.jsx(xe,{...R,children:e.jsxs("form",{onSubmit:R.handleSubmit(g),className:"space-y-4",children:[e.jsx(y,{control:R.control,name:"name",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:c("form.name.label")}),e.jsx(D,{placeholder:c("form.name.placeholder"),...j}),e.jsx(E,{})]})}),e.jsx(y,{control:R.control,name:"code",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:c("form.code.label")}),e.jsx(D,{placeholder:c("form.code.placeholder"),...j,className:"h-9"}),e.jsx(M,{className:"text-xs",children:c("form.code.description")}),e.jsx(E,{})]})}),e.jsxs(b,{children:[e.jsx(N,{children:c("form.type.label")}),e.jsxs("div",{className:"flex",children:[e.jsx(y,{control:R.control,name:"type",render:({field:j})=>e.jsxs(G,{value:j.value.toString(),onValueChange:C=>{const k=j.value,v=parseInt(C);j.onChange(v);const T=R.getValues("value");T&&(k===Fe.AMOUNT&&v===Fe.PERCENT?R.setValue("value",T/100):k===Fe.PERCENT&&v===Fe.AMOUNT&&R.setValue("value",T*100))},children:[e.jsx(U,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(Y,{placeholder:c("form.type.placeholder")})}),e.jsx(B,{children:Object.entries(Yd).map(([C,k])=>e.jsx(L,{value:C,children:c(`table.toolbar.types.${C}`)},C))})]})}),e.jsx(y,{control:R.control,name:"value",render:({field:j})=>{const C=j.value===""?"":R.watch("type")===Fe.AMOUNT&&typeof j.value=="number"?(j.value/100).toString():j.value.toString();return e.jsx(D,{type:"number",placeholder:c("form.value.placeholder"),...j,value:C,onChange:k=>{const v=k.target.value;if(v===""){j.onChange("");return}const T=parseFloat(v);isNaN(T)||j.onChange(R.watch("type")===Fe.AMOUNT?Math.round(T*100):T)},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:R.watch("type")==Fe.AMOUNT?"¥":"%"})})]})]}),e.jsxs(b,{children:[e.jsx(N,{children:c("form.validity.label")}),e.jsxs(rs,{children:[e.jsx(ls,{asChild:!0,children:e.jsxs(V,{variant:"outline",className:_("w-full justify-start text-left font-normal",!R.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(dt,{className:"mr-2 h-4 w-4"}),he(R.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ",c("form.validity.to")," ",he(R.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(Xe,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(zs,{mode:"range",selected:{from:new Date(R.watch("started_at")*1e3),to:new Date(R.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:[S("started_at",c("table.validity.startTime")),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:c("form.validity.to")}),S("ended_at",c("table.validity.endTime"))]})})]})]}),e.jsx(E,{})]}),e.jsx(y,{control:R.control,name:"limit_use",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:c("form.limitUse.label")}),e.jsx(D,{type:"number",min:0,placeholder:c("form.limitUse.placeholder"),...j,value:j.value===void 0?"":j.value,onChange:C=>j.onChange(C.target.value===""?"":C.target.value),className:"h-9"}),e.jsx(M,{className:"text-xs",children:c("form.limitUse.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:R.control,name:"limit_use_with_user",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:c("form.limitUseWithUser.label")}),e.jsx(D,{type:"number",min:0,placeholder:c("form.limitUseWithUser.placeholder"),...j,value:j.value===void 0?"":j.value,onChange:C=>j.onChange(C.target.value===""?"":C.target.value),className:"h-9"}),e.jsx(M,{className:"text-xs",children:c("form.limitUseWithUser.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:R.control,name:"limit_period",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:c("form.limitPeriod.label")}),e.jsx(it,{options:Object.entries(nt).filter(([C])=>isNaN(Number(C))).map(([C,k])=>({label:c(`coupon:period.${k}`),value:C})),onChange:C=>{if(C.length===0){j.onChange([]);return}const k=C.map(v=>nt[v.value]);j.onChange(k)},value:(j.value||[]).map(C=>({label:c(`coupon:period.${C}`),value:Object.entries(nt).find(([k,v])=>v===C)?.[0]||""})),placeholder:c("form.limitPeriod.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:c("form.limitPeriod.empty")})}),e.jsx(M,{className:"text-xs",children:c("form.limitPeriod.description")}),e.jsx(E,{})]})}),e.jsx(y,{control:R.control,name:"limit_plan_ids",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:c("form.limitPlan.label")}),e.jsx(it,{options:p?.map(C=>({label:C.name,value:C.id.toString()}))||[],onChange:C=>j.onChange(C.map(k=>Number(k.value))),value:(p||[]).filter(C=>(j.value||[]).includes(C.id)).map(C=>({label:C.name,value:C.id.toString()})),placeholder:c("form.limitPlan.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:c("form.limitPlan.empty")})}),e.jsx(E,{})]})}),a==="create"&&e.jsx(e.Fragment,{children:e.jsx(y,{control:R.control,name:"generate_count",render:({field:j})=>e.jsxs(b,{children:[e.jsx(N,{children:c("form.generateCount.label")}),e.jsx(D,{type:"number",min:0,placeholder:c("form.generateCount.placeholder"),...j,value:j.value===void 0?"":j.value,onChange:C=>j.onChange(C.target.value===""?"":C.target.value),className:"h-9"}),e.jsx(M,{className:"text-xs",children:c("form.generateCount.description")}),e.jsx(E,{})]})})}),e.jsx(Le,{children:e.jsx(V,{type:"submit",disabled:R.formState.isSubmitting,children:R.formState.isSubmitting?c("form.submit.saving"):c("form.submit.save")})})]})})]})]})}function zx({table:s,refetch:n}){const a=s.getState().columnFilters.length>0,{t:l}=I("coupon");return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Yr,{refetch:n,dialogTrigger:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Se,{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(Mx,{column:s.getColumn("type"),title:l("table.toolbar.type"),options:[{value:Fe.AMOUNT,label:l(`table.toolbar.types.${Fe.AMOUNT}`)},{value:Fe.PERCENTAGE,label:l(`table.toolbar.types.${Fe.PERCENTAGE}`)}]}),a&&e.jsxs(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("table.toolbar.reset"),e.jsx(Ae,{className:"ml-2 h-4 w-4"})]})]})}const Wr=u.createContext(void 0);function Lx({children:s,refetch:n}){const[a,l]=u.useState(!1),[r,i]=u.useState(null),c=x=>{i(x),l(!0)},m=()=>{l(!1),i(null)};return e.jsxs(Wr.Provider,{value:{isOpen:a,currentCoupon:r,openEdit:c,closeEdit:m},children:[s,r&&e.jsx(Yr,{defaultValues:r,refetch:n,type:"edit",open:a,onOpenChange:l})]})}function Ax(){const s=u.useContext(Wr);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const $x=s=>{const{t:n}=I("coupon");return[{accessorKey:"id",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.id")}),cell:({row:a})=>e.jsx(H,{children:a.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.show")}),cell:({row:a})=>e.jsx(K,{defaultChecked:a.original.show,onCheckedChange:l=>{kd({id:a.original.id,show:l}).then(({data:r})=>!r&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:a})=>e.jsx(O,{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(O,{column:a,title:n("table.columns.type")}),cell:({row:a})=>e.jsx(H,{variant:"outline",children:n(`table.toolbar.types.${a.original.type}`)}),enableSorting:!0},{accessorKey:"code",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.code")}),cell:({row:a})=>e.jsx(H,{variant:"secondary",children:a.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.limitUse")}),cell:({row:a})=>e.jsx(H,{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(O,{column:a,title:n("table.columns.limitUseWithUser")}),cell:({row:a})=>e.jsx(H,{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(O,{column:a,title:n("table.columns.validity")}),cell:({row:a})=>{const[l,r]=u.useState(!1),i=Date.now(),c=a.original.started_at*1e3,m=a.original.ended_at*1e3,x=i>m,o=ie.jsx(O,{className:"justify-end",column:a,title:n("table.columns.actions")}),cell:({row:a})=>{const{openEdit:l}=Ax();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>l(a.original),children:[e.jsx(Is,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),e.jsx(Ue,{title:n("table.actions.deleteConfirm.title"),description:n("table.actions.deleteConfirm.description"),confirmText:n("table.actions.deleteConfirm.confirmText"),variant:"destructive",onConfirm:async()=>{Sd({id:a.original.id}).then(({data:r})=>{r&&($.success("删除成功"),s())})},children:e.jsxs(V,{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,i]=u.useState([]),[c,m]=u.useState([]),[x,o]=u.useState({pageIndex:0,pageSize:20}),{refetch:d,data:p}=se({queryKey:["couponList",x,r,c],queryFn:()=>wd({pageSize:x.pageSize,current:x.pageIndex+1,filter:r,sort:c})}),P=He({data:p?.data??[],columns:$x(d),state:{sorting:c,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:i,onColumnVisibilityChange:l,onPaginationChange:o,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),getSortedRowModel:Ze(),getFacetedRowModel:us(),getFacetedUniqueValues:xs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Lx,{refetch:d,children:e.jsx("div",{className:"space-y-4",children:e.jsx(es,{table:P,toolbar:e.jsx(zx,{table:P,refetch:d})})})})}function Hx(){const{t:s}=I("coupon");return e.jsxs(we,{children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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 Kx=Object.freeze(Object.defineProperty({__proto__:null,default:Hx},Symbol.toStringTag,{value:"Module"})),Ux=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"]}),Bx={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0};function Gx({refetch:s}){const{t:n}=I("user"),[a,l]=u.useState(!1),r=de({resolver:ue(Ux),defaultValues:Bx,mode:"onChange"}),[i,c]=u.useState([]);return u.useEffect(()=>{a&&Os().then(({data:m})=>{m&&c(m)})},[a]),e.jsxs(ge,{open:a,onOpenChange:l,children:[e.jsx(ze,{asChild:!0,children:e.jsxs(J,{size:"sm",variant:"outline",className:"space-x-2 gap-0",children:[e.jsx(Se,{icon:"ion:add"}),e.jsx("div",{children:n("generate.button")})]})}),e.jsxs(fe,{className:"sm:max-w-[425px]",children:[e.jsxs(be,{children:[e.jsx(je,{children:n("generate.title")}),e.jsx(Pe,{})]}),e.jsxs(xe,{...r,children:[e.jsxs(b,{children:[e.jsx(N,{children:n("generate.form.email")}),e.jsxs("div",{className:"flex",children:[!r.watch("generate_count")&&e.jsx(y,{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(y,{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(y,{control:r.control,name:"password",render:({field:m})=>e.jsxs(b,{children:[e.jsx(N,{children:n("generate.form.password")}),e.jsx(D,{placeholder:n("generate.form.password_placeholder"),...m}),e.jsx(E,{})]})}),e.jsx(y,{control:r.control,name:"expired_at",render:({field:m})=>e.jsxs(b,{className:"flex flex-col",children:[e.jsx(N,{children:n("generate.form.expire_time")}),e.jsxs(rs,{children:[e.jsx(ls,{asChild:!0,children:e.jsx(w,{children:e.jsxs(J,{variant:"outline",className:_("w-full pl-3 text-left font-normal",!m.value&&"text-muted-foreground"),children:[m.value?he(m.value):e.jsx("span",{children:n("generate.form.expire_time_placeholder")}),e.jsx(dt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(Xe,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(Fi,{asChild:!0,children:e.jsx(J,{variant:"outline",className:"w-full",onClick:()=>{m.onChange(null)},children:n("generate.form.permanent")})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(zs,{mode:"single",selected:m.value?new Date(m.value*1e3):void 0,onSelect:x=>{x&&m.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(y,{control:r.control,name:"plan_id",render:({field:m})=>e.jsxs(b,{children:[e.jsx(N,{children:n("generate.form.subscription")}),e.jsx(w,{children:e.jsxs(G,{value:m.value?m.value.toString():"null",onValueChange:x=>m.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:n("generate.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(L,{value:"null",children:n("generate.form.subscription_none")}),i.map(x=>e.jsx(L,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!r.watch("email_prefix")&&e.jsx(y,{control:r.control,name:"generate_count",render:({field:m})=>e.jsxs(b,{children:[e.jsx(N,{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(Le,{children:[e.jsx(J,{variant:"outline",onClick:()=>l(!1),children:n("generate.form.cancel")}),e.jsx(J,{onClick:()=>r.handleSubmit(m=>{Ed(m).then(({data:x})=>{x&&($.success(n("generate.form.success")),r.reset(),s(),l(!1))})})(),children:n("generate.form.submit")})]})]})]})}const Jr=ln,Qr=on,Yx=cn,Zr=u.forwardRef(({className:s,...n},a)=>e.jsx(Pt,{className:_("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=Pt.displayName;const Wx=Es("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"}}),Pa=u.forwardRef(({side:s="right",className:n,children:a,...l},r)=>e.jsxs(Yx,{children:[e.jsx(Zr,{}),e.jsxs(Dt,{ref:r,className:_(Wx({side:s}),n),...l,children:[e.jsxs(oa,{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(Ae,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),a]})]}));Pa.displayName=Dt.displayName;const Da=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col space-y-2 text-center sm:text-left",s),...n});Da.displayName="SheetHeader";const Xr=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Xr.displayName="SheetFooter";const Ea=u.forwardRef(({className:s,...n},a)=>e.jsx(Et,{ref:a,className:_("text-lg font-semibold text-foreground",s),...n}));Ea.displayName=Et.displayName;const Ra=u.forwardRef(({className:s,...n},a)=>e.jsx(Rt,{ref:a,className:_("text-sm text-muted-foreground",s),...n}));Ra.displayName=Rt.displayName;function Jx({table:s,refetch:n,permissionGroups:a=[],subscriptionPlans:l=[]}){const{t:r}=I("user"),i=s.getState().columnFilters.length>0,[c,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=C=>C*1024*1024*1024,P=C=>C/(1024*1024*1024),R=()=>{m([...c,{field:"",operator:"",value:""}])},f=C=>{m(c.filter((k,v)=>v!==C))},g=(C,k,v)=>{const T=[...c];if(T[C]={...T[C],[k]:v},k==="field"){const z=d.find(Q=>Q.value===v);z&&(T[C].operator=z.operators[0].value,T[C].value=z.type==="boolean"?!1:"")}m(T)},S=(C,k)=>{const v=d.find(T=>T.value===C.field);if(!v)return null;switch(v.type){case"text":return e.jsx(D,{placeholder:r("filter.sheet.value"),value:C.value,onChange:T=>g(k,"value",T.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:v.unit}),value:v.unit==="GB"?P(C.value||0):C.value,onChange:T=>{const z=Number(T.target.value);g(k,"value",v.unit==="GB"?p(z):z)}}),v.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:v.unit})]});case"date":return e.jsx(zs,{mode:"single",selected:C.value,onSelect:T=>g(k,"value",T),className:"rounded-md border"});case"select":return e.jsxs(G,{value:C.value,onValueChange:T=>g(k,"value",T),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("filter.sheet.value")})}),e.jsx(B,{children:v.useOptions?l.map(T=>e.jsx(L,{value:T.value.toString(),children:T.label},T.value)):v.options?.map(T=>e.jsx(L,{value:T.value.toString(),children:T.label},T.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(K,{checked:C.value,onCheckedChange:T=>g(k,"value",T)}),e.jsx(St,{children:C.value?r("filter.boolean.true"):r("filter.boolean.false")})]});default:return null}},j=()=>{const C=c.filter(k=>k.field&&k.operator&&k.value!=="").map(k=>{const v=d.find(z=>z.value===k.field);let T=k.value;return k.operator==="contains"?{id:k.field,value:T}:(v?.type==="date"&&T instanceof Date&&(T=Math.floor(T.getTime()/1e3)),v?.type==="boolean"&&(T=T?1:0),{id:k.field,value:`${k.operator}:${T}`})});s.setColumnFilters(C),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(Gx,{refetch:n}),e.jsx(D,{placeholder:r("filter.email_search"),value:s.getColumn("email")?.getFilterValue()??"",onChange:C=>s.getColumn("email")?.setFilterValue(C.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(Jr,{open:x,onOpenChange:o,children:[e.jsx(Qr,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Mi,{className:"mr-2 h-4 w-4"}),r("filter.advanced"),c.length>0&&e.jsx(H,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:c.length})]})}),e.jsxs(Pa,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(Da,{children:[e.jsx(Ea,{children:r("filter.sheet.title")}),e.jsx(Ra,{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(V,{variant:"outline",size:"sm",onClick:R,children:r("filter.sheet.add")})]}),e.jsx(ot,{className:"h-[calc(100vh-280px)] pr-4",children:e.jsx("div",{className:"space-y-4",children:c.map((C,k)=>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(St,{children:r("filter.sheet.condition",{number:k+1})}),e.jsx(V,{variant:"ghost",size:"sm",onClick:()=>f(k),children:e.jsx(Ae,{className:"h-4 w-4"})})]}),e.jsxs(G,{value:C.field,onValueChange:v=>g(k,"field",v),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("filter.sheet.field")})}),e.jsx(B,{children:d.map(v=>e.jsx(L,{value:v.value,children:v.label},v.value))})]}),C.field&&e.jsxs(G,{value:C.operator,onValueChange:v=>g(k,"operator",v),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("filter.sheet.operator")})}),e.jsx(B,{children:d.find(v=>v.value===C.field)?.operators.map(v=>e.jsx(L,{value:v.value,children:v.label},v.value))})]}),C.field&&C.operator&&S(C,k)]},k))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(V,{variant:"outline",onClick:()=>{m([]),o(!1)},children:r("filter.sheet.reset")}),e.jsx(V,{onClick:j,children:r("filter.sheet.apply")})]})]})]})]}),i&&e.jsxs(V,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),m([])},className:"h-8 px-2 lg:px-3",children:[r("filter.reset"),e.jsx(Ae,{className:"ml-2 h-4 w-4"})]})]})})}const Qx=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()}),el=u.createContext(void 0);function Zx({children:s,defaultValues:n,open:a,onOpenChange:l}){const[r,i]=u.useState(!1),[c,m]=u.useState(!1),[x,o]=u.useState([]),d=de({resolver:ue(Qx),defaultValues:n,mode:"onChange"});u.useEffect(()=>{a!==void 0&&i(a)},[a]);const p=P=>{i(P),l?.(P)};return e.jsx(el.Provider,{value:{form:d,formOpen:r,setFormOpen:p,datePickerOpen:c,setDatePickerOpen:m,planList:x,setPlanList:o},children:s})}function Xx(){const s=u.useContext(el);if(!s)throw new Error("useUserForm must be used within a UserFormProvider");return s}function eh({refetch:s}){const{t:n}=I("user"),{form:a,formOpen:l,setFormOpen:r,datePickerOpen:i,setDatePickerOpen:c,planList:m,setPlanList:x}=Xx();return u.useEffect(()=>{l&&Os().then(({data:o})=>{x(o)})},[l,x]),e.jsxs(xe,{...a,children:[e.jsx(y,{control:a.control,name:"email",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.email")}),e.jsx(w,{children:e.jsx(D,{...o,placeholder:n("edit.form.email_placeholder")})}),e.jsx(E,{...o})]})}),e.jsx(y,{control:a.control,name:"invite_user_email",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.inviter_email")}),e.jsx(w,{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(y,{control:a.control,name:"password",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.password")}),e.jsx(w,{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(y,{control:a.control,name:"balance",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.balance")}),e.jsx(w,{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(y,{control:a.control,name:"commission_balance",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.commission_balance")}),e.jsx(w,{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(y,{control:a.control,name:"u",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.upload")}),e.jsx(w,{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(y,{control:a.control,name:"d",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.download")}),e.jsx(w,{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(y,{control:a.control,name:"transfer_enable",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.total_traffic")}),e.jsx(w,{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(y,{control:a.control,name:"expired_at",render:({field:o})=>e.jsxs(b,{className:"flex flex-col",children:[e.jsx(N,{children:n("edit.form.expire_time")}),e.jsxs(rs,{open:i,onOpenChange:c,children:[e.jsx(ls,{asChild:!0,children:e.jsx(w,{children:e.jsxs(V,{type:"button",variant:"outline",className:_("w-full pl-3 text-left font-normal",!o.value&&"text-muted-foreground"),onClick:()=>c(!0),children:[o.value?he(o.value):e.jsx("span",{children:n("edit.form.expire_time_placeholder")}),e.jsx(dt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Xe,{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(V,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{o.onChange(null),c(!1)},children:n("edit.form.expire_time_permanent")}),e.jsx(V,{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)),c(!1)},children:n("edit.form.expire_time_1month")}),e.jsx(V,{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)),c(!1)},children:n("edit.form.expire_time_3months")})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(zs,{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:he(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(V,{type:"button",variant:"outline",onClick:()=>c(!1),children:n("edit.form.expire_time_confirm")})]})]})]})})]}),e.jsx(E,{})]})}),e.jsx(y,{control:a.control,name:"plan_id",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.subscription")}),e.jsx(w,{children:e.jsxs(G,{value:o.value?o.value.toString():"null",onValueChange:d=>o.onChange(d==="null"?null:parseInt(d)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:n("edit.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(L,{value:"null",children:n("edit.form.subscription_none")}),m.map(d=>e.jsx(L,{value:d.id.toString(),children:d.name},d.id))]})]})})]})}),e.jsx(y,{control:a.control,name:"banned",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.account_status")}),e.jsx(w,{children:e.jsxs(G,{value:o.value.toString(),onValueChange:d=>o.onChange(parseInt(d)),children:[e.jsx(U,{children:e.jsx(Y,{})}),e.jsxs(B,{children:[e.jsx(L,{value:"1",children:n("columns.status_text.banned")}),e.jsx(L,{value:"0",children:n("columns.status_text.normal")})]})]})})]})}),e.jsx(y,{control:a.control,name:"commission_type",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.commission_type")}),e.jsx(w,{children:e.jsxs(G,{value:o.value.toString(),onValueChange:d=>o.onChange(parseInt(d)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:n("edit.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(L,{value:"0",children:n("edit.form.commission_type_system")}),e.jsx(L,{value:"1",children:n("edit.form.commission_type_cycle")}),e.jsx(L,{value:"2",children:n("edit.form.commission_type_onetime")})]})]})})]})}),e.jsx(y,{control:a.control,name:"commission_rate",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.commission_rate")}),e.jsx(w,{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(y,{control:a.control,name:"discount",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.discount")}),e.jsx(w,{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(y,{control:a.control,name:"speed_limit",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.speed_limit")}),e.jsx(w,{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(y,{control:a.control,name:"device_limit",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.device_limit")}),e.jsx(w,{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(y,{control:a.control,name:"is_admin",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.is_admin")}),e.jsx("div",{className:"py-2",children:e.jsx(w,{children:e.jsx(K,{checked:o.value===1,onCheckedChange:d=>o.onChange(d?1:0)})})})]})}),e.jsx(y,{control:a.control,name:"is_staff",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.is_staff")}),e.jsx("div",{className:"py-2",children:e.jsx(w,{children:e.jsx(K,{checked:o.value===1,onCheckedChange:d=>o.onChange(d?1:0)})})})]})}),e.jsx(y,{control:a.control,name:"remarks",render:({field:o})=>e.jsxs(b,{children:[e.jsx(N,{children:n("edit.form.remarks")}),e.jsx(w,{children:e.jsx(ps,{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(Xr,{children:[e.jsx(V,{variant:"outline",onClick:()=>r(!1),children:n("edit.form.cancel")}),e.jsx(V,{type:"submit",onClick:()=>{a.handleSubmit(o=>{Pd(o).then(({data:d})=>{d&&($.success(n("edit.form.success")),r(!1),s())})})()},children:n("edit.form.submit")})]})]})}function sl({refetch:s,defaultValues:n,dialogTrigger:a=e.jsxs(V,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(mt,{className:"mr-2 h-4 w-4"}),t("edit.button")]})}){const{t:l}=I("user"),[r,i]=u.useState(!1);return e.jsx(Zx,{defaultValues:n,open:r,onOpenChange:i,children:e.jsxs(Jr,{open:r,onOpenChange:i,children:[e.jsx(Qr,{asChild:!0,children:a}),e.jsxs(Pa,{className:"max-w-[90%] space-y-4",children:[e.jsxs(Da,{children:[e.jsx(Ea,{children:l("edit.title")}),e.jsx(Ra,{})]}),e.jsx(eh,{refetch:s})]})]})})}const tl=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"})}),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.29a1 1 0 0 0-1.42 0L13 14.59V7a1 1 0 0 0-2 0v7.59l-3.29-3.3a1 1 0 0 0-1.42 1.42l5 5a1 1 0 0 0 .33.21a.94.94 0 0 0 .76 0a1 1 0 0 0 .33-.21l5-5a1 1 0 0 0 0-1.42"})}),sh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17 11H9.41l3.3-3.29a1 1 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33a1 1 0 0 0 0 .76a1 1 0 0 0 .21.33l5 5a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42L9.41 13H17a1 1 0 0 0 0-2"})}),th=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.92 11.62a1 1 0 0 0-.21-.33l-5-5a1 1 0 0 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l5-5a1 1 0 0 0 .21-.33a1 1 0 0 0 0-.76"})}),Yt=[{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:hc(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tl,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:ss(s.original.u)})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(al,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:ss(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(H,{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:ss(n)})}}];function nl({user_id:s,dialogTrigger:n}){const{t:a}=I(["traffic"]),[l,r]=u.useState(!1),[i,c]=u.useState({pageIndex:0,pageSize:20}),{data:m,isLoading:x}=se({queryKey:["userStats",s,i,l],queryFn:()=>l?Rd({user_id:s,pageSize:i.pageSize,page:i.pageIndex+1}):null}),o=He({data:m?.data??[],columns:Yt,pageCount:Math.ceil((m?.total??0)/i.pageSize),state:{pagination:i},manualPagination:!0,getCoreRowModel:Ke(),onPaginationChange:c});return e.jsxs(ge,{open:l,onOpenChange:r,children:[e.jsx(ze,{asChild:!0,children:n}),e.jsxs(fe,{className:"sm:max-w-[700px]",children:[e.jsx(be,{children:e.jsx(je,{children:a("trafficRecord.title")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(pa,{children:[e.jsx(ga,{children:o.getHeaderGroups().map(d=>e.jsx(ys,{children:d.headers.map(p=>e.jsx(va,{className:_("h-10 px-2 text-xs",p.id==="total"&&"text-right"),children:p.isPlaceholder?null:_t(p.column.columnDef.header,p.getContext())},p.id))},d.id))}),e.jsx(ja,{children:x?Array.from({length:i.pageSize}).map((d,p)=>e.jsx(ys,{children:Array.from({length:Yt.length}).map((P,R)=>e.jsx(Hs,{className:"p-2",children:e.jsx(le,{className:"h-6 w-full"})},R))},p)):o.getRowModel().rows?.length?o.getRowModel().rows.map(d=>e.jsx(ys,{"data-state":d.getIsSelected()&&"selected",className:"h-10",children:d.getVisibleCells().map(p=>e.jsx(Hs,{className:"px-2",children:_t(p.column.columnDef.cell,p.getContext())},p.id))},d.id)):e.jsx(ys,{children:e.jsx(Hs,{colSpan:Yt.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(G,{value:`${o.getState().pagination.pageSize}`,onValueChange:d=>{o.setPageSize(Number(d))},children:[e.jsx(U,{className:"h-8 w-[70px]",children:e.jsx(Y,{placeholder:o.getState().pagination.pageSize})}),e.jsx(B,{side:"top",children:[10,20,30,40,50].map(d=>e.jsx(L,{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(J,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>o.previousPage(),disabled:!o.getCanPreviousPage()||x,children:e.jsx(sh,{className:"h-4 w-4"})}),e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>o.nextPage(),disabled:!o.getCanNextPage()||x,children:e.jsx(th,{className:"h-4 w-4"})})]})]})]})]})]})]})}function ah({onConfirm:s,children:n,title:a="确认操作",description:l="确定要执行此操作吗?",cancelText:r="取消",confirmText:i="确认",variant:c="default",className:m}){return e.jsxs(Fr,{children:[e.jsx(Mr,{asChild:!0,children:n}),e.jsxs(ba,{className:_("sm:max-w-[425px]",m),children:[e.jsxs(ya,{children:[e.jsx(_a,{children:a}),e.jsx(wa,{children:l})]}),e.jsxs(Na,{children:[e.jsx(Sa,{asChild:!0,children:e.jsx(V,{variant:"outline",children:r})}),e.jsx(Ca,{asChild:!0,children:e.jsx(V,{variant:c,onClick:s,children:i})})]})]})]})}const nh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M5 18h4.24a1 1 0 0 0 .71-.29l6.92-6.93L19.71 8a1 1 0 0 0 0-1.42l-4.24-4.29a1 1 0 0 0-1.42 0l-2.82 2.83l-6.94 6.93a1 1 0 0 0-.29.71V17a1 1 0 0 0 1 1m9.76-13.59l2.83 2.83l-1.42 1.42l-2.83-2.83ZM6 13.17l5.93-5.93l2.83 2.83L8.83 16H6ZM21 20H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2"})}),rh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 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"})}),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:"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"})}),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 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"})}),ih=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9.5 10.5H12a1 1 0 0 0 0-2h-1V8a1 1 0 0 0-2 0v.55a2.5 2.5 0 0 0 .5 4.95h1a.5.5 0 0 1 0 1H8a1 1 0 0 0 0 2h1v.5a1 1 0 0 0 2 0v-.55a2.5 2.5 0 0 0-.5-4.95h-1a.5.5 0 0 1 0-1M21 12h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Z"})}),ch=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12.3 12.22A4.92 4.92 0 0 0 14 8.5a5 5 0 0 0-10 0a4.92 4.92 0 0 0 1.7 3.72A8 8 0 0 0 1 19.5a1 1 0 0 0 2 0a6 6 0 0 1 12 0a1 1 0 0 0 2 0a8 8 0 0 0-4.7-7.28M9 11.5a3 3 0 1 1 3-3a3 3 0 0 1-3 3m9.74.32A5 5 0 0 0 15 3.5a1 1 0 0 0 0 2a3 3 0 0 1 3 3a3 3 0 0 1-1.5 2.59a1 1 0 0 0-.5.84a1 1 0 0 0 .45.86l.39.26l.13.07a7 7 0 0 1 4 6.38a1 1 0 0 0 2 0a9 9 0 0 0-4.23-7.68"})}),dh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 0 0-6.88 2.77V3a1 1 0 0 0-2 0v4.5a1 1 0 0 0 1 1h4.5a1 1 0 0 0 0-2h-2.4A8 8 0 1 1 4 12a1 1 0 0 0-2 0A10 10 0 1 0 12 2m0 6a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h2a1 1 0 0 0 0-2h-1V9a1 1 0 0 0-1-1"})}),mh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M20 6h-4V5a3 3 0 0 0-3-3h-2a3 3 0 0 0-3 3v1H4a1 1 0 0 0 0 2h1v11a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V8h1a1 1 0 0 0 0-2M10 5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1h-4Zm7 14a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V8h10Z"})}),uh=(s,n)=>{const{t:a}=I("user");return[{accessorKey:"is_admin",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.is_admin")}),enableSorting:!1,enableHiding:!0,filterFn:(l,r,i)=>i.includes(l.getValue(r)),size:0},{accessorKey:"is_staff",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.is_staff")}),enableSorting:!1,enableHiding:!0,filterFn:(l,r,i)=>i.includes(l.getValue(r)),size:0},{accessorKey:"id",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx(H,{variant:"outline",children:l.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.email")}),cell:({row:l})=>{const r=l.original.t||0,i=Date.now()/1e3-r<120,c=Math.floor(Date.now()/1e3-r);let m=i?a("columns.online_status.online"):r===0?a("columns.online_status.never"):a("columns.online_status.last_online",{time:he(r)});if(!i&&r!==0){const x=Math.floor(c/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+=` -`+a("columns.online_status.offline_duration.minutes",{count:x}):m+=` -`+a("columns.online_status.offline_duration.seconds",{count:c})}return e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:_("size-2.5 rounded-full ring-2 ring-offset-2",i?"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(te,{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(O,{column:l,title:a("columns.online_count")}),cell:({row:l})=>{const r=l.original.device_limit,i=l.original.online_count||0;return e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(H,{variant:"outline",className:_("min-w-[4rem] justify-center",r!==null&&i>=r?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[i," / ",r===null?"∞":r]})})}),e.jsx(te,{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(O,{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(H,{className:_("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,i)=>i.includes(l.getValue(r))},{accessorKey:"plan_id",header:({column:l})=>e.jsx(O,{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(O,{column:l,title:a("columns.group")}),cell:({row:l})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(H,{variant:"outline",className:_("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(O,{column:l,title:a("columns.used_traffic")}),cell:({row:l})=>{const r=ss(l.original?.total_used),i=ss(l.original?.transfer_enable),c=l.original?.total_used/l.original?.transfer_enable*100||0;return e.jsx(ce,{delayDuration:100,children:e.jsxs(oe,{children:[e.jsx(ie,{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:[c.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:_("h-full rounded-full transition-all",c>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(c,100)}%`}})})]})}),e.jsx(te,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",i]})})]})})}},{accessorKey:"transfer_enable",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.total_traffic")}),cell:({row:l})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ss(l.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.expire_time")}),cell:({row:l})=>{const r=l.original.expired_at,i=Date.now()/1e3,c=r!=null&&re.jsx(O,{column:l,title:a("columns.balance")}),cell:({row:l})=>{const r=qs(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(O,{column:l,title:a("columns.commission")}),cell:({row:l})=>{const r=qs(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(O,{column:l,title:a("columns.register_time")}),cell:({row:l})=>e.jsx("div",{className:"truncate",children:he(l.original?.created_at)}),size:1e3},{id:"actions",header:({column:l})=>e.jsx(O,{column:l,className:"justify-end",title:a("columns.actions")}),cell:({row:l,table:r})=>e.jsxs(_s,{modal:!0,children:[e.jsx(ws,{asChild:!0,children:e.jsx("div",{className:"text-center",children:e.jsx(J,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":a("columns.actions"),children:e.jsx(Ct,{className:"size-4"})})})}),e.jsxs(ds,{align:"end",className:"min-w-[40px]",children:[e.jsx(pe,{onSelect:i=>{i.preventDefault()},className:"p-0",children:e.jsx(sl,{defaultValues:{...l.original,invite_user_email:l.original.invite_user?.email},refetch:s,dialogTrigger:e.jsxs(J,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(nh,{className:"mr-2"}),a("columns.actions_menu.edit")]})})}),e.jsx(pe,{onSelect:i=>i.preventDefault(),className:"p-0",children:e.jsx(Gr,{defaultValues:{email:l.original.email},trigger:e.jsxs(J,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(rh,{className:"mr-2 "}),a("columns.actions_menu.assign_order")]})})}),e.jsx(pe,{onSelect:()=>{kt(l.original.subscribe_url).then(()=>{$.success(a("common:copy.success"))})},className:"p-0",children:e.jsxs(J,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(lh,{className:"mr-2"}),a("columns.actions_menu.copy_url")]})}),e.jsx(pe,{onSelect:()=>{Dd({id:l.original.id}).then(({data:i})=>{i&&$.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(oh,{className:"mr-2 "}),a("columns.actions_menu.reset_secret")]})}),e.jsx(pe,{onSelect:()=>{},className:"p-0",children:e.jsxs(Vs,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=${l.original?.id}`,children:[e.jsx(ih,{className:"mr-2"}),a("columns.actions_menu.orders")]})}),e.jsx(pe,{onSelect:()=>{r.setColumnFilters([{id:"invite_user_id",value:l.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(ch,{className:"mr-2 "}),a("columns.actions_menu.invites")]})}),e.jsx(pe,{onSelect:i=>i.preventDefault(),className:"p-0",children:e.jsx(nl,{user_id:l.original?.id,dialogTrigger:e.jsxs(J,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(dh,{className:"mr-2 "}),a("columns.actions_menu.traffic_records")]})})}),e.jsx(pe,{onSelect:i=>i.preventDefault(),className:"p-0",children:e.jsx(ah,{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:i}=await sm.destroy(l.original.id);i&&($.success(a("common:delete.success")),s())}catch{$.error(a("common:delete.failed"))}},children:e.jsxs(J,{variant:"ghost",className:"w-full justify-start px-2 py-1.5 text-destructive hover:text-destructive",children:[e.jsx(mh,{className:"mr-2"}),a("columns.actions_menu.delete")]})})})]})]})}]};function xh(){const[s]=rr(),[n,a]=u.useState({}),[l,r]=u.useState({is_admin:!1,is_staff:!1}),[i,c]=u.useState([]),[m,x]=u.useState([]),[o,d]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const T=s.get("email");T&&c(z=>z.some(q=>q.id==="email")?z:[...z,{id:"email",value:T}])},[s]);const{refetch:p,data:P,isLoading:R}=se({queryKey:["userList",o,i,m],queryFn:()=>Td({pageSize:o.pageSize,current:o.pageIndex+1,filter:i,sort:m})}),[f,g]=u.useState([]),[S,j]=u.useState([]);u.useEffect(()=>{Ot().then(({data:T})=>{g(T)}),Os().then(({data:T})=>{j(T)})},[]);const C=f.map(T=>({label:T.name,value:T.id})),k=S.map(T=>({label:T.name,value:T.id})),v=He({data:P?.data??[],columns:uh(p),state:{sorting:m,columnVisibility:l,rowSelection:n,columnFilters:i,pagination:o},rowCount:P?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:r,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),onPaginationChange:d,getSortedRowModel:Ze(),getFacetedRowModel:us(),getFacetedUniqueValues:xs(),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(es,{table:v,toolbar:e.jsx(Jx,{table:v,refetch:p,serverGroupList:f,permissionGroups:C,subscriptionPlans:k})})}function hh(){const{t:s}=I("user");return e.jsxs(we,{children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(xh,{})})})]})]})}const fh=Object.freeze(Object.defineProperty({__proto__:null,default:hh},Symbol.toStringTag,{value:"Module"}));function ph({column:s,title:n,options:a}){const l=new Set(s?.getFilterValue());return e.jsxs(rs,{children:[e.jsx(ls,{asChild:!0,children:e.jsxs(J,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Oi,{className:"mr-2 h-4 w-4"}),n,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ye,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{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(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(r=>l.has(r.value)).map(r=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:r.label},`selected-${r.value}`))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Cs,{children:[e.jsx(Fs,{placeholder:n}),e.jsxs(Ss,{children:[e.jsx(Ms,{children:"No results found."}),e.jsx(Oe,{children:a.map(r=>{const i=l.has(r.value);return e.jsxs(ke,{onSelect:()=>{i?l.delete(r.value):l.add(r.value);const c=Array.from(l);s?.setFilterValue(c.length?c:void 0)},children:[e.jsx("div",{className:_("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(zi,{className:_("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(Gs,{}),e.jsx(Oe,{children:e.jsx(ke,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const gh=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 jh({table:s}){const{t:n}=I("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(fa,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:a=>s.getColumn("status")?.setFilterValue(a),children:e.jsxs(zt,{className:"grid w-full grid-cols-2",children:[e.jsx(Ns,{value:"0",children:n("status.pending")}),e.jsx(Ns,{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:ts.LOW,icon:gh,color:"gray"},{label:n("level.medium"),value:ts.MIDDLE,icon:tl,color:"yellow"},{label:n("level.high"),value:ts.HIGH,icon:al,color:"red"}]})]})})}function vh(){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 bh=Es("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"}}),rl=u.forwardRef(({className:s,variant:n,layout:a,children:l,...r},i)=>e.jsx("div",{className:_(bh({variant:n,layout:a,className:s}),"relative group"),ref:i,...r,children:u.Children.map(l,c=>u.isValidElement(c)&&typeof c.type!="string"?u.cloneElement(c,{variant:n,layout:a}):c)}));rl.displayName="ChatBubble";const yh=Es("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"}}),ll=u.forwardRef(({className:s,variant:n,layout:a,isLoading:l=!1,children:r,...i},c)=>e.jsx("div",{className:_(yh({variant:n,layout:a,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:c,...i,children:l?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(vh,{})}):r}));ll.displayName="ChatBubbleMessage";const Nh=u.forwardRef(({variant:s,className:n,children:a,...l},r)=>e.jsx("div",{ref:r,className:_("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}));Nh.displayName="ChatBubbleActionWrapper";const ol=u.forwardRef(({className:s,...n},a)=>e.jsx(ps,{autoComplete:"off",ref:a,name:"message",className:_("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}));ol.displayName="ChatInput";const il=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"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"})}),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:"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"})}),_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:"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"})}),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:"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 Ch(){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(le,{className:"h-8 w-3/4"}),e.jsx(le,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(le,{className:"h-20 w-2/3"},s))})]})}function Sh({ticketId:s,dialogTrigger:n}){const{t:a}=I("ticket"),l=ms(),r=u.useRef(null),[i,c]=u.useState(!1),[m,x]=u.useState(""),[o,d]=u.useState(!1),{data:p,refetch:P,isLoading:R}=se({queryKey:["ticket",s,i],queryFn:()=>i?Id(s):Promise.resolve(null),refetchInterval:i?5e3:!1,retry:3}),f=p?.data,g=(v="smooth")=>{if(r.current){const{scrollHeight:T,clientHeight:z}=r.current;r.current.scrollTo({top:T-z,behavior:v})}};u.useEffect(()=>{if(!i)return;const v=requestAnimationFrame(()=>{g("instant"),setTimeout(()=>g(),1e3)});return()=>{cancelAnimationFrame(v)}},[i,f?.messages]);const S=async()=>{const v=m.trim();!v||o||(d(!0),Fd({id:s,message:v}).then(()=>{x(""),P(),g()}).finally(()=>{d(!1)}))},j=async()=>{Dr(s).then(()=>{$.success(a("actions.close_success")),P()})},C=()=>{f?.user&&l("/finance/order?user_id="+f.user.id)},k=f?.status===at.CLOSED;return e.jsxs(ge,{open:i,onOpenChange:c,children:[e.jsx(ze,{asChild:!0,children:n??e.jsx(J,{variant:"outline",children:a("actions.view_ticket")})}),e.jsxs(fe,{className:"flex h-[90vh] max-w-4xl flex-col gap-0 p-0",children:[e.jsx(je,{}),R?e.jsx(Ch,{}):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(H,{variant:k?"secondary":"default",children:a(k?"status.closed":"status.processing")}),!k&&e.jsx(Ue,{title:a("actions.close_confirm_title"),description:a("actions.close_confirm_description"),confirmText:a("actions.close_confirm_button"),variant:"destructive",onConfirm:j,children:e.jsxs(J,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(il,{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(ct,{className:"h-4 w-4"}),e.jsx("span",{children:f?.user?.email})]}),e.jsx(ye,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(cl,{className:"h-4 w-4"}),e.jsxs("span",{children:[a("detail.created_at")," ",he(f?.created_at)]})]}),e.jsx(ye,{orientation:"vertical",className:"h-4"}),e.jsx(H,{variant:"outline",children:f?.level!=null&&a(`level.${f.level===ts.LOW?"low":f.level===ts.MIDDLE?"medium":"high"}`)})]})]}),f?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(sl,{defaultValues:f.user,refetch:P,dialogTrigger:e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.user_info"),children:e.jsx(ct,{className:"h-4 w-4"})})}),e.jsx(nl,{user_id:f.user.id,dialogTrigger:e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.traffic_records"),children:e.jsx(_h,{className:"h-4 w-4"})})}),e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.order_records"),onClick:C,children:e.jsx(wh,{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(v=>e.jsx(rl,{variant:v.is_me?"sent":"received",className:v.is_me?"ml-auto":"mr-auto",children:e.jsx(ll,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:v.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:he(v.created_at)})})]})})},v.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(ol,{disabled:k||o,placeholder:a(k?"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:m,onChange:v=>x(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),S())}}),e.jsx(J,{disabled:k||o||!m.trim(),onClick:S,children:a(o?"detail.input.sending":"detail.input.send")})]})})]})]})]})}const 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:"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"})}),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:"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"})}),Ph=s=>{const{t:n}=I("ticket");return[{accessorKey:"id",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.id")}),cell:({row:a})=>e.jsx(H,{variant:"outline",children:a.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.subject")}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(kh,{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(O,{column:a,title:n("columns.level")}),cell:({row:a})=>{const l=a.getValue("level"),r=l===ts.LOW?"default":l===ts.MIDDLE?"secondary":"destructive";return e.jsx(H,{variant:r,className:"whitespace-nowrap",children:n(`level.${l===ts.LOW?"low":l===ts.MIDDLE?"medium":"high"}`)})},filterFn:(a,l,r)=>r.includes(a.getValue(l))},{accessorKey:"status",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.status")}),cell:({row:a})=>{const l=a.getValue("status"),r=a.original.reply_status,i=l===at.CLOSED?n("status.closed"):n(r===0?"status.replied":"status.pending"),c=l===at.CLOSED?"default":r===0?"secondary":"destructive";return e.jsx(H,{variant:c,className:"whitespace-nowrap",children:i})}},{accessorKey:"updated_at",header:({column:a})=>e.jsx(O,{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(cl,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:he(a.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.created_at")}),cell:({row:a})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:he(a.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:a})=>e.jsx(O,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>{const l=a.original.status!==at.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Sh,{ticketId:a.original.id,dialogTrigger:e.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.view_details"),children:e.jsx(Th,{className:"h-4 w-4"})})}),l&&e.jsx(Ue,{title:n("actions.close_confirm_title"),description:n("actions.close_confirm_description"),confirmText:n("actions.close_confirm_button"),variant:"destructive",onConfirm:async()=>{Dr(a.original.id).then(()=>{$.success(n("actions.close_success")),s()})},children:e.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.close_ticket"),children:e.jsx(il,{className:"h-4 w-4"})})})]})}}]};function Dh(){const[s,n]=u.useState({}),[a,l]=u.useState({}),[r,i]=u.useState([{id:"status",value:"0"}]),[c,m]=u.useState([]),[x,o]=u.useState({pageIndex:0,pageSize:20}),{refetch:d,data:p,isLoading:P}=se({queryKey:["orderList",x,r,c],queryFn:()=>Vd({pageSize:x.pageSize,current:x.pageIndex+1,filter:r,sort:c})}),R=He({data:p?.data??[],columns:Ph(d),state:{sorting:c,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:i,onColumnVisibilityChange:l,getCoreRowModel:Ke(),getFilteredRowModel:Je(),getPaginationRowModel:Qe(),onPaginationChange:o,getSortedRowModel:Ze(),getFacetedRowModel:us(),getFacetedUniqueValues:xs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(jh,{table:R,refetch:d}),e.jsx(es,{table:R,showPagination:!0})]})}function Eh(){const{t:s}=I("ticket");return e.jsxs(we,{children:[e.jsxs(Ce,{children:[e.jsx(Ie,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ee,{}),e.jsx(Re,{})]})]}),e.jsxs(Te,{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(Dh,{})})]})]})}const Rh=Object.freeze(Object.defineProperty({__proto__:null,default:Eh},Symbol.toStringTag,{value:"Module"}));export{Oh as a,Fh as c,Mh as g,zh as r}; +`))}})})}),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(W,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("form.actionPlaceholder")})}),e.jsxs(B,{children:[e.jsx(A,{value:"block",children:r("actions.block")}),e.jsx(A,{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(qe,{children:[e.jsx(pt,{asChild:!0,children:e.jsx(V,{variant:"outline",children:r("form.cancel")})}),e.jsx(V,{type:"submit",onClick:()=>{Xc(c.getValues()).then(({data:x})=>{x&&(u(!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(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("toolbar.reset"),e.jsx(He,{className:"ml-2 h-4 w-4"})]})]})})}function dx({columns:s,data:n,refetch:a}){const[l,r]=m.useState({}),[c,i]=m.useState({}),[u,x]=m.useState([]),[o,d]=m.useState([]),p=Be({data:n,columns:s,state:{sorting:o,columnVisibility:c,rowSelection:l,columnFilters:u},enableRowSelection:!0,onRowSelectionChange:r,onSortingChange:d,onColumnFiltersChange:x,onColumnVisibilityChange:i,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),getSortedRowModel:ss(),getFacetedRowModel:fs(),getFacetedUniqueValues:ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(as,{table:p,toolbar:T=>e.jsx(cx,{table:T,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(O,{column:l,title:n("columns.id")}),cell:({row:l})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(H,{variant:"outline",children:l.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:l})=>e.jsx(O,{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(O,{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(H,{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(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(zs,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(We,{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&&($.success(n("messages.deleteSuccess")),s())})},children:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(os,{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]=m.useState([]);function l(){Er().then(({data:r})=>{a(r)})}return m.useEffect(()=>{l()},[]),e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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=m.createContext(void 0);function hx({children:s,refreshData:n}){const[a,l]=m.useState(!1),[r,c]=m.useState(null);return e.jsx(Br.Provider,{value:{isOpen:a,setIsOpen:l,editingPlan:r,setEditingPlan:c,refreshData:n},children:s})}function Ra(){const s=m.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(V,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>l(!0),children:[e.jsx(ke,{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(V,{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(Ot,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(O,{column:a,title:n("plan.columns.id")}),cell:({row:a})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(H,{variant:"outline",children:a.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:a})=>e.jsx(O,{column:a,title:n("plan.columns.show")}),cell:({row:a})=>e.jsx(K,{defaultChecked:a.getValue("show"),onCheckedChange:l=>{Bt({id:a.original.id,show:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:a})=>e.jsx(O,{column:a,title:n("plan.columns.sell")}),cell:({row:a})=>e.jsx(K,{defaultChecked:a.getValue("sell"),onCheckedChange:l=>{Bt({id:a.original.id,sell:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:a})=>e.jsx(O,{column:a,title:n("plan.columns.renew"),tooltip:n("plan.columns.renew_tooltip")}),cell:({row:a})=>e.jsx(K,{defaultChecked:a.getValue("renew"),onCheckedChange:l=>{Bt({id:a.original.id,renew:l}).then(({data:r})=>{!r&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:a})=>e.jsx(O,{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(O,{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(xt,{}),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(O,{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(H,{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(O,{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:u})=>l[i]!=null&&e.jsxs(H,{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],u]},i))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:a})=>e.jsx(O,{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(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{r(a.original),l(!0)},children:[e.jsx(zs,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.edit")})]}),e.jsx(We,{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&&($.success(n("plan.columns.delete_confirm.success")),s())})},children:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(os,{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=m.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(Ms,{className:"h-4 w-4"})})}));Gr.displayName=ar.displayName;const Nt={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},_t={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]=m.useState(!1),{t:u}=F("subscribe"),x=ue({resolver:he(gx),defaultValues:{...Nt,...a||{}},mode:"onChange"});m.useEffect(()=>{a?x.reset({...Nt,...a}):x.reset(Nt)},[a,x]);const o=new pa({html:!0}),[d,p]=m.useState();async function T(){$t().then(({data:g})=>{p(g)})}m.useEffect(()=>{s&&T()},[s]);const R=g=>{if(isNaN(g))return;const S=Object.entries(_t).reduce((j,[C,P])=>{const w=g*P.months*P.discount;return{...j,[C]:w.toFixed(2)}},{});x.setValue("prices",S,{shouldDirty:!0})},f=()=>{n(!1),l(null),x.reset(Nt)};return e.jsx(je,{open:s,onOpenChange:f,children:e.jsxs(pe,{children:[e.jsxs(ye,{children:[e.jsx(ve,{children:u(a?"plan.form.edit_title":"plan.form.add_title")}),e.jsx(Ee,{})]}),e.jsxs(fe,{...x,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:x.control,name:"name",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:u("plan.form.name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:u("plan.form.name.placeholder"),...g})}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"group_id",render:({field:g})=>e.jsxs(v,{children:[e.jsxs(y,{className:"flex items-center justify-between",children:[u("plan.form.group.label"),e.jsx(Ht,{dialogTrigger:e.jsx(V,{variant:"link",children:u("plan.form.group.add")}),refetch:T})]}),e.jsxs(W,{value:g.value?.toString()??"",onValueChange:S=>g.onChange(S?Number(S):null),children:[e.jsx(_,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:u("plan.form.group.placeholder")})})}),e.jsx(B,{children:d?.map(S=>e.jsx(A,{value:S.id.toString(),children:S.name},S.id))})]}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"transfer_enable",render:({field:g})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:u("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:u("plan.form.transfer.placeholder"),className:"rounded-r-none",...g})}),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:u("plan.form.transfer.unit")})]}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"speed_limit",render:({field:g})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:u("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:u("plan.form.speed.placeholder"),className:"rounded-r-none",...g,value:g.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:u("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:u("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:u("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:g=>{const S=parseFloat(g.target.value);R(S)}})]}),e.jsx(me,{children:e.jsxs(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(V,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const g=Object.keys(_t).reduce((S,j)=>({...S,[j]:""}),{});x.setValue("prices",g,{shouldDirty:!0})},children:u("plan.form.price.clear.button")})}),e.jsx(re,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:u("plan.form.price.clear.tooltip")})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(_t).filter(([g])=>!["onetime","reset_traffic"].includes(g)).map(([g,S])=>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.${g}`,render:({field:j})=>e.jsxs(v,{children:[e.jsxs(y,{className:"text-xs font-medium text-muted-foreground",children:[u(`plan.columns.price_period.${g}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",S.months===1?u("plan.form.price.period.monthly"):u("plan.form.price.period.months",{count:S.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,...j,value:j.value??"",onChange:C=>j.onChange(C.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"})})]})]})})},g))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(_t).filter(([g])=>["onetime","reset_traffic"].includes(g)).map(([g,S])=>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.${g}`,render:({field:j})=>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:u(`plan.columns.price_period.${g}`)}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:u(g==="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,...j,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"})})]})]})})})},g))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(b,{control:x.control,name:"device_limit",render:({field:g})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:u("plan.form.device.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:u("plan.form.device.placeholder"),className:"rounded-r-none",...g,value:g.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:u("plan.form.device.unit")})]}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"capacity_limit",render:({field:g})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:u("plan.form.capacity.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:u("plan.form.capacity.placeholder"),className:"rounded-r-none",...g,value:g.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:u("plan.form.capacity.unit")})]}),e.jsx(E,{})]})})]}),e.jsx(b,{control:x.control,name:"reset_traffic_method",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:u("plan.form.reset_method.label")}),e.jsxs(W,{value:g.value?.toString()??"null",onValueChange:S=>g.onChange(S=="null"?null:Number(S)),children:[e.jsx(_,{children:e.jsx(U,{children:e.jsx(Y,{placeholder:u("plan.form.reset_method.placeholder")})})}),e.jsx(B,{children:jx.map(S=>e.jsx(A,{value:S.value?.toString()??"null",children:u(`plan.form.reset_method.options.${S.label}`)},S.value))})]}),e.jsx(M,{className:"text-xs",children:u("plan.form.reset_method.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:x.control,name:"content",render:({field:g})=>{const[S,j]=m.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:[u("plan.form.content.label"),e.jsx(me,{children:e.jsxs(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(V,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>j(!S),children:S?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(re,{side:"top",children:e.jsx("p",{className:"text-xs",children:u(S?"plan.form.content.preview_button.hide":"plan.form.content.preview_button.show")})})]})})]}),e.jsx(me,{children:e.jsxs(ce,{children:[e.jsx(de,{asChild:!0,children:e.jsx(V,{variant:"outline",size:"sm",onClick:()=>{g.onChange(u("plan.form.content.template.content"))},children:u("plan.form.content.template.button")})}),e.jsx(re,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:u("plan.form.content.template.tooltip")})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${S?"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:g.value||"",renderHTML:C=>o.render(C),onChange:({text:C})=>g.onChange(C),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:u("plan.form.content.placeholder"),className:"rounded-md border"})})}),S&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:u("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(g.value||"")}})})]})]}),e.jsx(M,{className:"text-xs",children:u("plan.form.content.description")}),e.jsx(E,{})]})}})]}),e.jsx(qe,{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:g})=>e.jsxs(v,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(_,{children:e.jsx(Gr,{checked:g.value,onCheckedChange:g.onChange})}),e.jsx("div",{className:"",children:e.jsx(y,{className:"text-sm",children:u("plan.form.force_update.label")})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(V,{type:"button",variant:"outline",onClick:f,children:u("plan.form.submit.cancel")}),e.jsx(V,{type:"submit",disabled:c,onClick:()=>{x.handleSubmit(async g=>{i(!0),(await gd(g)).data&&($.success(u(a?"plan.form.submit.success.update":"plan.form.submit.success.add")),f(),r()),i(!1)})()},children:u(c?"plan.form.submit.submitting":"plan.form.submit.submit")})]})]})})]})]})})}function bx(){const[s,n]=m.useState({}),[a,l]=m.useState({"drag-handle":!1}),[r,c]=m.useState([]),[i,u]=m.useState([]),[x,o]=m.useState(!1),[d,p]=m.useState({pageSize:20,pageIndex:0}),[T,R]=m.useState([]),{refetch:f}=te({queryKey:["planList"],queryFn:async()=>{const{data:P}=await $s();return R(P),P}});m.useEffect(()=>{l({"drag-handle":x}),p({pageSize:x?99999:10,pageIndex:0})},[x]);const g=(P,w)=>{x&&(P.dataTransfer.setData("text/plain",w.toString()),P.currentTarget.classList.add("opacity-50"))},S=(P,w)=>{if(!x)return;P.preventDefault(),P.currentTarget.classList.remove("bg-muted");const k=parseInt(P.dataTransfer.getData("text/plain"));if(k===w)return;const L=[...T],[J]=L.splice(k,1);L.splice(w,0,J),R(L)},j=async()=>{if(!x){o(!0);return}const P=T?.map(w=>w.id);vd(P).then(()=>{$.success("排序保存成功"),o(!1),f()}).finally(()=>{o(!1)})},C=Be({data:T||[],columns:px(f),state:{sorting:i,columnVisibility:a,rowSelection:s,columnFilters:r,pagination:d},enableRowSelection:!0,onPaginationChange:p,onRowSelectionChange:n,onSortingChange:u,onColumnFiltersChange:c,onColumnVisibilityChange:l,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),getSortedRowModel:ss(),getFacetedRowModel:fs(),getFacetedUniqueValues:ps(),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(as,{table:C,toolbar:P=>e.jsx(fx,{table:P,refetch:f,saveOrder:j,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:S,showPagination:!x}),e.jsx(vx,{})]})})}function yx(){const{t:s}=F("subscribe");return e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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"})),Bs=[{value:Z.PENDING,label:nt[Z.PENDING],icon:Vi,color:rt[Z.PENDING]},{value:Z.PROCESSING,label:nt[Z.PROCESSING],icon:nr,color:rt[Z.PROCESSING]},{value:Z.COMPLETED,label:nt[Z.COMPLETED],icon:na,color:rt[Z.COMPLETED]},{value:Z.CANCELLED,label:nt[Z.CANCELLED],icon:rr,color:rt[Z.CANCELLED]},{value:Z.DISCOUNTED,label:nt[Z.DISCOUNTED],icon:na,color:rt[Z.DISCOUNTED]}],ot=[{value:ie.PENDING,label:jt[ie.PENDING],icon:Ii,color:vt[ie.PENDING]},{value:ie.PROCESSING,label:jt[ie.PROCESSING],icon:nr,color:vt[ie.PROCESSING]},{value:ie.VALID,label:jt[ie.VALID],icon:na,color:vt[ie.VALID]},{value:ie.INVALID,label:jt[ie.INVALID],icon:rr,color:vt[ie.INVALID]}];function wt({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(is,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(ft,{className:"mr-2 h-4 w-4"}),n,c?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{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(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[c.size," selected"]}):a.filter(i=>c.has(i.value)).map(i=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),e.jsx(ts,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Ps,{children:[e.jsx(Ls,{placeholder:n}),e.jsxs(Ds,{children:[e.jsx(As,{children:"No results found."}),e.jsx(Ae,{children:a.map(i=>{const u=c.has(i.value);return e.jsxs(Te,{onSelect:()=>{const x=new Set(c);u?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",u?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ms,{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(Xs,{}),e.jsx(Ae,{children:e.jsx(Te,{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]=m.useState(!1),i=ue({resolver:he(_x),defaultValues:{...wx,...a},mode:"onChange"}),[u,x]=m.useState([]);return m.useEffect(()=>{r&&$s().then(({data:o})=>{x(o)})},[r]),e.jsxs(je,{open:r,onOpenChange:c,children:[e.jsx($e,{asChild:!0,children:n||e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(ke,{icon:"ion:add"}),e.jsx("div",{children:l("dialog.addOrder")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(ye,{children:[e.jsx(ve,{children:l("dialog.assignOrder")}),e.jsx(Ee,{})]}),e.jsxs(fe,{...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(W,{value:o.value?o.value?.toString():void 0,onValueChange:d=>o.onChange(parseInt(d)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dialog.placeholders.plan")})}),e.jsx(B,{children:u.map(d=>e.jsx(A,{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(W,{value:o.value,onValueChange:o.onChange,children:[e.jsx(U,{children:e.jsx(Y,{placeholder:l("dialog.placeholders.period")})}),e.jsx(B,{children:Object.keys(Wd).map(d=>e.jsx(A,{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(qe,{children:[e.jsx(V,{variant:"outline",onClick:()=>c(!1),children:l("dialog.actions.cancel")}),e.jsx(V,{type:"submit",onClick:()=>{i.handleSubmit(o=>{wd(o).then(({data:d})=>{d&&(s&&s(),i.reset(),c(!1),$.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(Ze).filter(x=>typeof x=="number").map(x=>({label:a(`type.${Ze[x]}`),value:x,color:x===Ze.NEW?"green-500":x===Ze.RENEWAL?"blue-500":x===Ze.UPGRADE?"purple-500":"orange-500"})),c=Object.values(we).map(x=>({label:a(`period.${x}`),value:x,color:x===we.MONTH_PRICE?"slate-500":x===we.QUARTER_PRICE?"cyan-500":x===we.HALF_YEAR_PRICE?"indigo-500":x===we.YEAR_PRICE?"violet-500":x===we.TWO_YEAR_PRICE?"fuchsia-500":x===we.THREE_YEAR_PRICE?"pink-500":x===we.ONETIME_PRICE?"rose-500":"orange-500"})),i=Object.values(Z).filter(x=>typeof x=="number").map(x=>({label:a(`status.${Z[x]}`),value:x,icon:x===Z.PENDING?Bs[0].icon:x===Z.PROCESSING?Bs[1].icon:x===Z.COMPLETED?Bs[2].icon:x===Z.CANCELLED?Bs[3].icon:Bs[4].icon,color:x===Z.PENDING?"yellow-500":x===Z.PROCESSING?"blue-500":x===Z.COMPLETED?"green-500":x===Z.CANCELLED?"red-500":"green-500"})),u=Object.values(ie).filter(x=>typeof x=="number").map(x=>({label:a(`commission.${ie[x]}`),value:x,icon:x===ie.PENDING?ot[0].icon:x===ie.PROCESSING?ot[1].icon:x===ie.VALID?ot[2].icon:ot[3].icon,color:x===ie.PENDING?"yellow-500":x===ie.PROCESSING?"blue-500":x===ie.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(wt,{column:s.getColumn("type"),title:a("table.columns.type"),options:r}),s.getColumn("period")&&e.jsx(wt,{column:s.getColumn("period"),title:a("table.columns.period"),options:c}),s.getColumn("status")&&e.jsx(wt,{column:s.getColumn("status"),title:a("table.columns.status"),options:i}),s.getColumn("commission_status")&&e.jsx(wt,{column:s.getColumn("commission_status"),title:a("table.columns.commissionStatus"),options:u})]}),l&&e.jsxs(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[a("actions.reset"),e.jsx(He,{className:"ml-2 h-4 w-4"})]})]})}function Ye({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={[Z.PENDING]:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",[Z.PROCESSING]:"bg-blue-100 text-blue-800 hover:bg-blue-100",[Z.CANCELLED]:"bg-red-100 text-red-800 hover:bg-red-100",[Z.COMPLETED]:"bg-green-100 text-green-800 hover:bg-green-100",[Z.DISCOUNTED]:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(H,{variant:"secondary",className:N("font-medium",a[s]),children:n(`status.${Z[s]}`)})}function kx({id:s,trigger:n}){const[a,l]=m.useState(!1),[r,c]=m.useState(),{t:i}=F("order");return m.useEffect(()=>{(async()=>{if(a){const{data:x}=await yd({id:s});c(x)}})()},[a,s]),e.jsxs(je,{onOpenChange:l,open:a,children:[e.jsx($e,{asChild:!0,children:n}),e.jsxs(pe,{className:"max-w-xl",children:[e.jsxs(ye,{className:"space-y-2",children:[e.jsx(ve,{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(Ye,{label:i("dialog.fields.userEmail"),value:r?.user?.email?e.jsxs(Os,{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(Ye,{label:i("dialog.fields.orderPeriod"),value:r&&i(`period.${r.period}`)}),e.jsx(Ye,{label:i("dialog.fields.subscriptionPlan"),value:r?.plan?.name,valueClassName:"font-medium"}),e.jsx(Ye,{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(Ye,{label:i("dialog.fields.paymentAmount"),value:Rs(r?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(Ne,{className:"my-2"}),e.jsx(Ye,{label:i("dialog.fields.balancePayment"),value:Rs(r?.balance_amount||0)}),e.jsx(Ye,{label:i("dialog.fields.discountAmount"),value:Rs(r?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(Ye,{label:i("dialog.fields.refundAmount"),value:Rs(r?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(Ye,{label:i("dialog.fields.deductionAmount"),value:Rs(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(Ye,{label:i("dialog.fields.createdAt"),value:xe(r?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(Ye,{label:i("dialog.fields.updatedAt"),value:xe(r?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const Tx={[Ze.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ze.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ze.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ze.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Px={[we.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[we.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[we.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[we.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[we.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[we.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[we.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[we.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Dx=s=>Z[s],Ex=s=>ie[s],Rx=s=>Ze[s],Vx=s=>{const{t:n}=F("order");return[{accessorKey:"trade_no",header:({column:a})=>e.jsx(O,{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(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(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(O,{column:a,title:n("table.columns.type")}),cell:({row:a})=>{const l=a.getValue("type"),r=Tx[l];return e.jsx(H,{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(O,{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(O,{column:a,title:n("table.columns.period")}),cell:({row:a})=>{const l=a.getValue("period"),r=Px[l];return e.jsx(H,{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(O,{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(O,{column:a,title:n("table.columns.status")}),e.jsx(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{children:e.jsx(Lr,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(re,{side:"top",className:"max-w-[200px] text-sm",children:n("status.tooltip")})]})})]}),cell:({row:a})=>{const l=Bs.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===Z.PENDING&&e.jsxs(ks,{modal:!0,children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Pt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(xs,{align:"end",className:"w-[140px]",children:[e.jsx(ge,{className:"cursor-pointer",onClick:async()=>{await Nd({trade_no:a.original.trade_no}),s()},children:n("actions.markAsPaid")}),e.jsx(ge,{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(O,{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(O,{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===ie.PENDING&&l===Z.COMPLETED&&e.jsxs(ks,{modal:!0,children:[e.jsx(Ts,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Pt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(xs,{align:"end",className:"w-[120px]",children:[e.jsx(ge,{className:"cursor-pointer",onClick:async()=>{await Ya({trade_no:a.original.trade_no,commission_status:ie.PROCESSING}),s()},children:n("commission.PROCESSING")}),e.jsx(ge,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ya({trade_no:a.original.trade_no,commission_status:ie.INVALID}),s()},children:n("commission.INVALID")})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.createdAt")}),cell:({row:a})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:xe(a.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}]};function Ix(){const[s]=or(),[n,a]=m.useState({}),[l,r]=m.useState({}),[c,i]=m.useState([]),[u,x]=m.useState([]),[o,d]=m.useState({pageIndex:0,pageSize:20});m.useEffect(()=>{const S=Object.entries({user_id:"string",order_id:"string",commission_status:"number",status:"number",commission_balance:"string"}).map(([j,C])=>{const P=s.get(j);return P?{id:j,value:C==="number"?parseInt(P):P}:null}).filter(Boolean);S.length>0&&i(S)},[s]);const{refetch:p,data:T,isLoading:R}=te({queryKey:["orderList",o,c,u],queryFn:()=>bd({pageSize:o.pageSize,current:o.pageIndex+1,filter:c,sort:u})}),f=Be({data:T?.data??[],columns:Vx(p),state:{sorting:u,columnVisibility:l,rowSelection:n,columnFilters:c,pagination:o},rowCount:T?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:x,onColumnFiltersChange:i,onColumnVisibilityChange:r,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),onPaginationChange:d,getSortedRowModel:ss(),getFacetedRowModel:fs(),getFacetedUniqueValues:ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(as,{table:f,toolbar:e.jsx(Cx,{table:f,refetch:p}),showPagination:!0})}function Fx(){const{t:s}=F("order");return e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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(Ix,{})})]})]})}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(is,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(ft,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{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(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):a.filter(c=>r.has(c.value)).map(c=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(ts,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Ps,{children:[e.jsx(Ls,{placeholder:n}),e.jsxs(Ds,{children:[e.jsx(As,{children:"No results found."}),e.jsx(Ae,{children:a.map(c=>{const i=r.has(c.value);return e.jsxs(Te,{onSelect:()=>{i?r.delete(c.value):r.add(c.value);const u=Array.from(r);s?.setFilterValue(u.length?u: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(Ms,{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(Xs,{}),e.jsx(Ae,{children:e.jsx(Te,{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:ze.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"),[u,x]=m.useState(!1),o=r??u,d=c??x,[p,T]=m.useState([]),R=ue({resolver:he(zx),defaultValues:s||nn});m.useEffect(()=>{s&&R.reset(s)},[s,R]),m.useEffect(()=>{$s().then(({data:j})=>T(j))},[]);const f=j=>{if(!j)return;const C=(P,w)=>{const k=new Date(w*1e3);return P.setHours(k.getHours(),k.getMinutes(),k.getSeconds()),Math.floor(P.getTime()/1e3)};j.from&&R.setValue("started_at",C(j.from,R.watch("started_at"))),j.to&&R.setValue("ended_at",C(j.to,R.watch("ended_at")))},g=async j=>{Sd(j).then(()=>{d(!1),a==="create"&&R.reset(nn),n()})},S=(j,C)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:C}),e.jsx(D,{type:"datetime-local",step:"1",value:xe(R.watch(j),"YYYY-MM-DDTHH:mm:ss"),onChange:P=>{const w=new Date(P.target.value);R.setValue(j,Math.floor(w.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(je,{open:o,onOpenChange:d,children:[l&&e.jsx($e,{asChild:!0,children:l}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsx(ye,{children:e.jsx(ve,{children:i(a==="create"?"form.add":"form.edit")})}),e.jsx(fe,{...R,children:e.jsxs("form",{onSubmit:R.handleSubmit(g),className:"space-y-4",children:[e.jsx(b,{control:R.control,name:"name",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.name.label")}),e.jsx(D,{placeholder:i("form.name.placeholder"),...j}),e.jsx(E,{})]})}),e.jsx(b,{control:R.control,name:"code",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.code.label")}),e.jsx(D,{placeholder:i("form.code.placeholder"),...j,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:R.control,name:"type",render:({field:j})=>e.jsxs(W,{value:j.value.toString(),onValueChange:C=>{const P=j.value,w=parseInt(C);j.onChange(w);const k=R.getValues("value");k&&(P===ze.AMOUNT&&w===ze.PERCENT?R.setValue("value",k/100):P===ze.PERCENT&&w===ze.AMOUNT&&R.setValue("value",k*100))},children:[e.jsx(U,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(Y,{placeholder:i("form.type.placeholder")})}),e.jsx(B,{children:Object.entries(Yd).map(([C,P])=>e.jsx(A,{value:C,children:i(`table.toolbar.types.${C}`)},C))})]})}),e.jsx(b,{control:R.control,name:"value",render:({field:j})=>{const C=j.value===""?"":R.watch("type")===ze.AMOUNT&&typeof j.value=="number"?(j.value/100).toString():j.value.toString();return e.jsx(D,{type:"number",placeholder:i("form.value.placeholder"),...j,value:C,onChange:P=>{const w=P.target.value;if(w===""){j.onChange("");return}const k=parseFloat(w);isNaN(k)||j.onChange(R.watch("type")===ze.AMOUNT?Math.round(k*100):k)},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:R.watch("type")==ze.AMOUNT?"¥":"%"})})]})]}),e.jsxs(v,{children:[e.jsx(y,{children:i("form.validity.label")}),e.jsxs(is,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(V,{variant:"outline",className:N("w-full justify-start text-left font-normal",!R.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(ht,{className:"mr-2 h-4 w-4"}),xe(R.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ",i("form.validity.to")," ",xe(R.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(ts,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(qs,{mode:"range",selected:{from:new Date(R.watch("started_at")*1e3),to:new Date(R.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:[S("started_at",i("table.validity.startTime")),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:i("form.validity.to")}),S("ended_at",i("table.validity.endTime"))]})})]})]}),e.jsx(E,{})]}),e.jsx(b,{control:R.control,name:"limit_use",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.limitUse.label")}),e.jsx(D,{type:"number",min:0,placeholder:i("form.limitUse.placeholder"),...j,value:j.value===void 0?"":j.value,onChange:C=>j.onChange(C.target.value===""?"":C.target.value),className:"h-9"}),e.jsx(M,{className:"text-xs",children:i("form.limitUse.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:R.control,name:"limit_use_with_user",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.limitUseWithUser.label")}),e.jsx(D,{type:"number",min:0,placeholder:i("form.limitUseWithUser.placeholder"),...j,value:j.value===void 0?"":j.value,onChange:C=>j.onChange(C.target.value===""?"":C.target.value),className:"h-9"}),e.jsx(M,{className:"text-xs",children:i("form.limitUseWithUser.description")}),e.jsx(E,{})]})}),e.jsx(b,{control:R.control,name:"limit_period",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.limitPeriod.label")}),e.jsx(ut,{options:Object.entries(ct).filter(([C])=>isNaN(Number(C))).map(([C,P])=>({label:i(`coupon:period.${P}`),value:C})),onChange:C=>{if(C.length===0){j.onChange([]);return}const P=C.map(w=>ct[w.value]);j.onChange(P)},value:(j.value||[]).map(C=>({label:i(`coupon:period.${C}`),value:Object.entries(ct).find(([P,w])=>w===C)?.[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:R.control,name:"limit_plan_ids",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.limitPlan.label")}),e.jsx(ut,{options:p?.map(C=>({label:C.name,value:C.id.toString()}))||[],onChange:C=>j.onChange(C.map(P=>Number(P.value))),value:(p||[]).filter(C=>(j.value||[]).includes(C.id)).map(C=>({label:C.name,value:C.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:R.control,name:"generate_count",render:({field:j})=>e.jsxs(v,{children:[e.jsx(y,{children:i("form.generateCount.label")}),e.jsx(D,{type:"number",min:0,placeholder:i("form.generateCount.placeholder"),...j,value:j.value===void 0?"":j.value,onChange:C=>j.onChange(C.target.value===""?"":C.target.value),className:"h-9"}),e.jsx(M,{className:"text-xs",children:i("form.generateCount.description")}),e.jsx(E,{})]})})}),e.jsx(qe,{children:e.jsx(V,{type:"submit",disabled:R.formState.isSubmitting,children:R.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(V,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(ke,{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:ze.AMOUNT,label:l(`table.toolbar.types.${ze.AMOUNT}`)},{value:ze.PERCENTAGE,label:l(`table.toolbar.types.${ze.PERCENTAGE}`)}]}),a&&e.jsxs(V,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[l("table.toolbar.reset"),e.jsx(He,{className:"ml-2 h-4 w-4"})]})]})}const Qr=m.createContext(void 0);function Ax({children:s,refetch:n}){const[a,l]=m.useState(!1),[r,c]=m.useState(null),i=x=>{c(x),l(!0)},u=()=>{l(!1),c(null)};return e.jsxs(Qr.Provider,{value:{isOpen:a,currentCoupon:r,openEdit:i,closeEdit:u},children:[s,r&&e.jsx(Yr,{defaultValues:r,refetch:n,type:"edit",open:a,onOpenChange:l})]})}function $x(){const s=m.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(O,{column:a,title:n("table.columns.id")}),cell:({row:a})=>e.jsx(H,{children:a.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.show")}),cell:({row:a})=>e.jsx(K,{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(O,{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(O,{column:a,title:n("table.columns.type")}),cell:({row:a})=>e.jsx(H,{variant:"outline",children:n(`table.toolbar.types.${a.original.type}`)}),enableSorting:!0},{accessorKey:"code",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.code")}),cell:({row:a})=>e.jsx(H,{variant:"secondary",children:a.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:a})=>e.jsx(O,{column:a,title:n("table.columns.limitUse")}),cell:({row:a})=>e.jsx(H,{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(O,{column:a,title:n("table.columns.limitUseWithUser")}),cell:({row:a})=>e.jsx(H,{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(O,{column:a,title:n("table.columns.validity")}),cell:({row:a})=>{const[l,r]=m.useState(!1),c=Date.now(),i=a.original.started_at*1e3,u=a.original.ended_at*1e3,x=c>u,o=ce.jsx(O,{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(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>l(a.original),children:[e.jsx(zs,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),e.jsx(We,{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&&($.success("删除成功"),s())})},children:e.jsxs(V,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(os,{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]=m.useState({}),[a,l]=m.useState({}),[r,c]=m.useState([]),[i,u]=m.useState([]),[x,o]=m.useState({pageIndex:0,pageSize:20}),{refetch:d,data:p}=te({queryKey:["couponList",x,r,i],queryFn:()=>Cd({pageSize:x.pageSize,current:x.pageIndex+1,filter:r,sort:i})}),T=Be({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:u,onColumnFiltersChange:c,onColumnVisibilityChange:l,onPaginationChange:o,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),getSortedRowModel:ss(),getFacetedRowModel:fs(),getFacetedUniqueValues:ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ax,{refetch:d,children:e.jsx("div",{className:"space-y-4",children:e.jsx(as,{table:T,toolbar:e.jsx(Lx,{table:T,refetch:d})})})})}function Kx(){const{t:s}=F("coupon");return e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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]=m.useState(!1),r=ue({resolver:he(Bx),defaultValues:Gx,mode:"onChange"}),[c,i]=m.useState([]);return m.useEffect(()=>{a&&$s().then(({data:u})=>{u&&i(u)})},[a]),e.jsxs(je,{open:a,onOpenChange:l,children:[e.jsx($e,{asChild:!0,children:e.jsxs(G,{size:"sm",variant:"outline",className:"space-x-2 gap-0",children:[e.jsx(ke,{icon:"ion:add"}),e.jsx("div",{children:n("generate.button")})]})}),e.jsxs(pe,{className:"sm:max-w-[425px]",children:[e.jsxs(ye,{children:[e.jsx(ve,{children:n("generate.title")}),e.jsx(Ee,{})]}),e.jsxs(fe,{...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:u})=>e.jsx(D,{className:"flex-[5] rounded-r-none",placeholder:n("generate.form.email_prefix"),...u})}),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:u})=>e.jsx(D,{className:"flex-[4] rounded-l-none",placeholder:n("generate.form.email_domain"),...u})})]})]}),e.jsx(b,{control:r.control,name:"password",render:({field:u})=>e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.password")}),e.jsx(D,{placeholder:n("generate.form.password_placeholder"),...u}),e.jsx(E,{})]})}),e.jsx(b,{control:r.control,name:"expired_at",render:({field:u})=>e.jsxs(v,{className:"flex flex-col",children:[e.jsx(y,{children:n("generate.form.expire_time")}),e.jsxs(is,{children:[e.jsx(cs,{asChild:!0,children:e.jsx(_,{children:e.jsxs(G,{variant:"outline",className:N("w-full pl-3 text-left font-normal",!u.value&&"text-muted-foreground"),children:[u.value?xe(u.value):e.jsx("span",{children:n("generate.form.expire_time_placeholder")}),e.jsx(ht,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(ts,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(Mi,{asChild:!0,children:e.jsx(G,{variant:"outline",className:"w-full",onClick:()=>{u.onChange(null)},children:n("generate.form.permanent")})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(qs,{mode:"single",selected:u.value?new Date(u.value*1e3):void 0,onSelect:x=>{x&&u.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(b,{control:r.control,name:"plan_id",render:({field:u})=>e.jsxs(v,{children:[e.jsx(y,{children:n("generate.form.subscription")}),e.jsx(_,{children:e.jsxs(W,{value:u.value?u.value.toString():"null",onValueChange:x=>u.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:n("generate.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(A,{value:"null",children:n("generate.form.subscription_none")}),c.map(x=>e.jsx(A,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!r.watch("email_prefix")&&e.jsx(b,{control:r.control,name:"generate_count",render:({field:u})=>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:u.value||"",onChange:x=>u.onChange(x.target.value?parseInt(x.target.value):null)})]})})]}),e.jsxs(qe,{children:[e.jsx(G,{variant:"outline",onClick:()=>l(!1),children:n("generate.form.cancel")}),e.jsx(G,{onClick:()=>r.handleSubmit(u=>{Rd(u).then(({data:x})=>{x&&($.success(n("generate.form.success")),r.reset(),s(),l(!1))})})(),children:n("generate.form.submit")})]})]})]})}const Jr=cn,Zr=dn,Yx=mn,Xr=m.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=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"}}),Va=m.forwardRef(({side:s="right",className:n,children:a,...l},r)=>e.jsxs(Yx,{children:[e.jsx(Xr,{}),e.jsxs(It,{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(He,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),a]})]}));Va.displayName=It.displayName;const Ia=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-2 text-center sm:text-left",s),...n});Ia.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=m.forwardRef(({className:s,...n},a)=>e.jsx(Ft,{ref:a,className:N("text-lg font-semibold text-foreground",s),...n}));Fa.displayName=Ft.displayName;const Ma=m.forwardRef(({className:s,...n},a)=>e.jsx(Mt,{ref:a,className:N("text-sm text-muted-foreground",s),...n}));Ma.displayName=Mt.displayName;function Jx({table:s,refetch:n,permissionGroups:a=[],subscriptionPlans:l=[]}){const{t:r}=F("user"),c=s.getState().columnFilters.length>0,[i,u]=m.useState([]),[x,o]=m.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=C=>C*1024*1024*1024,T=C=>C/(1024*1024*1024),R=()=>{u([...i,{field:"",operator:"",value:""}])},f=C=>{u(i.filter((P,w)=>w!==C))},g=(C,P,w)=>{const k=[...i];if(k[C]={...k[C],[P]:w},P==="field"){const L=d.find(J=>J.value===w);L&&(k[C].operator=L.operators[0].value,k[C].value=L.type==="boolean"?!1:"")}u(k)},S=(C,P)=>{const w=d.find(k=>k.value===C.field);if(!w)return null;switch(w.type){case"text":return e.jsx(D,{placeholder:r("filter.sheet.value"),value:C.value,onChange:k=>g(P,"value",k.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:w.unit}),value:w.unit==="GB"?T(C.value||0):C.value,onChange:k=>{const L=Number(k.target.value);g(P,"value",w.unit==="GB"?p(L):L)}}),w.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:w.unit})]});case"date":return e.jsx(qs,{mode:"single",selected:C.value,onSelect:k=>g(P,"value",k),className:"rounded-md border"});case"select":return e.jsxs(W,{value:C.value,onValueChange:k=>g(P,"value",k),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("filter.sheet.value")})}),e.jsx(B,{children:w.useOptions?l.map(k=>e.jsx(A,{value:k.value.toString(),children:k.label},k.value)):w.options?.map(k=>e.jsx(A,{value:k.value.toString(),children:k.label},k.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(K,{checked:C.value,onCheckedChange:k=>g(P,"value",k)}),e.jsx(Dt,{children:C.value?r("filter.boolean.true"):r("filter.boolean.false")})]});default:return null}},j=()=>{const C=i.filter(P=>P.field&&P.operator&&P.value!=="").map(P=>{const w=d.find(L=>L.value===P.field);let k=P.value;return P.operator==="contains"?{id:P.field,value:k}:(w?.type==="date"&&k instanceof Date&&(k=Math.floor(k.getTime()/1e3)),w?.type==="boolean"&&(k=k?1:0),{id:P.field,value:`${P.operator}:${k}`})});s.setColumnFilters(C),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:C=>s.getColumn("email")?.setFilterValue(C.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(V,{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(H,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:i.length})]})}),e.jsxs(Va,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(Ia,{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(V,{variant:"outline",size:"sm",onClick:R,children:r("filter.sheet.add")})]}),e.jsx(Js,{className:"h-[calc(100vh-280px)] pr-4",children:e.jsx("div",{className:"space-y-4",children:i.map((C,P)=>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(Dt,{children:r("filter.sheet.condition",{number:P+1})}),e.jsx(V,{variant:"ghost",size:"sm",onClick:()=>f(P),children:e.jsx(He,{className:"h-4 w-4"})})]}),e.jsxs(W,{value:C.field,onValueChange:w=>g(P,"field",w),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("filter.sheet.field")})}),e.jsx(B,{children:d.map(w=>e.jsx(A,{value:w.value,children:w.label},w.value))})]}),C.field&&e.jsxs(W,{value:C.operator,onValueChange:w=>g(P,"operator",w),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:r("filter.sheet.operator")})}),e.jsx(B,{children:d.find(w=>w.value===C.field)?.operators.map(w=>e.jsx(A,{value:w.value,children:w.label},w.value))})]}),C.field&&C.operator&&S(C,P)]},P))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(V,{variant:"outline",onClick:()=>{u([]),o(!1)},children:r("filter.sheet.reset")}),e.jsx(V,{onClick:j,children:r("filter.sheet.apply")})]})]})]})]}),c&&e.jsxs(V,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),u([])},className:"h-8 px-2 lg:px-3",children:[r("filter.reset"),e.jsx(He,{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=m.createContext(void 0);function Xx({children:s,defaultValues:n,open:a,onOpenChange:l}){const[r,c]=m.useState(!1),[i,u]=m.useState(!1),[x,o]=m.useState([]),d=ue({resolver:he(Zx),defaultValues:n,mode:"onChange"});m.useEffect(()=>{a!==void 0&&c(a)},[a]);const p=T=>{c(T),l?.(T)};return e.jsx(sl.Provider,{value:{form:d,formOpen:r,setFormOpen:p,datePickerOpen:i,setDatePickerOpen:u,planList:x,setPlanList:o},children:s})}function eh(){const s=m.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:u,setPlanList:x}=eh();return m.useEffect(()=>{l&&$s().then(({data:o})=>{x(o)})},[l,x]),e.jsxs(fe,{...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(is,{open:c,onOpenChange:i,children:[e.jsx(cs,{asChild:!0,children:e.jsx(_,{children:e.jsxs(V,{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?xe(o.value):e.jsx("span",{children:n("edit.form.expire_time_placeholder")}),e.jsx(ht,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(ts,{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(V,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{o.onChange(null),i(!1)},children:n("edit.form.expire_time_permanent")}),e.jsx(V,{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(V,{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(qs,{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:xe(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(V,{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(W,{value:o.value?o.value.toString():"null",onValueChange:d=>o.onChange(d==="null"?null:parseInt(d)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:n("edit.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(A,{value:"null",children:n("edit.form.subscription_none")}),u.map(d=>e.jsx(A,{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(W,{value:o.value.toString(),onValueChange:d=>o.onChange(parseInt(d)),children:[e.jsx(U,{children:e.jsx(Y,{})}),e.jsxs(B,{children:[e.jsx(A,{value:"1",children:n("columns.status_text.banned")}),e.jsx(A,{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(W,{value:o.value.toString(),onValueChange:d=>o.onChange(parseInt(d)),children:[e.jsx(U,{children:e.jsx(Y,{placeholder:n("edit.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(A,{value:"0",children:n("edit.form.commission_type_system")}),e.jsx(A,{value:"1",children:n("edit.form.commission_type_cycle")}),e.jsx(A,{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(K,{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(K,{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(vs,{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(V,{variant:"outline",onClick:()=>r(!1),children:n("edit.form.cancel")}),e.jsx(V,{type:"submit",onClick:()=>{a.handleSubmit(o=>{Dd(o).then(({data:d})=>{d&&($.success(n("edit.form.success")),r(!1),s())})})()},children:n("edit.form.submit")})]})]})}function tl({refetch:s,defaultValues:n,dialogTrigger:a=e.jsxs(V,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(ft,{className:"mr-2 h-4 w-4"}),t("edit.button")]})}){const{t:l}=F("user"),[r,c]=m.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(Va,{className:"max-w-[90%] space-y-4",children:[e.jsxs(Ia,{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"})}),Zt=[{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:rs(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:rs(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(H,{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:rs(n)})}}];function rl({user_id:s,dialogTrigger:n}){const{t:a}=F(["traffic"]),[l,r]=m.useState(!1),[c,i]=m.useState({pageIndex:0,pageSize:20}),{data:u,isLoading:x}=te({queryKey:["userStats",s,c,l],queryFn:()=>l?Vd({user_id:s,pageSize:c.pageSize,page:c.pageIndex+1}):null}),o=Be({data:u?.data??[],columns:Zt,pageCount:Math.ceil((u?.total??0)/c.pageSize),state:{pagination:c},manualPagination:!0,getCoreRowModel:Ge(),onPaginationChange:i});return e.jsxs(je,{open:l,onOpenChange:r,children:[e.jsx($e,{asChild:!0,children:n}),e.jsxs(pe,{className:"sm:max-w-[700px]",children:[e.jsx(ye,{children:e.jsx(ve,{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(ws,{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:kt(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(ws,{children:Array.from({length:Zt.length}).map((T,R)=>e.jsx(Ws,{className:"p-2",children:e.jsx(ae,{className:"h-6 w-full"})},R))},p)):o.getRowModel().rows?.length?o.getRowModel().rows.map(d=>e.jsx(ws,{"data-state":d.getIsSelected()&&"selected",className:"h-10",children:d.getVisibleCells().map(p=>e.jsx(Ws,{className:"px-2",children:kt(p.column.columnDef.cell,p.getContext())},p.id))},d.id)):e.jsx(ws,{children:e.jsx(Ws,{colSpan:Zt.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(W,{value:`${o.getState().pagination.pageSize}`,onValueChange:d=>{o.setPageSize(Number(d))},children:[e.jsx(U,{className:"h-8 w-[70px]",children:e.jsx(Y,{placeholder:o.getState().pagination.pageSize})}),e.jsx(B,{side:"top",children:[10,20,30,40,50].map(d=>e.jsx(A,{value:`${d}`,children:d},d))})]}),e.jsx("p",{className:"text-sm font-medium",children: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(G,{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(G,{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:u}){return e.jsxs(Mr,{children:[e.jsx(Or,{asChild:!0,children:n}),e.jsxs(wa,{className:N("sm:max-w-[425px]",u),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(V,{variant:"outline",children:r})}),e.jsx(Pa,{asChild:!0,children:e.jsx(V,{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(O,{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(O,{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(O,{column:l,title:a("columns.id")}),cell:({row:l})=>e.jsx(H,{variant:"outline",children:l.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:l})=>e.jsx(O,{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 u=c?a("columns.online_status.online"):r===0?a("columns.online_status.never"):a("columns.online_status.last_online",{time:xe(r)});if(!c&&r!==0){const x=Math.floor(i/60),o=Math.floor(x/60),d=Math.floor(o/24);d>0?u+=` +`+a("columns.online_status.offline_duration.days",{count:d}):o>0?u+=` +`+a("columns.online_status.offline_duration.hours",{count:o}):x>0?u+=` +`+a("columns.online_status.offline_duration.minutes",{count:x}):u+=` +`+a("columns.online_status.offline_duration.seconds",{count:i})}return e.jsx(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{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(re,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:u})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:l})=>e.jsx(O,{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(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(H,{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(re,{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(O,{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(H,{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(O,{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(O,{column:l,title:a("columns.group")}),cell:({row:l})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(H,{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(O,{column:l,title:a("columns.used_traffic")}),cell:({row:l})=>{const r=rs(l.original?.total_used),c=rs(l.original?.transfer_enable),i=l.original?.total_used/l.original?.transfer_enable*100||0;return e.jsx(me,{delayDuration:100,children:e.jsxs(ce,{children:[e.jsx(de,{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(re,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",c]})})]})})}},{accessorKey:"transfer_enable",header:({column:l})=>e.jsx(O,{column:l,title:a("columns.total_traffic")}),cell:({row:l})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:rs(l.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:l})=>e.jsx(O,{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(O,{column:l,title:a("columns.balance")}),cell:({row:l})=>{const r=Gs(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(O,{column:l,title:a("columns.commission")}),cell:({row:l})=>{const r=Gs(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(O,{column:l,title:a("columns.register_time")}),cell:({row:l})=>e.jsx("div",{className:"truncate",children:xe(l.original?.created_at)}),size:1e3},{id:"actions",header:({column:l})=>e.jsx(O,{column:l,className:"justify-end",title:a("columns.actions")}),cell:({row:l,table:r})=>e.jsxs(ks,{modal:!0,children:[e.jsx(Ts,{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(Pt,{className:"size-4"})})})}),e.jsxs(xs,{align:"end",className:"min-w-[40px]",children:[e.jsx(ge,{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(G,{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(ge,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(Wr,{defaultValues:{email:l.original.email},trigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(lh,{className:"mr-2 "}),a("columns.actions_menu.assign_order")]})})}),e.jsx(ge,{onSelect:()=>{Et(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(oh,{className:"mr-2"}),a("columns.actions_menu.copy_url")]})}),e.jsx(ge,{onSelect:()=>{Ed({id:l.original.id}).then(({data:c})=>{c&&$.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(ih,{className:"mr-2 "}),a("columns.actions_menu.reset_secret")]})}),e.jsx(ge,{onSelect:()=>{},className:"p-0",children:e.jsxs(Os,{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(ge,{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(ge,{onSelect:c=>c.preventDefault(),className:"p-0",children:e.jsx(rl,{user_id:l.original?.id,dialogTrigger:e.jsxs(G,{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(ge,{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&&($.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(uh,{className:"mr-2"}),a("columns.actions_menu.delete")]})})})]})]})}]};function hh(){const[s]=or(),[n,a]=m.useState({}),[l,r]=m.useState({is_admin:!1,is_staff:!1}),[c,i]=m.useState([]),[u,x]=m.useState([]),[o,d]=m.useState({pageIndex:0,pageSize:20});m.useEffect(()=>{const k=s.get("email");k&&i(L=>L.some(z=>z.id==="email")?L:[...L,{id:"email",value:k}])},[s]);const{refetch:p,data:T,isLoading:R}=te({queryKey:["userList",o,c,u],queryFn:()=>Pd({pageSize:o.pageSize,current:o.pageIndex+1,filter:c,sort:u})}),[f,g]=m.useState([]),[S,j]=m.useState([]);m.useEffect(()=>{$t().then(({data:k})=>{g(k)}),$s().then(({data:k})=>{j(k)})},[]);const C=f.map(k=>({label:k.name,value:k.id})),P=S.map(k=>({label:k.name,value:k.id})),w=Be({data:T?.data??[],columns:xh(p),state:{sorting:u,columnVisibility:l,rowSelection:n,columnFilters:c,pagination:o},rowCount:T?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:x,onColumnFiltersChange:i,onColumnVisibilityChange:r,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),onPaginationChange:d,getSortedRowModel:ss(),getFacetedRowModel:fs(),getFacetedUniqueValues:ps(),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(as,{table:w,toolbar:e.jsx(Jx,{table:w,refetch:p,serverGroupList:f,permissionGroups:C,subscriptionPlans:P})})}function fh(){const{t:s}=F("user");return e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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(is,{children:[e.jsx(cs,{asChild:!0,children:e.jsxs(G,{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(Ne,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(H,{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(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(r=>l.has(r.value)).map(r=>e.jsx(H,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:r.label},`selected-${r.value}`))})]})]})}),e.jsx(ts,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Ps,{children:[e.jsx(Ls,{placeholder:n}),e.jsxs(Ds,{children:[e.jsx(As,{children:"No results found."}),e.jsx(Ae,{children:a.map(r=>{const c=l.has(r.value);return e.jsxs(Te,{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(Xs,{}),e.jsx(Ae,{children:e.jsx(Te,{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(qt,{className:"grid w-full grid-cols-2",children:[e.jsx(Cs,{value:"0",children:n("status.pending")}),e.jsx(Cs,{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:De.LOW,icon:jh,color:"gray"},{label:n("level.medium"),value:De.MIDDLE,icon:al,color:"yellow"},{label:n("level.high"),value:De.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=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"}}),ll=m.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:m.Children.map(l,i=>m.isValidElement(i)&&typeof i.type!="string"?m.cloneElement(i,{variant:n,layout:a}):i)}));ll.displayName="ChatBubble";const Nh=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"}}),ol=m.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=m.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=m.forwardRef(({className:s,...n},a)=>e.jsx(vs,{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(ae,{className:"h-8 w-3/4"}),e.jsx(ae,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(ae,{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(ae,{className:"h-5 w-4/5"}),e.jsx(ae,{className:"h-4 w-2/3"}),e.jsx(ae,{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 De.HIGH:return"bg-red-50 text-red-600 border-red-200";case De.MIDDLE:return"bg-yellow-50 text-yellow-600 border-yellow-200";case De.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(H,{variant:s.status===Ss.CLOSED?"secondary":"default",className:"shrink-0",children:s.status===Ss.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:xe(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===De.LOW?"low":s.level===De.MIDDLE?"medium":"high"}`)})]})]})}function Dh({ticketId:s,dialogTrigger:n}){const{t:a}=F("ticket"),l=hs(),r=m.useRef(null),c=m.useRef(null),[i,u]=m.useState(!1),[x,o]=m.useState(""),[d,p]=m.useState(!1),[T,R]=m.useState(s),[f,g]=m.useState(""),[S,j]=m.useState(!1),{data:C,isLoading:P,refetch:w}=te({queryKey:["tickets",i],queryFn:()=>i?Gt.getList({filter:[{id:"status",value:[Ss.OPENING]}]}):Promise.resolve(null),enabled:i}),{data:k,refetch:L,isLoading:J}=te({queryKey:["ticket",T,i],queryFn:()=>i?Fd(T):Promise.resolve(null),refetchInterval:i?5e3:!1,retry:3}),z=k?.data,bs=(C?.data||[]).filter(se=>se.subject.toLowerCase().includes(f.toLowerCase())||se.user?.email.toLowerCase().includes(f.toLowerCase())),Hs=(se="smooth")=>{if(r.current){const{scrollHeight:ns,clientHeight:st}=r.current;r.current.scrollTo({top:ns-st,behavior:se})}};m.useEffect(()=>{if(!i)return;const se=requestAnimationFrame(()=>{Hs("instant"),setTimeout(()=>Hs(),1e3)});return()=>{cancelAnimationFrame(se)}},[i,z?.messages]);const et=async()=>{const se=x.trim();!se||d||(p(!0),Gt.reply({id:T,message:se}).then(()=>{o(""),L(),Hs(),setTimeout(()=>{c.current?.focus()},0)}).finally(()=>{p(!1)}))},ee=async()=>{Gt.close(T).then(()=>{$.success(a("actions.close_success")),L(),w()})},Es=()=>{z?.user&&l("/finance/order?user_id="+z.user.id)},Fe=z?.status===Ss.CLOSED;return e.jsxs(je,{open:i,onOpenChange:u,children:[e.jsx($e,{asChild:!0,children:n??e.jsx(G,{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(ve,{}),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:()=>j(!S),children:e.jsx(rn,{className:N("h-4 w-4 transition-transform",!S&&"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",S?"-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:()=>j(!S),children:e.jsx(rn,{className:N("h-4 w-4 transition-transform",!S&&"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:se=>g(se.target.value),className:"pl-8"})]})]}),e.jsx(Js,{className:"flex-1",children:e.jsx("div",{className:"w-full",children:P?e.jsx(Th,{}):bs.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")}):bs.map(se=>e.jsx(Ph,{ticket:se,isActive:se.id===T,onClick:()=>{R(se.id),window.innerWidth<768&&j(!0)}},se.id))})})]}),e.jsxs("div",{className:"flex-1 flex flex-col relative",children:[!S&&e.jsx("div",{className:"absolute inset-0 bg-black/20 z-30 md:hidden",onClick:()=>j(!0)}),J?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:z?.subject}),e.jsx(H,{variant:Fe?"secondary":"default",children:a(Fe?"status.closed":"status.processing")}),!Fe&&e.jsx(We,{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(G,{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(xt,{className:"h-4 w-4"}),e.jsx("span",{children:z?.user?.email})]}),e.jsx(Ne,{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")," ",xe(z?.created_at)]})]}),e.jsx(Ne,{orientation:"vertical",className:"h-4"}),e.jsx(H,{variant:"outline",children:z?.level!=null&&a(`level.${z.level===De.LOW?"low":z.level===De.MIDDLE?"medium":"high"}`)})]})]}),z?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(tl,{defaultValues:z.user,refetch:L,dialogTrigger:e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.user_info"),children:e.jsx(xt,{className:"h-4 w-4"})})}),e.jsx(rl,{user_id:z.user.id,dialogTrigger:e.jsx(G,{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(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:a("detail.order_records"),onClick:Es,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:z?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:a("detail.no_messages")}):z?.messages?.map(se=>e.jsx(ll,{variant:se.is_me?"sent":"received",className:se.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:se.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:xe(se.created_at)})})]})})},se.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:Fe||d,placeholder:a(Fe?"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:se=>o(se.target.value),onKeyDown:se=>{se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),et())}}),e.jsx(G,{disabled:Fe||d||!x.trim(),onClick:et,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"})}),Vh=s=>{const{t:n}=F("ticket");return[{accessorKey:"id",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.id")}),cell:({row:a})=>e.jsx(H,{variant:"outline",children:a.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:a})=>e.jsx(O,{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(O,{column:a,title:n("columns.level")}),cell:({row:a})=>{const l=a.getValue("level"),r=l===De.LOW?"default":l===De.MIDDLE?"secondary":"destructive";return e.jsx(H,{variant:r,className:"whitespace-nowrap",children:n(`level.${l===De.LOW?"low":l===De.MIDDLE?"medium":"high"}`)})},filterFn:(a,l,r)=>r.includes(a.getValue(l))},{accessorKey:"status",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.status")}),cell:({row:a})=>{const l=a.getValue("status"),r=a.original.reply_status,c=l===Ss.CLOSED?n("status.closed"):n(r===0?"status.replied":"status.pending"),i=l===Ss.CLOSED?"default":r===0?"secondary":"destructive";return e.jsx(H,{variant:i,className:"whitespace-nowrap",children:c})}},{accessorKey:"updated_at",header:({column:a})=>e.jsx(O,{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:xe(a.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:a})=>e.jsx(O,{column:a,title:n("columns.created_at")}),cell:({row:a})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:xe(a.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:a})=>e.jsx(O,{className:"justify-end",column:a,title:n("columns.actions")}),cell:({row:a})=>{const l=a.original.status!==Ss.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Dh,{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(Rh,{className:"h-4 w-4"})})}),l&&e.jsx(We,{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(()=>{$.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(cl,{className:"h-4 w-4"})})})]})}}]};function Ih(){const[s,n]=m.useState({}),[a,l]=m.useState({}),[r,c]=m.useState([{id:"status",value:"0"}]),[i,u]=m.useState([]),[x,o]=m.useState({pageIndex:0,pageSize:20}),{refetch:d,data:p,isLoading:T}=te({queryKey:["orderList",x,r,i],queryFn:()=>Id({pageSize:x.pageSize,current:x.pageIndex+1,filter:r,sort:i})}),R=Be({data:p?.data??[],columns:Vh(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:u,onColumnFiltersChange:c,onColumnVisibilityChange:l,getCoreRowModel:Ge(),getFilteredRowModel:Xe(),getPaginationRowModel:es(),onPaginationChange:o,getSortedRowModel:ss(),getFacetedRowModel:fs(),getFacetedUniqueValues:ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(vh,{table:R,refetch:d}),e.jsx(as,{table:R,showPagination:!0})]})}function Fh(){const{t:s}=F("ticket");return e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(Oe,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ve,{}),e.jsx(Ie,{})]})]}),e.jsxs(Pe,{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(Ih,{})})]})]})}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}; diff --git a/public/assets/admin/locales/en-US.js b/public/assets/admin/locales/en-US.js index a58d275..a7dc046 100644 --- a/public/assets/admin/locales/en-US.js +++ b/public/assets/admin/locales/en-US.js @@ -1342,7 +1342,7 @@ window.XBOARD_TRANSLATIONS['en-US'] = { }, "ticket": { "title": "Ticket Management", - "description": "Here you can view user tickets, including viewing, replying, and closing operations.", + "description": "View and manage user tickets, including viewing, replying, and closing operations.", "columns": { "id": "Ticket ID", "subject": "Subject", @@ -1359,13 +1359,13 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "processing": "Processing" }, "level": { - "low": "Low", - "medium": "Medium", - "high": "High" + "low": "Low Priority", + "medium": "Medium Priority", + "high": "High Priority" }, "filter": { "placeholder": "Search {field}...", - "no_results": "No results found.", + "no_results": "No results found", "selected": "{count} selected", "clear": "Clear filters" }, @@ -1373,8 +1373,8 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "view_details": "View Details", "close_ticket": "Close Ticket", "close_confirm_title": "Confirm Close Ticket", - "close_confirm_description": "After closing, you will not be able to reply. Are you sure you want to close this ticket?", - "close_confirm_button": "Close Ticket", + "close_confirm_description": "Are you sure you want to close this ticket? You won't be able to reply after closing.", + "close_confirm_button": "Confirm Close", "close_success": "Ticket closed successfully", "view_ticket": "View Ticket" }, @@ -1390,6 +1390,12 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "sending": "Sending...", "send": "Send" } + }, + "list": { + "title": "Ticket List", + "search_placeholder": "Search ticket subject or user email", + "no_tickets": "No pending tickets", + "no_search_results": "No matching tickets found" } }, "server": { diff --git a/public/assets/admin/locales/ko-KR.js b/public/assets/admin/locales/ko-KR.js index ed46175..d540615 100644 --- a/public/assets/admin/locales/ko-KR.js +++ b/public/assets/admin/locales/ko-KR.js @@ -1340,54 +1340,60 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { }, "ticket": { "title": "티켓 관리", - "description": "여기에서 사용자 티켓을 확인할 수 있으며, 조회, 답변 및 종료 작업을 수행할 수 있습니다.", + "description": "사용자 티켓을 보고, 답변하고, 닫는 등의 작업을 관리합니다.", "columns": { - "id": "티켓 ID", + "id": "티켓 번호", "subject": "제목", "level": "우선순위", "status": "상태", "updated_at": "최근 업데이트", - "created_at": "생성 시간", + "created_at": "생성일", "actions": "작업" }, "status": { - "closed": "종료됨", - "replied": "답변됨", - "pending": "대기 중", - "processing": "처리 중" + "closed": "닫힘", + "replied": "답변완료", + "pending": "대기중", + "processing": "처리중" }, "level": { - "low": "낮음", - "medium": "중간", - "high": "높음" + "low": "낮은 우선순위", + "medium": "중간 우선순위", + "high": "높은 우선순위" }, "filter": { "placeholder": "{field} 검색...", - "no_results": "검색 결과가 없습니다.", + "no_results": "결과를 찾을 수 없습니다", "selected": "{count}개 선택됨", "clear": "필터 초기화" }, "actions": { "view_details": "상세 보기", - "close_ticket": "티켓 종료", - "close_confirm_title": "티켓 종료 확인", - "close_confirm_description": "종료 후에는 답변할 수 없습니다. 이 티켓을 종료하시겠습니까?", - "close_confirm_button": "티켓 종료", - "close_success": "티켓이 성공적으로 종료되었습니다", + "close_ticket": "티켓 닫기", + "close_confirm_title": "티켓 닫기 확인", + "close_confirm_description": "이 티켓을 닫으시겠습니까? 닫은 후에는 답변할 수 없습니다.", + "close_confirm_button": "닫기 확인", + "close_success": "티켓이 성공적으로 닫혔습니다", "view_ticket": "티켓 보기" }, "detail": { - "no_messages": "메시지가 아직 없습니다", - "created_at": "생성 시간", + "no_messages": "메시지가 없습니다", + "created_at": "생성일", "user_info": "사용자 정보", "traffic_records": "트래픽 기록", "order_records": "주문 기록", "input": { - "closed_placeholder": "티켓이 종료되었습니다", + "closed_placeholder": "티켓이 닫혔습니다", "reply_placeholder": "답변을 입력하세요...", - "sending": "전송 중...", + "sending": "전송중...", "send": "전송" } + }, + "list": { + "title": "티켓 목록", + "search_placeholder": "티켓 제목 또는 사용자 이메일 검색", + "no_tickets": "대기중인 티켓이 없습니다", + "no_search_results": "일치하는 티켓을 찾을 수 없습니다" } }, "server": { diff --git a/public/assets/admin/locales/zh-CN.js b/public/assets/admin/locales/zh-CN.js index 33323ad..fb9fa86 100644 --- a/public/assets/admin/locales/zh-CN.js +++ b/public/assets/admin/locales/zh-CN.js @@ -1351,9 +1351,9 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "processing": "处理中" }, "level": { - "low": "低", - "medium": "中", - "high": "高" + "low": "低优先", + "medium": "中优先", + "high": "高优先" }, "filter": { "placeholder": "搜索{field}...", @@ -1365,8 +1365,8 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "view_details": "查看详情", "close_ticket": "关闭工单", "close_confirm_title": "确认关闭工单", - "close_confirm_description": "关闭后将无法继续回复,是否确认关闭该工单?", - "close_confirm_button": "关闭工单", + "close_confirm_description": "确定要关闭这个工单吗?关闭后将无法继续回复。", + "close_confirm_button": "确认关闭", "close_success": "工单已关闭", "view_ticket": "查看工单" }, @@ -1378,10 +1378,16 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "order_records": "订单记录", "input": { "closed_placeholder": "工单已关闭", - "reply_placeholder": "请输入回复内容...", + "reply_placeholder": "输入回复内容...", "sending": "发送中...", "send": "发送" } + }, + "list": { + "title": "工单列表", + "search_placeholder": "搜索工单标题或用户邮箱", + "no_tickets": "暂无待处理工单", + "no_search_results": "未找到匹配的工单" } }, "server": { @@ -1931,12 +1937,12 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "device": { "label": "设备限制", "placeholder": "请输入设备限制", - "unit": "台设备" + "unit": "台" }, "capacity": { "label": "容量限制", "placeholder": "请输入容量限制", - "unit": "个用户" + "unit": "人" }, "reset_method": { "label": "流量重置方式",