diff --git a/app/Http/Resources/MessageResource.php b/app/Http/Resources/MessageResource.php index f3992c6..9a72e1c 100644 --- a/app/Http/Resources/MessageResource.php +++ b/app/Http/Resources/MessageResource.php @@ -17,7 +17,7 @@ class MessageResource extends JsonResource return [ "id" => $this['id'], "ticket_id" => $this['ticket_id'], - "is_me" => $this['is_me'], + "is_me" => $this['is_from_user'], "message" => $this["message"], "created_at" => $this['created_at'], "updated_at" => $this['updated_at'] diff --git a/app/Models/TicketMessage.php b/app/Models/TicketMessage.php index 0cc3c95..c9d45a8 100644 --- a/app/Models/TicketMessage.php +++ b/app/Models/TicketMessage.php @@ -15,7 +15,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * @property \Illuminate\Support\Carbon $created_at * @property \Illuminate\Support\Carbon $updated_at * @property-read \App\Models\Ticket $ticket 关联的工单 - * @property-read bool $is_me 当前消息是否由工单发起人发送 + * @property-read bool $is_from_user 消息是否由工单发起人发送 + * @property-read bool $is_from_admin 消息是否由管理员发送 */ class TicketMessage extends Model { @@ -27,7 +28,7 @@ class TicketMessage extends Model 'updated_at' => 'timestamp' ]; - protected $appends = ['is_me']; + protected $appends = ['is_from_user', 'is_from_admin']; /** * 关联的工单 @@ -40,8 +41,16 @@ class TicketMessage extends Model /** * 判断消息是否由工单发起人发送 */ - public function getIsMeAttribute(): bool + public function getIsFromUserAttribute(): bool { return $this->ticket->user_id === $this->user_id; } + + /** + * 判断消息是否由管理员发送 + */ + public function getIsFromAdminAttribute(): bool + { + return $this->ticket->user_id !== $this->user_id; + } } diff --git a/public/assets/admin/assets/index.js b/public/assets/admin/assets/index.js index 60d2261..7e6130c 100644 --- a/public/assets/admin/assets/index.js +++ b/public/assets/admin/assets/index.js @@ -6,4 +6,4 @@ import{r as u,j as e,t as Sl,c as kl,I as Ka,a as As,S as Na,u as Ts,b as Tl,d a `+a("columns.online_status.offline_duration.days",{count:_}):h>0?o+=` `+a("columns.online_status.offline_duration.hours",{count:h}):c>0?o+=` `+a("columns.online_status.offline_duration.minutes",{count:c}):o+=` -`+a("columns.online_status.offline_duration.seconds",{count:m})}return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{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",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:i.original.email})]})}),e.jsx(ce,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:o})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.online_count")}),cell:({row:i})=>{const l=i.original.device_limit,d=i.original.online_count||0;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(q,{variant:"outline",className:N("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(ce,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.status")}),cell:({row:i})=>{const l=i.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(q,{className:N("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l))},{accessorKey:"plan_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.subscription")}),cell:({row:i})=>e.jsx("div",{className:"min-w-[10em] break-all",children:i.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.group")}),cell:({row:i})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(q,{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:i.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.used_traffic")}),cell:({row:i})=>{const l=ps(i.original?.total_used),d=ps(i.original?.transfer_enable),m=i.original?.total_used/i.original?.transfer_enable*100||0;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.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",m>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(m,100)}%`}})})]})}),e.jsx(ce,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.total_traffic")}),cell:({row:i})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ps(i.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.expire_time")}),cell:({row:i})=>{const l=i.original.expired_at,d=Date.now()/1e3,m=l!=null&&le.jsx(O,{column:i,title:a("columns.balance")}),cell:({row:i})=>{const l=Xs(i.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:l})]})}},{accessorKey:"commission_balance",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.commission")}),cell:({row:i})=>{const l=Xs(i.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:l})]})}},{accessorKey:"created_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.register_time")}),cell:({row:i})=>e.jsx("div",{className:"truncate",children:we(i.original?.created_at)}),size:1e3},{id:"actions",header:({column:i})=>e.jsx(O,{column:i,className:"justify-end",title:a("columns.actions")}),cell:({row:i,table:l})=>e.jsxs(Ss,{modal:!0,children:[e.jsx(ks,{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(Vt,{className:"size-4"})})})}),e.jsxs(fs,{align:"end",className:"min-w-[40px]",children:[e.jsx(je,{onSelect:d=>{d.preventDefault(),t(i.original),r(!0)},className:"p-0",children:e.jsxs(J,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Eh,{className:"mr-2"}),a("columns.actions_menu.edit")]})}),e.jsx(je,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(tl,{defaultValues:{email:i.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(je,{onSelect:()=>{Ft(i.original.subscribe_url).then(()=>{A.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(Ih,{className:"mr-2"}),a("columns.actions_menu.copy_url")]})}),e.jsx(je,{onSelect:()=>{xd({id:i.original.id}).then(({data:d})=>{d&&A.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Vh,{className:"mr-2 "}),a("columns.actions_menu.reset_secret")]})}),e.jsx(je,{onSelect:()=>{},className:"p-0",children:e.jsxs(Us,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=${i.original?.id}`,children:[e.jsx(Mh,{className:"mr-2"}),a("columns.actions_menu.orders")]})}),e.jsx(je,{onSelect:()=>{l.setColumnFilters([{id:"invite_user_id",value:"eq:"+i.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Fh,{className:"mr-2 "}),a("columns.actions_menu.invites")]})}),e.jsx(je,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(ul,{user_id:i.original?.id,dialogTrigger:e.jsxs(J,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Oh,{className:"mr-2 "}),a("columns.actions_menu.traffic_records")]})})}),e.jsx(je,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(Ph,{title:a("columns.actions_menu.delete_confirm_title"),description:a("columns.actions_menu.delete_confirm_description",{email:i.original.email}),cancelText:a("common:cancel"),confirmText:a("common:confirm"),variant:"destructive",onConfirm:async()=>{try{const{data:d}=await Ot.destroy(i.original.id);d&&(A.success(a("common:delete.success")),s())}catch{A.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(Lh,{className:"mr-2"}),a("columns.actions_menu.delete")]})})})]})]})}]},ml=u.createContext(void 0),qa=()=>{const s=u.useContext(ml);if(!s)throw new Error("useUserEdit must be used within an UserEditProvider");return s},xl=({children:s,refreshData:n})=>{const[t,r]=u.useState(!1),[a,i]=u.useState(null),l={isOpen:t,setIsOpen:r,editingUser:a,setEditingUser:i,refreshData:n};return e.jsx(ml.Provider,{value:l,children:s})},Ah=x.object({id:x.number(),email:x.string().email(),invite_user_email:x.string().email().nullable().optional(),password:x.string().optional().nullable(),balance:x.coerce.number(),commission_balance:x.coerce.number(),u:x.number(),d:x.number(),transfer_enable:x.number(),expired_at:x.number().nullable(),plan_id:x.number().nullable(),banned:x.number(),commission_type:x.number(),commission_rate:x.number().nullable(),discount:x.number().nullable(),speed_limit:x.number().nullable(),device_limit:x.number().nullable(),is_admin:x.number(),is_staff:x.number(),remarks:x.string().nullable()});function hl(){const{t:s}=V("user"),{isOpen:n,setIsOpen:t,editingUser:r,refreshData:a}=qa(),[i,l]=u.useState(!1),[d,m]=u.useState([]),o=ge({resolver:Ne(Ah),defaultValues:{id:0,email:"",invite_user_email:null,password:null,balance:0,commission_balance:0,u:0,d:0,transfer_enable:0,expired_at:null,plan_id:null,banned:0,commission_type:0,commission_rate:null,discount:null,speed_limit:null,device_limit:null,is_admin:0,is_staff:0,remarks:null}});return u.useEffect(()=>{n&&qs().then(({data:c})=>{m(c)})},[n]),u.useEffect(()=>{if(r){const c=r.invite_user?.email,{invite_user:h,..._}=r;o.reset({..._,invite_user_email:c||null,password:null})}},[r,o]),e.jsx(ll,{open:n,onOpenChange:t,children:e.jsxs(Aa,{className:"max-w-[90%] space-y-4",children:[e.jsxs($a,{children:[e.jsx(Ua,{children:s("edit.title")}),e.jsx(Ha,{})]}),e.jsxs(_e,{...o,children:[e.jsx(g,{control:o.control,name:"email",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.email")}),e.jsx(y,{children:e.jsx(T,{...c,placeholder:s("edit.form.email_placeholder")})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"invite_user_email",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.inviter_email")}),e.jsx(y,{children:e.jsx(T,{value:c.value||"",onChange:h=>c.onChange(h.target.value?h.target.value:null),placeholder:s("edit.form.inviter_email_placeholder")})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"password",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.password")}),e.jsx(y,{children:e.jsx(T,{type:"password",value:c.value||"",onChange:c.onChange,placeholder:s("edit.form.password_placeholder")})}),e.jsx(D,{...c})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(g,{control:o.control,name:"balance",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.balance")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:c.onChange,placeholder:s("edit.form.balance_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"commission_balance",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_balance")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:c.onChange,placeholder:s("edit.form.commission_balance_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"u",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.upload")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{value:c.value/1024/1024/1024||"",onChange:h=>c.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.upload_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"d",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.download")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value/1024/1024/1024||"",onChange:h=>c.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.download_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(D,{...c})]})})]}),e.jsx(g,{control:o.control,name:"transfer_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.total_traffic")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value/1024/1024/1024||"",onChange:h=>c.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.total_traffic_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"expired_at",render:({field:c})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(j,{children:s("edit.form.expire_time")}),e.jsxs(vs,{open:i,onOpenChange:l,children:[e.jsx(bs,{asChild:!0,children:e.jsx(y,{children:e.jsxs(P,{type:"button",variant:"outline",className:N("w-full pl-3 text-left font-normal",!c.value&&"text-muted-foreground"),onClick:()=>l(!0),children:[c.value?we(c.value):e.jsx("span",{children:s("edit.form.expire_time_placeholder")}),e.jsx(jt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(xs,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:h=>{h.preventDefault()},onEscapeKeyDown:h=>{h.preventDefault()},children:e.jsxs("div",{className:"flex flex-col space-y-3 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{c.onChange(null),l(!1)},children:s("edit.form.expire_time_permanent")}),e.jsx(P,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const h=new Date;h.setMonth(h.getMonth()+1),h.setHours(23,59,59,999),c.onChange(Math.floor(h.getTime()/1e3)),l(!1)},children:s("edit.form.expire_time_1month")}),e.jsx(P,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const h=new Date;h.setMonth(h.getMonth()+3),h.setHours(23,59,59,999),c.onChange(Math.floor(h.getTime()/1e3)),l(!1)},children:s("edit.form.expire_time_3months")})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Gs,{mode:"single",selected:c.value?new Date(c.value*1e3):void 0,onSelect:h=>{if(h){const _=new Date(c.value?c.value*1e3:Date.now());h.setHours(_.getHours(),_.getMinutes(),_.getSeconds()),c.onChange(Math.floor(h.getTime()/1e3))}},disabled:h=>h{const h=new Date;h.setHours(23,59,59,999),c.onChange(Math.floor(h.getTime()/1e3))},className:"h-6 px-2 text-xs",children:s("edit.form.expire_time_today")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"datetime-local",step:"1",value:we(c.value,"YYYY-MM-DDTHH:mm:ss"),onChange:h=>{const _=new Date(h.target.value);isNaN(_.getTime())||c.onChange(Math.floor(_.getTime()/1e3))},className:"flex-1"}),e.jsx(P,{type:"button",variant:"outline",onClick:()=>l(!1),children:s("edit.form.expire_time_confirm")})]})]})]})})]}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"plan_id",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.subscription")}),e.jsx(y,{children:e.jsxs(G,{value:c.value!==null?String(c.value):"null",onValueChange:h=>c.onChange(h==="null"?null:parseInt(h)),children:[e.jsx(K,{children:e.jsx(W,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(z,{value:"null",children:s("edit.form.subscription_none")}),d.map(h=>e.jsx(z,{value:String(h.id),children:h.name},h.id))]})]})})]})}),e.jsx(g,{control:o.control,name:"banned",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.account_status")}),e.jsx(y,{children:e.jsxs(G,{value:c.value.toString(),onValueChange:h=>c.onChange(parseInt(h)),children:[e.jsx(K,{children:e.jsx(W,{})}),e.jsxs(B,{children:[e.jsx(z,{value:"1",children:s("columns.status_text.banned")}),e.jsx(z,{value:"0",children:s("columns.status_text.normal")})]})]})})]})}),e.jsx(g,{control:o.control,name:"commission_type",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_type")}),e.jsx(y,{children:e.jsxs(G,{value:c.value.toString(),onValueChange:h=>c.onChange(parseInt(h)),children:[e.jsx(K,{children:e.jsx(W,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(z,{value:"0",children:s("edit.form.commission_type_system")}),e.jsx(z,{value:"1",children:s("edit.form.commission_type_cycle")}),e.jsx(z,{value:"2",children:s("edit.form.commission_type_onetime")})]})]})})]})}),e.jsx(g,{control:o.control,name:"commission_rate",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_rate")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:h=>c.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.commission_rate_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})})]})}),e.jsx(g,{control:o.control,name:"discount",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.discount")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:h=>c.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.discount_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"speed_limit",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.speed_limit")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:h=>c.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.speed_limit_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"Mbps"})]})}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"device_limit",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.device_limit")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:h=>c.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.device_limit_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"台"})]})}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"is_admin",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.is_admin")}),e.jsx("div",{className:"py-2",children:e.jsx(y,{children:e.jsx(Y,{checked:c.value===1,onCheckedChange:h=>c.onChange(h?1:0)})})})]})}),e.jsx(g,{control:o.control,name:"is_staff",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.is_staff")}),e.jsx("div",{className:"py-2",children:e.jsx(y,{children:e.jsx(Y,{checked:c.value===1,onCheckedChange:h=>c.onChange(h?1:0)})})})]})}),e.jsx(g,{control:o.control,name:"remarks",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.remarks")}),e.jsx(y,{children:e.jsx(ys,{className:"h-24",value:c.value||"",onChange:h=>c.onChange(h.currentTarget.value??null),placeholder:s("edit.form.remarks_placeholder")})}),e.jsx(D,{})]})}),e.jsxs(ol,{children:[e.jsx(P,{variant:"outline",onClick:()=>t(!1),children:s("edit.form.cancel")}),e.jsx(P,{type:"submit",onClick:()=>{o.handleSubmit(c=>{md(c).then(({data:h})=>{h&&(A.success(s("edit.form.success")),t(!1),a())})})()},children:s("edit.form.submit")})]})]})]})})}function $h(){const[s]=fr(),[n,t]=u.useState({}),[r,a]=u.useState({is_admin:!1,is_staff:!1}),[i,l]=u.useState([]),[d,m]=u.useState([]),[o,c]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const v=s.get("email");v&&l(M=>M.some(se=>se.id==="email")?M:[...M,{id:"email",value:v}])},[s]);const{refetch:h,data:_,isLoading:E}=re({queryKey:["userList",o,i,d],queryFn:()=>ud({pageSize:o.pageSize,current:o.pageIndex+1,filter:i,sort:d})}),[C,S]=u.useState([]),[w,b]=u.useState([]);u.useEffect(()=>{bt().then(({data:v})=>{S(v)}),qs().then(({data:v})=>{b(v)})},[]);const k=C.map(v=>({label:v.name,value:v.id})),p=w.map(v=>({label:v.name,value:v.id}));return e.jsxs(xl,{refreshData:h,children:[e.jsx(Uh,{data:_?.data??[],rowCount:_?.total??0,sorting:d,setSorting:m,columnVisibility:r,setColumnVisibility:a,rowSelection:n,setRowSelection:t,columnFilters:i,setColumnFilters:l,pagination:o,setPagination:c,refetch:h,serverGroupList:C,permissionGroups:k,subscriptionPlans:p}),e.jsx(hl,{})]})}function Uh({data:s,rowCount:n,sorting:t,setSorting:r,columnVisibility:a,setColumnVisibility:i,rowSelection:l,setRowSelection:d,columnFilters:m,setColumnFilters:o,pagination:c,setPagination:h,refetch:_,serverGroupList:E,permissionGroups:C,subscriptionPlans:S}){const{setIsOpen:w,setEditingUser:b}=qa(),k=ns({data:s,columns:zh(_,E,b,w),state:{sorting:t,columnVisibility:a,rowSelection:l,columnFilters:m,pagination:c},rowCount:n,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:d,onSortingChange:r,onColumnFiltersChange:o,onColumnVisibilityChange:i,getCoreRowModel:rs(),getFilteredRowModel:ds(),getPaginationRowModel:us(),onPaginationChange:h,getSortedRowModel:ms(),getFacetedRowModel:Ds(),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.jsxs("div",{className:"space-y-4",children:[e.jsx(kh,{table:k,refetch:_,serverGroupList:E,permissionGroups:C,subscriptionPlans:S}),e.jsx(hs,{table:k})]})}function Hh(){const{t:s}=V("user");return e.jsxs(Ee,{children:[e.jsxs(Re,{children:[e.jsx(Ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ae,{}),e.jsx($e,{})]})]}),e.jsxs(Fe,{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($h,{})})})]})]})}const qh=Object.freeze(Object.defineProperty({__proto__:null,default:Hh},Symbol.toStringTag,{value:"Module"}));function Kh({column:s,title:n,options:t}){const r=new Set(s?.getFilterValue());return e.jsxs(vs,{children:[e.jsx(bs,{asChild:!0,children:e.jsxs(J,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Qo,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(q,{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(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):t.filter(a=>r.has(a.value)).map(a=>e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:a.label},`selected-${a.value}`))})]})]})}),e.jsx(xs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Ms,{children:[e.jsx(Ks,{placeholder:n}),e.jsxs(Fs,{children:[e.jsx(Bs,{children:"No results found."}),e.jsx(Ye,{children:t.map(a=>{const i=r.has(a.value);return e.jsxs(Me,{onSelect:()=>{i?r.delete(a.value):r.add(a.value);const l=Array.from(r);s?.setFilterValue(l.length?l: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(Jo,{className:N("h-4 w-4")})}),a.icon&&e.jsx(a.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:a.label})]},`option-${a.value}`)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(rt,{}),e.jsx(Ye,{children:e.jsx(Me,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Bh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function Gh({table:s}){const{t:n}=V("ticket");return e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-4",children:[e.jsx(Gt,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(vt,{className:"grid w-full grid-cols-2",children:[e.jsx(Ge,{value:"0",children:n("status.pending")}),e.jsx(Ge,{value:"1",children:n("status.closed")})]})}),s.getColumn("level")&&e.jsx(Kh,{column:s.getColumn("level"),title:n("columns.level"),options:[{label:n("level.low"),value:Oe.LOW,icon:Bh,color:"gray"},{label:n("level.medium"),value:Oe.MIDDLE,icon:cl,color:"yellow"},{label:n("level.high"),value:Oe.HIGH,icon:dl,color:"red"}]})]})})}function Wh(){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=As("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"}}),pl=u.forwardRef(({className:s,variant:n,layout:t,children:r,...a},i)=>e.jsx("div",{className:N(Yh({variant:n,layout:t,className:s}),"relative group"),ref:i,...a,children:u.Children.map(r,l=>u.isValidElement(l)&&typeof l.type!="string"?u.cloneElement(l,{variant:n,layout:t}):l)}));pl.displayName="ChatBubble";const Qh=As("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-r-lg rounded-tl-lg",sent:"bg-primary text-primary-foreground rounded-l-lg rounded-tr-lg"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),fl=u.forwardRef(({className:s,variant:n,layout:t,isLoading:r=!1,children:a,...i},l)=>e.jsx("div",{className:N(Qh({variant:n,layout:t,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:l,...i,children:r?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(Wh,{})}):a}));fl.displayName="ChatBubbleMessage";const Jh=u.forwardRef(({variant:s,className:n,children:t,...r},a)=>e.jsx("div",{ref:a,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),...r,children:t}));Jh.displayName="ChatBubbleActionWrapper";const gl=u.forwardRef(({className:s,...n},t)=>e.jsx(ys,{autoComplete:"off",ref:t,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}));gl.displayName="ChatInput";const jl=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"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"})}),vl=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"})}),pn=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m11.29 12l3.54-3.54a1 1 0 0 0 0-1.41a1 1 0 0 0-1.42 0l-4.24 4.24a1 1 0 0 0 0 1.42L13.41 17a1 1 0 0 0 .71.29a1 1 0 0 0 .71-.29a1 1 0 0 0 0-1.41Z"})}),Xh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.71 20.29L18 16.61A9 9 0 1 0 16.61 18l3.68 3.68a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.39M11 18a7 7 0 1 1 7-7a7 7 0 0 1-7 7"})}),Zh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M3.71 16.29a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21a1 1 0 0 0-.21.33a1 1 0 0 0 .21 1.09a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1 1 0 0 0 .21-1.09a1 1 0 0 0-.21-.33M7 8h14a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m-3.29 3.29a1 1 0 0 0-1.09-.21a1.2 1.2 0 0 0-.33.21a1 1 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1 1 0 0 0-.21-.33M21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2M3.71 6.29a1 1 0 0 0-.33-.21a1 1 0 0 0-1.09.21a1.2 1.2 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a1 1 0 0 0 1.09-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1.2 1.2 0 0 0-.21-.33M21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})}),ep=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 sp(){return e.jsxs("div",{className:"flex h-full flex-col space-y-4 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{className:"h-8 w-3/4"}),e.jsx(oe,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(oe,{className:"h-20 w-2/3"},s))})]})}function tp(){return e.jsx("div",{className:"space-y-4 p-4",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{className:"h-5 w-4/5"}),e.jsx(oe,{className:"h-4 w-2/3"}),e.jsx(oe,{className:"h-3 w-1/2"})]},s))})}function ap({ticket:s,isActive:n,onClick:t}){const{t:r}=V("ticket"),a=i=>{switch(i){case Oe.HIGH:return"bg-red-50 text-red-600 border-red-200";case Oe.MIDDLE:return"bg-yellow-50 text-yellow-600 border-yellow-200";case Oe.LOW:return"bg-green-50 text-green-600 border-green-200";default:return"bg-gray-50 text-gray-600 border-gray-200"}};return e.jsxs("div",{className:N("flex cursor-pointer flex-col border-b p-4 hover:bg-accent/50",n&&"bg-accent"),onClick:t,children:[e.jsxs("div",{className:"flex max-w-[280px] items-center justify-between gap-2",children:[e.jsx("h4",{className:"flex-1 truncate font-medium",children:s.subject}),e.jsx(q,{variant:s.status===Vs.CLOSED?"secondary":"default",className:"shrink-0",children:s.status===Vs.CLOSED?r("status.closed"):r("status.processing")})]}),e.jsx("div",{className:"mt-1 max-w-[280px] truncate text-sm text-muted-foreground",children:s.user?.email}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[e.jsx("time",{className:"text-muted-foreground",children:we(s.updated_at)}),e.jsx("div",{className:N("rounded-full border px-2 py-0.5 text-xs font-medium",a(s.level)),children:r(`level.${s.level===Oe.LOW?"low":s.level===Oe.MIDDLE?"medium":"high"}`)})]})]})}function np({ticketId:s,dialogTrigger:n}){const{t}=V("ticket"),r=Ts(),a=u.useRef(null),i=u.useRef(null),[l,d]=u.useState(!1),[m,o]=u.useState(""),[c,h]=u.useState(!1),[_,E]=u.useState(s),[C,S]=u.useState(""),[w,b]=u.useState(!1),{setIsOpen:k,setEditingUser:p}=qa(),{data:v,isLoading:M,refetch:H}=re({queryKey:["tickets",l],queryFn:()=>l?la.getList({filter:[{id:"status",value:[Vs.OPENING]}]}):Promise.resolve(null),enabled:l}),{data:se,refetch:L,isLoading:Z}=re({queryKey:["ticket",_,l],queryFn:()=>l?gd(_):Promise.resolve(null),refetchInterval:l?5e3:!1,retry:3}),de=se?.data,te=(v?.data||[]).filter(le=>le.subject.toLowerCase().includes(C.toLowerCase())||le.user?.email.toLowerCase().includes(C.toLowerCase())),$=(le="smooth")=>{if(a.current){const{scrollHeight:Os,clientHeight:Ws}=a.current;a.current.scrollTo({top:Os-Ws,behavior:le})}};u.useEffect(()=>{if(!l)return;const le=requestAnimationFrame(()=>{$("instant"),setTimeout(()=>$(),1e3)});return()=>{cancelAnimationFrame(le)}},[l,de?.messages]);const R=async()=>{const le=m.trim();!le||c||(h(!0),la.reply({id:_,message:le}).then(()=>{o(""),L(),$(),setTimeout(()=>{i.current?.focus()},0)}).finally(()=>{h(!1)}))},X=async()=>{la.close(_).then(()=>{A.success(t("actions.close_success")),L(),H()})},Ns=()=>{de?.user&&r("/finance/order?user_id="+de.user.id)},De=de?.status===Vs.CLOSED;return e.jsxs(be,{open:l,onOpenChange:d,children:[e.jsx(Je,{asChild:!0,children:n??e.jsx(J,{variant:"outline",children:t("actions.view_ticket")})}),e.jsxs(fe,{className:"flex h-[90vh] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(ye,{}),e.jsxs("div",{className:"flex h-full",children:[e.jsx(J,{variant:"ghost",size:"icon",className:"absolute left-2 top-2 z-50 md:hidden",onClick:()=>b(!w),children:e.jsx(pn,{className:N("h-4 w-4 transition-transform",!w&&"rotate-180")})}),e.jsxs("div",{className:N("absolute inset-y-0 left-0 z-40 flex flex-col border-r bg-background transition-transform duration-200 ease-in-out md:relative",w?"-translate-x-full":"translate-x-0","w-80 md:w-80 md:translate-x-0"),children:[e.jsxs("div",{className:"space-y-4 border-b p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold",children:t("list.title")}),e.jsx(J,{variant:"ghost",size:"icon",className:"hidden h-8 w-8 md:flex",onClick:()=>b(!w),children:e.jsx(pn,{className:N("h-4 w-4 transition-transform",!w&&"rotate-180")})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Xh,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"}),e.jsx(T,{placeholder:t("list.search_placeholder"),value:C,onChange:le=>S(le.target.value),className:"pl-8"})]})]}),e.jsx(zs,{className:"flex-1",children:e.jsx("div",{className:"w-full",children:M?e.jsx(tp,{}):te.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-4 text-muted-foreground",children:t(C?"list.no_search_results":"list.no_tickets")}):te.map(le=>e.jsx(ap,{ticket:le,isActive:le.id===_,onClick:()=>{E(le.id),window.innerWidth<768&&b(!0)}},le.id))})})]}),e.jsxs("div",{className:"relative flex flex-1 flex-col",children:[!w&&e.jsx("div",{className:"absolute inset-0 z-30 bg-black/20 md:hidden",onClick:()=>b(!0)}),Z?e.jsx(sp,{}):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:de?.subject}),e.jsx(q,{variant:De?"secondary":"default",children:t(De?"status.closed":"status.processing")}),!De&&e.jsx(Qe,{title:t("actions.close_confirm_title"),description:t("actions.close_confirm_description"),confirmText:t("actions.close_confirm_button"),variant:"destructive",onConfirm:X,children:e.jsxs(J,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(jl,{className:"h-4 w-4"}),t("actions.close_ticket")]})})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(gt,{className:"h-4 w-4"}),e.jsx("span",{children:de?.user?.email})]}),e.jsx(ke,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(vl,{className:"h-4 w-4"}),e.jsxs("span",{children:[t("detail.created_at")," ",we(de?.created_at)]})]}),e.jsx(ke,{orientation:"vertical",className:"h-4"}),e.jsx(q,{variant:"outline",children:de?.level!=null&&t(`level.${de.level===Oe.LOW?"low":de.level===Oe.MIDDLE?"medium":"high"}`)})]})]}),de?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.user_info"),onClick:()=>{p(de.user),k(!0)},children:e.jsx(gt,{className:"h-4 w-4"})}),e.jsx(ul,{user_id:de.user.id,dialogTrigger:e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.traffic_records"),children:e.jsx(Zh,{className:"h-4 w-4"})})}),e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.order_records"),onClick:Ns,children:e.jsx(ep,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:a,className:"h-full space-y-4 overflow-y-auto p-6",children:de?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t("detail.no_messages")}):de?.messages?.map(le=>e.jsx(pl,{variant:le.is_me?"sent":"received",className:le.is_me?"ml-auto":"mr-auto",children:e.jsx(fl,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:le.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:we(le.created_at)})})]})})},le.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(gl,{ref:i,disabled:De||c,placeholder:t(De?"detail.input.closed_placeholder":"detail.input.reply_placeholder"),className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:m,onChange:le=>o(le.target.value),onKeyDown:le=>{le.key==="Enter"&&!le.shiftKey&&(le.preventDefault(),R())}}),e.jsx(J,{disabled:De||c||!m.trim(),onClick:R,children:t(c?"detail.input.sending":"detail.input.send")})]})})]})]})]})]})]})}const rp=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"})}),lp=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"})}),ip=s=>{const{t:n}=V("ticket");return[{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.id")}),cell:({row:t})=>e.jsx(q,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.subject")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(rp,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:t.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.level")}),cell:({row:t})=>{const r=t.getValue("level"),a=r===Oe.LOW?"default":r===Oe.MIDDLE?"secondary":"destructive";return e.jsx(q,{variant:a,className:"whitespace-nowrap",children:n(`level.${r===Oe.LOW?"low":r===Oe.MIDDLE?"medium":"high"}`)})},filterFn:(t,r,a)=>a.includes(t.getValue(r))},{accessorKey:"status",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.status")}),cell:({row:t})=>{const r=t.getValue("status"),a=t.original.reply_status,i=r===Vs.CLOSED?n("status.closed"):n(a===0?"status.replied":"status.pending"),l=r===Vs.CLOSED?"default":a===0?"secondary":"destructive";return e.jsx(q,{variant:l,className:"whitespace-nowrap",children:i})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.updated_at")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(vl,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:we(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:we(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(O,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>{const r=t.original.status!==Vs.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(np,{ticketId:t.original.id,dialogTrigger:e.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.view_details"),children:e.jsx(lp,{className:"h-4 w-4"})})}),r&&e.jsx(Qe,{title:n("actions.close_confirm_title"),description:n("actions.close_confirm_description"),confirmText:n("actions.close_confirm_button"),variant:"destructive",onConfirm:async()=>{jd(t.original.id).then(()=>{A.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(jl,{className:"h-4 w-4"})})})]})}}]};function op(){const[s,n]=u.useState({}),[t,r]=u.useState({}),[a,i]=u.useState([{id:"status",value:"0"}]),[l,d]=u.useState([]),[m,o]=u.useState({pageIndex:0,pageSize:20}),{refetch:c,data:h}=re({queryKey:["orderList",m,a,l],queryFn:()=>fd({pageSize:m.pageSize,current:m.pageIndex+1,filter:a,sort:l})}),_=ns({data:h?.data??[],columns:ip(c),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:m},rowCount:h?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:i,onColumnVisibilityChange:r,getCoreRowModel:rs(),getFilteredRowModel:ds(),getPaginationRowModel:us(),onPaginationChange:o,getSortedRowModel:ms(),getFacetedRowModel:Ds(),getFacetedUniqueValues:Ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Gh,{table:_,refetch:c}),e.jsx(hs,{table:_,showPagination:!0})]})}function cp(){const{t:s}=V("ticket");return e.jsxs(xl,{refreshData:()=>{},children:[e.jsxs(Ee,{children:[e.jsxs(Re,{children:[e.jsx(Ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ae,{}),e.jsx($e,{})]})]}),e.jsxs(Fe,{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(op,{})})]})]}),e.jsx(hl,{})]})}const dp=Object.freeze(Object.defineProperty({__proto__:null,default:cp},Symbol.toStringTag,{value:"Module"}));export{pp as a,xp as c,hp as g,fp as r}; +`+a("columns.online_status.offline_duration.seconds",{count:m})}return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{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",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:i.original.email})]})}),e.jsx(ce,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:o})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.online_count")}),cell:({row:i})=>{const l=i.original.device_limit,d=i.original.online_count||0;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(q,{variant:"outline",className:N("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(ce,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.status")}),cell:({row:i})=>{const l=i.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(q,{className:N("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l))},{accessorKey:"plan_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.subscription")}),cell:({row:i})=>e.jsx("div",{className:"min-w-[10em] break-all",children:i.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.group")}),cell:({row:i})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(q,{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:i.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.used_traffic")}),cell:({row:i})=>{const l=ps(i.original?.total_used),d=ps(i.original?.transfer_enable),m=i.original?.total_used/i.original?.transfer_enable*100||0;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.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",m>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(m,100)}%`}})})]})}),e.jsx(ce,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.total_traffic")}),cell:({row:i})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ps(i.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.expire_time")}),cell:({row:i})=>{const l=i.original.expired_at,d=Date.now()/1e3,m=l!=null&&le.jsx(O,{column:i,title:a("columns.balance")}),cell:({row:i})=>{const l=Xs(i.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:l})]})}},{accessorKey:"commission_balance",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.commission")}),cell:({row:i})=>{const l=Xs(i.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:l})]})}},{accessorKey:"created_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.register_time")}),cell:({row:i})=>e.jsx("div",{className:"truncate",children:we(i.original?.created_at)}),size:1e3},{id:"actions",header:({column:i})=>e.jsx(O,{column:i,className:"justify-end",title:a("columns.actions")}),cell:({row:i,table:l})=>e.jsxs(Ss,{modal:!0,children:[e.jsx(ks,{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(Vt,{className:"size-4"})})})}),e.jsxs(fs,{align:"end",className:"min-w-[40px]",children:[e.jsx(je,{onSelect:d=>{d.preventDefault(),t(i.original),r(!0)},className:"p-0",children:e.jsxs(J,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Eh,{className:"mr-2"}),a("columns.actions_menu.edit")]})}),e.jsx(je,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(tl,{defaultValues:{email:i.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(je,{onSelect:()=>{Ft(i.original.subscribe_url).then(()=>{A.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(Ih,{className:"mr-2"}),a("columns.actions_menu.copy_url")]})}),e.jsx(je,{onSelect:()=>{xd({id:i.original.id}).then(({data:d})=>{d&&A.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Vh,{className:"mr-2 "}),a("columns.actions_menu.reset_secret")]})}),e.jsx(je,{onSelect:()=>{},className:"p-0",children:e.jsxs(Us,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=${i.original?.id}`,children:[e.jsx(Mh,{className:"mr-2"}),a("columns.actions_menu.orders")]})}),e.jsx(je,{onSelect:()=>{l.setColumnFilters([{id:"invite_user_id",value:"eq:"+i.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Fh,{className:"mr-2 "}),a("columns.actions_menu.invites")]})}),e.jsx(je,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(ul,{user_id:i.original?.id,dialogTrigger:e.jsxs(J,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Oh,{className:"mr-2 "}),a("columns.actions_menu.traffic_records")]})})}),e.jsx(je,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(Ph,{title:a("columns.actions_menu.delete_confirm_title"),description:a("columns.actions_menu.delete_confirm_description",{email:i.original.email}),cancelText:a("common:cancel"),confirmText:a("common:confirm"),variant:"destructive",onConfirm:async()=>{try{const{data:d}=await Ot.destroy(i.original.id);d&&(A.success(a("common:delete.success")),s())}catch{A.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(Lh,{className:"mr-2"}),a("columns.actions_menu.delete")]})})})]})]})}]},ml=u.createContext(void 0),qa=()=>{const s=u.useContext(ml);if(!s)throw new Error("useUserEdit must be used within an UserEditProvider");return s},xl=({children:s,refreshData:n})=>{const[t,r]=u.useState(!1),[a,i]=u.useState(null),l={isOpen:t,setIsOpen:r,editingUser:a,setEditingUser:i,refreshData:n};return e.jsx(ml.Provider,{value:l,children:s})},Ah=x.object({id:x.number(),email:x.string().email(),invite_user_email:x.string().email().nullable().optional(),password:x.string().optional().nullable(),balance:x.coerce.number(),commission_balance:x.coerce.number(),u:x.number(),d:x.number(),transfer_enable:x.number(),expired_at:x.number().nullable(),plan_id:x.number().nullable(),banned:x.number(),commission_type:x.number(),commission_rate:x.number().nullable(),discount:x.number().nullable(),speed_limit:x.number().nullable(),device_limit:x.number().nullable(),is_admin:x.number(),is_staff:x.number(),remarks:x.string().nullable()});function hl(){const{t:s}=V("user"),{isOpen:n,setIsOpen:t,editingUser:r,refreshData:a}=qa(),[i,l]=u.useState(!1),[d,m]=u.useState([]),o=ge({resolver:Ne(Ah),defaultValues:{id:0,email:"",invite_user_email:null,password:null,balance:0,commission_balance:0,u:0,d:0,transfer_enable:0,expired_at:null,plan_id:null,banned:0,commission_type:0,commission_rate:null,discount:null,speed_limit:null,device_limit:null,is_admin:0,is_staff:0,remarks:null}});return u.useEffect(()=>{n&&qs().then(({data:c})=>{m(c)})},[n]),u.useEffect(()=>{if(r){const c=r.invite_user?.email,{invite_user:h,..._}=r;o.reset({..._,invite_user_email:c||null,password:null})}},[r,o]),e.jsx(ll,{open:n,onOpenChange:t,children:e.jsxs(Aa,{className:"max-w-[90%] space-y-4",children:[e.jsxs($a,{children:[e.jsx(Ua,{children:s("edit.title")}),e.jsx(Ha,{})]}),e.jsxs(_e,{...o,children:[e.jsx(g,{control:o.control,name:"email",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.email")}),e.jsx(y,{children:e.jsx(T,{...c,placeholder:s("edit.form.email_placeholder")})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"invite_user_email",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.inviter_email")}),e.jsx(y,{children:e.jsx(T,{value:c.value||"",onChange:h=>c.onChange(h.target.value?h.target.value:null),placeholder:s("edit.form.inviter_email_placeholder")})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"password",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.password")}),e.jsx(y,{children:e.jsx(T,{type:"password",value:c.value||"",onChange:c.onChange,placeholder:s("edit.form.password_placeholder")})}),e.jsx(D,{...c})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(g,{control:o.control,name:"balance",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.balance")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:c.onChange,placeholder:s("edit.form.balance_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"commission_balance",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_balance")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:c.onChange,placeholder:s("edit.form.commission_balance_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"u",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.upload")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{value:c.value/1024/1024/1024||"",onChange:h=>c.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.upload_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(D,{...c})]})}),e.jsx(g,{control:o.control,name:"d",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.download")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value/1024/1024/1024||"",onChange:h=>c.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.download_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(D,{...c})]})})]}),e.jsx(g,{control:o.control,name:"transfer_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.total_traffic")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value/1024/1024/1024||"",onChange:h=>c.onChange(parseInt(h.target.value)*1024*1024*1024),placeholder:s("edit.form.total_traffic_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"expired_at",render:({field:c})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(j,{children:s("edit.form.expire_time")}),e.jsxs(vs,{open:i,onOpenChange:l,children:[e.jsx(bs,{asChild:!0,children:e.jsx(y,{children:e.jsxs(P,{type:"button",variant:"outline",className:N("w-full pl-3 text-left font-normal",!c.value&&"text-muted-foreground"),onClick:()=>l(!0),children:[c.value?we(c.value):e.jsx("span",{children:s("edit.form.expire_time_placeholder")}),e.jsx(jt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(xs,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:h=>{h.preventDefault()},onEscapeKeyDown:h=>{h.preventDefault()},children:e.jsxs("div",{className:"flex flex-col space-y-3 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{c.onChange(null),l(!1)},children:s("edit.form.expire_time_permanent")}),e.jsx(P,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const h=new Date;h.setMonth(h.getMonth()+1),h.setHours(23,59,59,999),c.onChange(Math.floor(h.getTime()/1e3)),l(!1)},children:s("edit.form.expire_time_1month")}),e.jsx(P,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const h=new Date;h.setMonth(h.getMonth()+3),h.setHours(23,59,59,999),c.onChange(Math.floor(h.getTime()/1e3)),l(!1)},children:s("edit.form.expire_time_3months")})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Gs,{mode:"single",selected:c.value?new Date(c.value*1e3):void 0,onSelect:h=>{if(h){const _=new Date(c.value?c.value*1e3:Date.now());h.setHours(_.getHours(),_.getMinutes(),_.getSeconds()),c.onChange(Math.floor(h.getTime()/1e3))}},disabled:h=>h{const h=new Date;h.setHours(23,59,59,999),c.onChange(Math.floor(h.getTime()/1e3))},className:"h-6 px-2 text-xs",children:s("edit.form.expire_time_today")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"datetime-local",step:"1",value:we(c.value,"YYYY-MM-DDTHH:mm:ss"),onChange:h=>{const _=new Date(h.target.value);isNaN(_.getTime())||c.onChange(Math.floor(_.getTime()/1e3))},className:"flex-1"}),e.jsx(P,{type:"button",variant:"outline",onClick:()=>l(!1),children:s("edit.form.expire_time_confirm")})]})]})]})})]}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"plan_id",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.subscription")}),e.jsx(y,{children:e.jsxs(G,{value:c.value!==null?String(c.value):"null",onValueChange:h=>c.onChange(h==="null"?null:parseInt(h)),children:[e.jsx(K,{children:e.jsx(W,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(z,{value:"null",children:s("edit.form.subscription_none")}),d.map(h=>e.jsx(z,{value:String(h.id),children:h.name},h.id))]})]})})]})}),e.jsx(g,{control:o.control,name:"banned",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.account_status")}),e.jsx(y,{children:e.jsxs(G,{value:c.value.toString(),onValueChange:h=>c.onChange(parseInt(h)),children:[e.jsx(K,{children:e.jsx(W,{})}),e.jsxs(B,{children:[e.jsx(z,{value:"1",children:s("columns.status_text.banned")}),e.jsx(z,{value:"0",children:s("columns.status_text.normal")})]})]})})]})}),e.jsx(g,{control:o.control,name:"commission_type",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_type")}),e.jsx(y,{children:e.jsxs(G,{value:c.value.toString(),onValueChange:h=>c.onChange(parseInt(h)),children:[e.jsx(K,{children:e.jsx(W,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(B,{children:[e.jsx(z,{value:"0",children:s("edit.form.commission_type_system")}),e.jsx(z,{value:"1",children:s("edit.form.commission_type_cycle")}),e.jsx(z,{value:"2",children:s("edit.form.commission_type_onetime")})]})]})})]})}),e.jsx(g,{control:o.control,name:"commission_rate",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.commission_rate")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:h=>c.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.commission_rate_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})})]})}),e.jsx(g,{control:o.control,name:"discount",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.discount")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:h=>c.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.discount_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"speed_limit",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.speed_limit")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:h=>c.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.speed_limit_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"Mbps"})]})}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"device_limit",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.device_limit")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(T,{type:"number",value:c.value||"",onChange:h=>c.onChange(parseInt(h.currentTarget.value)||null),placeholder:s("edit.form.device_limit_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"台"})]})}),e.jsx(D,{})]})}),e.jsx(g,{control:o.control,name:"is_admin",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.is_admin")}),e.jsx("div",{className:"py-2",children:e.jsx(y,{children:e.jsx(Y,{checked:c.value===1,onCheckedChange:h=>c.onChange(h?1:0)})})})]})}),e.jsx(g,{control:o.control,name:"is_staff",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.is_staff")}),e.jsx("div",{className:"py-2",children:e.jsx(y,{children:e.jsx(Y,{checked:c.value===1,onCheckedChange:h=>c.onChange(h?1:0)})})})]})}),e.jsx(g,{control:o.control,name:"remarks",render:({field:c})=>e.jsxs(f,{children:[e.jsx(j,{children:s("edit.form.remarks")}),e.jsx(y,{children:e.jsx(ys,{className:"h-24",value:c.value||"",onChange:h=>c.onChange(h.currentTarget.value??null),placeholder:s("edit.form.remarks_placeholder")})}),e.jsx(D,{})]})}),e.jsxs(ol,{children:[e.jsx(P,{variant:"outline",onClick:()=>t(!1),children:s("edit.form.cancel")}),e.jsx(P,{type:"submit",onClick:()=>{o.handleSubmit(c=>{md(c).then(({data:h})=>{h&&(A.success(s("edit.form.success")),t(!1),a())})})()},children:s("edit.form.submit")})]})]})]})})}function $h(){const[s]=fr(),[n,t]=u.useState({}),[r,a]=u.useState({is_admin:!1,is_staff:!1}),[i,l]=u.useState([]),[d,m]=u.useState([]),[o,c]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const v=s.get("email");v&&l(M=>M.some(se=>se.id==="email")?M:[...M,{id:"email",value:v}])},[s]);const{refetch:h,data:_,isLoading:E}=re({queryKey:["userList",o,i,d],queryFn:()=>ud({pageSize:o.pageSize,current:o.pageIndex+1,filter:i,sort:d})}),[C,S]=u.useState([]),[w,b]=u.useState([]);u.useEffect(()=>{bt().then(({data:v})=>{S(v)}),qs().then(({data:v})=>{b(v)})},[]);const k=C.map(v=>({label:v.name,value:v.id})),p=w.map(v=>({label:v.name,value:v.id}));return e.jsxs(xl,{refreshData:h,children:[e.jsx(Uh,{data:_?.data??[],rowCount:_?.total??0,sorting:d,setSorting:m,columnVisibility:r,setColumnVisibility:a,rowSelection:n,setRowSelection:t,columnFilters:i,setColumnFilters:l,pagination:o,setPagination:c,refetch:h,serverGroupList:C,permissionGroups:k,subscriptionPlans:p}),e.jsx(hl,{})]})}function Uh({data:s,rowCount:n,sorting:t,setSorting:r,columnVisibility:a,setColumnVisibility:i,rowSelection:l,setRowSelection:d,columnFilters:m,setColumnFilters:o,pagination:c,setPagination:h,refetch:_,serverGroupList:E,permissionGroups:C,subscriptionPlans:S}){const{setIsOpen:w,setEditingUser:b}=qa(),k=ns({data:s,columns:zh(_,E,b,w),state:{sorting:t,columnVisibility:a,rowSelection:l,columnFilters:m,pagination:c},rowCount:n,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:d,onSortingChange:r,onColumnFiltersChange:o,onColumnVisibilityChange:i,getCoreRowModel:rs(),getFilteredRowModel:ds(),getPaginationRowModel:us(),onPaginationChange:h,getSortedRowModel:ms(),getFacetedRowModel:Ds(),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.jsxs("div",{className:"space-y-4",children:[e.jsx(kh,{table:k,refetch:_,serverGroupList:E,permissionGroups:C,subscriptionPlans:S}),e.jsx(hs,{table:k})]})}function Hh(){const{t:s}=V("user");return e.jsxs(Ee,{children:[e.jsxs(Re,{children:[e.jsx(Ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ae,{}),e.jsx($e,{})]})]}),e.jsxs(Fe,{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($h,{})})})]})]})}const qh=Object.freeze(Object.defineProperty({__proto__:null,default:Hh},Symbol.toStringTag,{value:"Module"}));function Kh({column:s,title:n,options:t}){const r=new Set(s?.getFilterValue());return e.jsxs(vs,{children:[e.jsx(bs,{asChild:!0,children:e.jsxs(J,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Qo,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(q,{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(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):t.filter(a=>r.has(a.value)).map(a=>e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:a.label},`selected-${a.value}`))})]})]})}),e.jsx(xs,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Ms,{children:[e.jsx(Ks,{placeholder:n}),e.jsxs(Fs,{children:[e.jsx(Bs,{children:"No results found."}),e.jsx(Ye,{children:t.map(a=>{const i=r.has(a.value);return e.jsxs(Me,{onSelect:()=>{i?r.delete(a.value):r.add(a.value);const l=Array.from(r);s?.setFilterValue(l.length?l: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(Jo,{className:N("h-4 w-4")})}),a.icon&&e.jsx(a.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:a.label})]},`option-${a.value}`)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(rt,{}),e.jsx(Ye,{children:e.jsx(Me,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Bh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function Gh({table:s}){const{t:n}=V("ticket");return e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-4",children:[e.jsx(Gt,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(vt,{className:"grid w-full grid-cols-2",children:[e.jsx(Ge,{value:"0",children:n("status.pending")}),e.jsx(Ge,{value:"1",children:n("status.closed")})]})}),s.getColumn("level")&&e.jsx(Kh,{column:s.getColumn("level"),title:n("columns.level"),options:[{label:n("level.low"),value:Oe.LOW,icon:Bh,color:"gray"},{label:n("level.medium"),value:Oe.MIDDLE,icon:cl,color:"yellow"},{label:n("level.high"),value:Oe.HIGH,icon:dl,color:"red"}]})]})})}function Wh(){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=As("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"}}),pl=u.forwardRef(({className:s,variant:n,layout:t,children:r,...a},i)=>e.jsx("div",{className:N(Yh({variant:n,layout:t,className:s}),"relative group"),ref:i,...a,children:u.Children.map(r,l=>u.isValidElement(l)&&typeof l.type!="string"?u.cloneElement(l,{variant:n,layout:t}):l)}));pl.displayName="ChatBubble";const Qh=As("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-r-lg rounded-tl-lg",sent:"bg-primary text-primary-foreground rounded-l-lg rounded-tr-lg"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),fl=u.forwardRef(({className:s,variant:n,layout:t,isLoading:r=!1,children:a,...i},l)=>e.jsx("div",{className:N(Qh({variant:n,layout:t,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:l,...i,children:r?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(Wh,{})}):a}));fl.displayName="ChatBubbleMessage";const Jh=u.forwardRef(({variant:s,className:n,children:t,...r},a)=>e.jsx("div",{ref:a,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),...r,children:t}));Jh.displayName="ChatBubbleActionWrapper";const gl=u.forwardRef(({className:s,...n},t)=>e.jsx(ys,{autoComplete:"off",ref:t,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}));gl.displayName="ChatInput";const jl=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"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"})}),vl=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"})}),pn=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m11.29 12l3.54-3.54a1 1 0 0 0 0-1.41a1 1 0 0 0-1.42 0l-4.24 4.24a1 1 0 0 0 0 1.42L13.41 17a1 1 0 0 0 .71.29a1 1 0 0 0 .71-.29a1 1 0 0 0 0-1.41Z"})}),Xh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.71 20.29L18 16.61A9 9 0 1 0 16.61 18l3.68 3.68a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.39M11 18a7 7 0 1 1 7-7a7 7 0 0 1-7 7"})}),Zh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M3.71 16.29a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21a1 1 0 0 0-.21.33a1 1 0 0 0 .21 1.09a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1 1 0 0 0 .21-1.09a1 1 0 0 0-.21-.33M7 8h14a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m-3.29 3.29a1 1 0 0 0-1.09-.21a1.2 1.2 0 0 0-.33.21a1 1 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1 1 0 0 0-.21-.33M21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2M3.71 6.29a1 1 0 0 0-.33-.21a1 1 0 0 0-1.09.21a1.2 1.2 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a1 1 0 0 0 1.09-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1.2 1.2 0 0 0-.21-.33M21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})}),ep=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 sp(){return e.jsxs("div",{className:"flex h-full flex-col space-y-4 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{className:"h-8 w-3/4"}),e.jsx(oe,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(oe,{className:"h-20 w-2/3"},s))})]})}function tp(){return e.jsx("div",{className:"space-y-4 p-4",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{className:"h-5 w-4/5"}),e.jsx(oe,{className:"h-4 w-2/3"}),e.jsx(oe,{className:"h-3 w-1/2"})]},s))})}function ap({ticket:s,isActive:n,onClick:t}){const{t:r}=V("ticket"),a=i=>{switch(i){case Oe.HIGH:return"bg-red-50 text-red-600 border-red-200";case Oe.MIDDLE:return"bg-yellow-50 text-yellow-600 border-yellow-200";case Oe.LOW:return"bg-green-50 text-green-600 border-green-200";default:return"bg-gray-50 text-gray-600 border-gray-200"}};return e.jsxs("div",{className:N("flex cursor-pointer flex-col border-b p-4 hover:bg-accent/50",n&&"bg-accent"),onClick:t,children:[e.jsxs("div",{className:"flex max-w-[280px] items-center justify-between gap-2",children:[e.jsx("h4",{className:"flex-1 truncate font-medium",children:s.subject}),e.jsx(q,{variant:s.status===Vs.CLOSED?"secondary":"default",className:"shrink-0",children:s.status===Vs.CLOSED?r("status.closed"):r("status.processing")})]}),e.jsx("div",{className:"mt-1 max-w-[280px] truncate text-sm text-muted-foreground",children:s.user?.email}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[e.jsx("time",{className:"text-muted-foreground",children:we(s.updated_at)}),e.jsx("div",{className:N("rounded-full border px-2 py-0.5 text-xs font-medium",a(s.level)),children:r(`level.${s.level===Oe.LOW?"low":s.level===Oe.MIDDLE?"medium":"high"}`)})]})]})}function np({ticketId:s,dialogTrigger:n}){const{t}=V("ticket"),r=Ts(),a=u.useRef(null),i=u.useRef(null),[l,d]=u.useState(!1),[m,o]=u.useState(""),[c,h]=u.useState(!1),[_,E]=u.useState(s),[C,S]=u.useState(""),[w,b]=u.useState(!1),{setIsOpen:k,setEditingUser:p}=qa(),{data:v,isLoading:M,refetch:H}=re({queryKey:["tickets",l],queryFn:()=>l?la.getList({filter:[{id:"status",value:[Vs.OPENING]}]}):Promise.resolve(null),enabled:l}),{data:se,refetch:L,isLoading:Z}=re({queryKey:["ticket",_,l],queryFn:()=>l?gd(_):Promise.resolve(null),refetchInterval:l?5e3:!1,retry:3}),de=se?.data,te=(v?.data||[]).filter(le=>le.subject.toLowerCase().includes(C.toLowerCase())||le.user?.email.toLowerCase().includes(C.toLowerCase())),$=(le="smooth")=>{if(a.current){const{scrollHeight:Os,clientHeight:Ws}=a.current;a.current.scrollTo({top:Os-Ws,behavior:le})}};u.useEffect(()=>{if(!l)return;const le=requestAnimationFrame(()=>{$("instant"),setTimeout(()=>$(),1e3)});return()=>{cancelAnimationFrame(le)}},[l,de?.messages]);const R=async()=>{const le=m.trim();!le||c||(h(!0),la.reply({id:_,message:le}).then(()=>{o(""),L(),$(),setTimeout(()=>{i.current?.focus()},0)}).finally(()=>{h(!1)}))},X=async()=>{la.close(_).then(()=>{A.success(t("actions.close_success")),L(),H()})},Ns=()=>{de?.user&&r("/finance/order?user_id="+de.user.id)},De=de?.status===Vs.CLOSED;return e.jsxs(be,{open:l,onOpenChange:d,children:[e.jsx(Je,{asChild:!0,children:n??e.jsx(J,{variant:"outline",children:t("actions.view_ticket")})}),e.jsxs(fe,{className:"flex h-[90vh] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(ye,{}),e.jsxs("div",{className:"flex h-full",children:[e.jsx(J,{variant:"ghost",size:"icon",className:"absolute left-2 top-2 z-50 md:hidden",onClick:()=>b(!w),children:e.jsx(pn,{className:N("h-4 w-4 transition-transform",!w&&"rotate-180")})}),e.jsxs("div",{className:N("absolute inset-y-0 left-0 z-40 flex flex-col border-r bg-background transition-transform duration-200 ease-in-out md:relative",w?"-translate-x-full":"translate-x-0","w-80 md:w-80 md:translate-x-0"),children:[e.jsxs("div",{className:"space-y-4 border-b p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold",children:t("list.title")}),e.jsx(J,{variant:"ghost",size:"icon",className:"hidden h-8 w-8 md:flex",onClick:()=>b(!w),children:e.jsx(pn,{className:N("h-4 w-4 transition-transform",!w&&"rotate-180")})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Xh,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"}),e.jsx(T,{placeholder:t("list.search_placeholder"),value:C,onChange:le=>S(le.target.value),className:"pl-8"})]})]}),e.jsx(zs,{className:"flex-1",children:e.jsx("div",{className:"w-full",children:M?e.jsx(tp,{}):te.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-4 text-muted-foreground",children:t(C?"list.no_search_results":"list.no_tickets")}):te.map(le=>e.jsx(ap,{ticket:le,isActive:le.id===_,onClick:()=>{E(le.id),window.innerWidth<768&&b(!0)}},le.id))})})]}),e.jsxs("div",{className:"relative flex flex-1 flex-col",children:[!w&&e.jsx("div",{className:"absolute inset-0 z-30 bg-black/20 md:hidden",onClick:()=>b(!0)}),Z?e.jsx(sp,{}):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:de?.subject}),e.jsx(q,{variant:De?"secondary":"default",children:t(De?"status.closed":"status.processing")}),!De&&e.jsx(Qe,{title:t("actions.close_confirm_title"),description:t("actions.close_confirm_description"),confirmText:t("actions.close_confirm_button"),variant:"destructive",onConfirm:X,children:e.jsxs(J,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(jl,{className:"h-4 w-4"}),t("actions.close_ticket")]})})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(gt,{className:"h-4 w-4"}),e.jsx("span",{children:de?.user?.email})]}),e.jsx(ke,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(vl,{className:"h-4 w-4"}),e.jsxs("span",{children:[t("detail.created_at")," ",we(de?.created_at)]})]}),e.jsx(ke,{orientation:"vertical",className:"h-4"}),e.jsx(q,{variant:"outline",children:de?.level!=null&&t(`level.${de.level===Oe.LOW?"low":de.level===Oe.MIDDLE?"medium":"high"}`)})]})]}),de?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.user_info"),onClick:()=>{p(de.user),k(!0)},children:e.jsx(gt,{className:"h-4 w-4"})}),e.jsx(ul,{user_id:de.user.id,dialogTrigger:e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.traffic_records"),children:e.jsx(Zh,{className:"h-4 w-4"})})}),e.jsx(J,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.order_records"),onClick:Ns,children:e.jsx(ep,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:a,className:"h-full space-y-4 overflow-y-auto p-6",children:de?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t("detail.no_messages")}):de?.messages?.map(le=>e.jsx(pl,{variant:le.is_from_admin?"sent":"received",className:le.is_from_admin?"ml-auto":"mr-auto",children:e.jsx(fl,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:le.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:we(le.created_at)})})]})})},le.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(gl,{ref:i,disabled:De||c,placeholder:t(De?"detail.input.closed_placeholder":"detail.input.reply_placeholder"),className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:m,onChange:le=>o(le.target.value),onKeyDown:le=>{le.key==="Enter"&&!le.shiftKey&&(le.preventDefault(),R())}}),e.jsx(J,{disabled:De||c||!m.trim(),onClick:R,children:t(c?"detail.input.sending":"detail.input.send")})]})})]})]})]})]})]})}const rp=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"})}),lp=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"})}),ip=s=>{const{t:n}=V("ticket");return[{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.id")}),cell:({row:t})=>e.jsx(q,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.subject")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(rp,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:t.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.level")}),cell:({row:t})=>{const r=t.getValue("level"),a=r===Oe.LOW?"default":r===Oe.MIDDLE?"secondary":"destructive";return e.jsx(q,{variant:a,className:"whitespace-nowrap",children:n(`level.${r===Oe.LOW?"low":r===Oe.MIDDLE?"medium":"high"}`)})},filterFn:(t,r,a)=>a.includes(t.getValue(r))},{accessorKey:"status",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.status")}),cell:({row:t})=>{const r=t.getValue("status"),a=t.original.reply_status,i=r===Vs.CLOSED?n("status.closed"):n(a===0?"status.replied":"status.pending"),l=r===Vs.CLOSED?"default":a===0?"secondary":"destructive";return e.jsx(q,{variant:l,className:"whitespace-nowrap",children:i})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.updated_at")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(vl,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:we(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:we(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(O,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>{const r=t.original.status!==Vs.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(np,{ticketId:t.original.id,dialogTrigger:e.jsx(J,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.view_details"),children:e.jsx(lp,{className:"h-4 w-4"})})}),r&&e.jsx(Qe,{title:n("actions.close_confirm_title"),description:n("actions.close_confirm_description"),confirmText:n("actions.close_confirm_button"),variant:"destructive",onConfirm:async()=>{jd(t.original.id).then(()=>{A.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(jl,{className:"h-4 w-4"})})})]})}}]};function op(){const[s,n]=u.useState({}),[t,r]=u.useState({}),[a,i]=u.useState([{id:"status",value:"0"}]),[l,d]=u.useState([]),[m,o]=u.useState({pageIndex:0,pageSize:20}),{refetch:c,data:h}=re({queryKey:["orderList",m,a,l],queryFn:()=>fd({pageSize:m.pageSize,current:m.pageIndex+1,filter:a,sort:l})}),_=ns({data:h?.data??[],columns:ip(c),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:m},rowCount:h?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:i,onColumnVisibilityChange:r,getCoreRowModel:rs(),getFilteredRowModel:ds(),getPaginationRowModel:us(),onPaginationChange:o,getSortedRowModel:ms(),getFacetedRowModel:Ds(),getFacetedUniqueValues:Ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Gh,{table:_,refetch:c}),e.jsx(hs,{table:_,showPagination:!0})]})}function cp(){const{t:s}=V("ticket");return e.jsxs(xl,{refreshData:()=>{},children:[e.jsxs(Ee,{children:[e.jsxs(Re,{children:[e.jsx(Ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Ae,{}),e.jsx($e,{})]})]}),e.jsxs(Fe,{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(op,{})})]})]}),e.jsx(hl,{})]})}const dp=Object.freeze(Object.defineProperty({__proto__:null,default:cp},Symbol.toStringTag,{value:"Module"}));export{pp as a,xp as c,hp as g,fp as r}; diff --git a/public/assets/admin/locales/en-US.js b/public/assets/admin/locales/en-US.js index ab251bd..7a2fd91 100644 --- a/public/assets/admin/locales/en-US.js +++ b/public/assets/admin/locales/en-US.js @@ -1772,6 +1772,83 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "empty": "No ALPN Protocols Available" } } + }, + "socks": { + "version": { + "label": "Protocol Version", + "placeholder": "Select SOCKS Version" + }, + "tls": { + "label": "TLS", + "placeholder": "Please select security", + "disabled": "Disabled", + "enabled": "Enabled" + }, + "tls_settings": { + "server_name": { + "label": "Server Name Indication (SNI)", + "placeholder": "Leave empty if not used" + }, + "allow_insecure": "Allow Insecure?" + }, + "network": { + "label": "Transport Protocol", + "placeholder": "Select transport protocol" + } + }, + "naive": { + "tls_settings": { + "server_name": { + "label": "Server Name Indication (SNI)", + "placeholder": "Used for certificate verification when domain differs from node address" + }, + "allow_insecure": "Allow Insecure" + }, + "tls": { + "label": "TLS", + "placeholder": "Please select security", + "disabled": "Disabled", + "enabled": "Enabled", + "server_name": { + "label": "Server Name Indication (SNI)", + "placeholder": "Used for certificate verification when domain differs from node address" + }, + "allow_insecure": "Allow Insecure" + } + }, + "http": { + "tls_settings": { + "server_name": { + "label": "Server Name Indication (SNI)", + "placeholder": "Used for certificate verification when domain differs from node address" + }, + "allow_insecure": "Allow Insecure" + }, + "tls": { + "label": "TLS", + "placeholder": "Please select security", + "disabled": "Disabled", + "enabled": "Enabled", + "server_name": { + "label": "Server Name Indication (SNI)", + "placeholder": "Used for certificate verification when domain differs from node address" + }, + "allow_insecure": "Allow Insecure" + } + }, + "mieru": { + "transport": { + "label": "Transport Protocol", + "placeholder": "Select transport protocol" + }, + "multiplexing": { + "label": "Multiplexing", + "placeholder": "Select multiplexing level", + "MULTIPLEXING_OFF": "Disabled", + "MULTIPLEXING_LOW": "Low", + "MULTIPLEXING_MIDDLE": "Medium", + "MULTIPLEXING_HIGH": "High" + } } }, "network_settings": { diff --git a/public/assets/admin/locales/ko-KR.js b/public/assets/admin/locales/ko-KR.js index 157368e..d9bb23a 100644 --- a/public/assets/admin/locales/ko-KR.js +++ b/public/assets/admin/locales/ko-KR.js @@ -1740,6 +1740,83 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "empty": "사용 가능한 ALPN 프로토콜이 없습니다" } } + }, + "socks": { + "version": { + "label": "프로토콜 버전", + "placeholder": "SOCKS 버전 선택" + }, + "tls": { + "label": "TLS", + "placeholder": "보안을 선택해주세요", + "disabled": "비활성화", + "enabled": "활성화" + }, + "tls_settings": { + "server_name": { + "label": "서버 이름 표시(SNI)", + "placeholder": "사용하지 않는 경우 비워두세요" + }, + "allow_insecure": "안전하지 않은 연결 허용?" + }, + "network": { + "label": "전송 프로토콜", + "placeholder": "전송 프로토콜 선택" + } + }, + "naive": { + "tls_settings": { + "server_name": { + "label": "서버 이름 표시(SNI)", + "placeholder": "사용하지 않는 경우 비워두세요" + }, + "allow_insecure": "안전하지 않은 연결 허용?" + }, + "tls": { + "label": "TLS", + "placeholder": "보안을 선택해주세요", + "disabled": "비활성화", + "enabled": "활성화", + "server_name": { + "label": "서버 이름 표시(SNI)", + "placeholder": "노드 주소와 인증서가 다를 때 인증서 확인에 사용" + }, + "allow_insecure": "안전하지 않은 연결 허용" + } + }, + "http": { + "tls_settings": { + "server_name": { + "label": "서버 이름 표시(SNI)", + "placeholder": "사용하지 않는 경우 비워두세요" + }, + "allow_insecure": "안전하지 않은 연결 허용?" + }, + "tls": { + "label": "TLS", + "placeholder": "보안을 선택해주세요", + "disabled": "비활성화", + "enabled": "활성화", + "server_name": { + "label": "서버 이름 표시(SNI)", + "placeholder": "노드 주소와 인증서가 다를 때 인증서 확인에 사용" + }, + "allow_insecure": "안전하지 않은 연결 허용" + } + }, + "mieru": { + "transport": { + "label": "전송 프로토콜", + "placeholder": "전송 프로토콜 선택" + }, + "multiplexing": { + "label": "다중화", + "placeholder": "다중화 수준 선택", + "MULTIPLEXING_OFF": "비활성화", + "MULTIPLEXING_LOW": "낮음", + "MULTIPLEXING_MIDDLE": "중간", + "MULTIPLEXING_HIGH": "높음" + } } } }, diff --git a/public/assets/admin/locales/zh-CN.js b/public/assets/admin/locales/zh-CN.js index 17ed15e..2213081 100644 --- a/public/assets/admin/locales/zh-CN.js +++ b/public/assets/admin/locales/zh-CN.js @@ -1739,6 +1739,83 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "empty": "未找到可用的ALPN协议" } } + }, + "socks": { + "version": { + "label": "协议版本", + "placeholder": "选择SOCKS版本" + }, + "tls": { + "label": "TLS", + "placeholder": "请选择安全性", + "disabled": "不支持", + "enabled": "支持" + }, + "tls_settings": { + "server_name": { + "label": "服务器名称指示(SNI)", + "placeholder": "不使用请留空" + }, + "allow_insecure": "允许不安全?" + }, + "network": { + "label": "传输协议", + "placeholder": "选择传输协议" + } + }, + "naive": { + "tls_settings": { + "server_name": { + "label": "服务器名称指示(SNI)", + "placeholder": "不使用请留空" + }, + "allow_insecure": "允许不安全?" + }, + "tls": { + "label": "TLS", + "placeholder": "请选择安全性", + "disabled": "不支持", + "enabled": "支持", + "server_name": { + "label": "服务器名称指示(SNI)", + "placeholder": "当节点地址与证书不一致时用于证书验证" + }, + "allow_insecure": "允许不安全连接" + } + }, + "http": { + "tls": { + "label": "TLS", + "placeholder": "请选择安全性", + "disabled": "不支持", + "enabled": "支持", + "server_name": { + "label": "服务器名称指示(SNI)", + "placeholder": "当节点地址与证书不一致时用于证书验证" + }, + "allow_insecure": "允许不安全连接" + }, + "tls_settings": { + "server_name": { + "label": "服务器名称指示(SNI)", + "placeholder": "当节点地址与证书不一致时用于证书验证" + }, + "allow_insecure": "允许不安全连接" + } + }, + "mieru": { + "transport": { + "label": "传输协议", + "placeholder": "选择传输协议" + }, + "multiplexing": { + "label": "多路复用", + "placeholder": "选择多路复用级别", + "MULTIPLEXING_OFF": "关闭", + "MULTIPLEXING_LOW": "低", + "MULTIPLEXING_MIDDLE": "中", + "MULTIPLEXING_HIGH": "高" + } } }, "network_settings": {