Files
OpenGFW/web/dist/assets/DashboardView-BD4i_GCA.js
T

27 lines
15 KiB
JavaScript
Raw Normal View History

import{c as A,d as H,o as c,a as r,F as w,r as M,b as l,n as q,e as C,u as e,f as W,t as n,g as b,h as X,w as u,_ as z,i as ee,j as S,k as v,l as s,m as Q,p as t,T as te,q as le,s as se,v as ae}from"./index-BKPz7Obh.js";import{c as y,t as oe,p as ne,d as ue}from"./format-B6sc_rZ4.js";import{A as ce,_ as de}from"./EventItem.vue_vue_type_script_setup_true_lang-JeqwaMaY.js";import{_ as re}from"./PageHeader.vue_vue_type_script_setup_true_lang-CPDhGTO6.js";import{_ as j,a as P,b as Z,c as T}from"./CardTitle.vue_vue_type_script_setup_true_lang-BHtPbA-o.js";import{_ as ie}from"./Skeleton.vue_vue_type_script_setup_true_lang-DG3HTLWx.js";import{_ as me,a as pe,b as G}from"./TabsTrigger.vue_vue_type_script_setup_true_lang-_qQ6JBVg.js";import"./Badge.vue_vue_type_script_setup_true_lang-i2F91fYk.js";import"./Collection-BaXBMWO5.js";/**
2026-07-27 08:09:11 +08:00
* @license lucide-vue-next v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fe=A("BanIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
* @license lucide-vue-next v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _e=A("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-vue-next v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const he=A("CpuIcon",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
* @license lucide-vue-next v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ve=A("ShieldCheckIcon",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-vue-next v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const J=A("WavesIcon",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]),be={key:0,class:"flex flex-col gap-1"},xe={class:"relative truncate font-mono text-xs sm:text-[13px]"},ke={class:"text-muted-foreground relative shrink-0 text-xs tabular-nums"},ye={key:1,class:"text-muted-foreground py-6 text-center text-xs"},N=H({__name:"BarList",props:{items:{},tone:{default:"primary"},empty:{}},setup(B){const f=B,a=b(()=>Math.max(1,...f.items.map(x=>x.count))),h={primary:"bg-primary/15",block:"bg-block/15",allow:"bg-allow/15"};return(x,I)=>f.items.length?(c(),r("div",be,[(c(!0),r(w,null,M(f.items,k=>(c(),r("div",{key:k.name,class:"relative flex items-center justify-between gap-3 overflow-hidden rounded-md px-2 py-1.5"},[l("div",{class:C(e(W)("absolute inset-y-0 left-0 rounded-md",h[f.tone])),style:q({width:`${Math.max(4,k.count/a.value*100)}%`})},null,6),l("span",xe,n(k.name),1),l("span",ke,n(e(y)(k.count)),1)]))),128))])):(c(),r("p",ye,n(f.empty??"—"),1))}}),ge={class:"flex items-start justify-between gap-2"},$e={class:"text-muted-foreground text-xs font-medium sm:text-sm"},we={class:"mt-1.5 flex items-baseline gap-1.5"},Me={key:0,class:"text-muted-foreground truncate text-xs"},V=H({__name:"StatCard",props:{label:{},value:{},hint:{},icon:{},tone:{}},setup(B){const f=B,a={default:"text-muted-foreground",allow:"text-allow",block:"text-block",drop:"text-drop",modify:"text-modify"};return(h,x)=>(c(),X(e(z),{class:"p-3.5 sm:p-4"},{default:u(()=>[l("div",ge,[l("span",$e,n(f.label),1),f.icon?(c(),X(ee(f.icon),{key:0,class:C(e(W)("size-4 shrink-0",a[f.tone??"default"]))},null,8,["class"])):S("",!0)]),l("div",we,[l("span",{class:C(e(W)("text-xl font-semibold tracking-tight tabular-nums sm:text-2xl",f.tone&&f.tone!=="default"?a[f.tone]:""))},n(f.value),3),f.hint?(c(),r("span",Me,n(f.hint),1)):S("",!0)])]),_:1}))}}),Ce=["viewBox"],ze=["y1","y2"],Be=["d"],je=["d"],Pe=["d"],Te=["x1","x2","y2"],Ve={class:"text-muted-foreground pointer-events-none absolute top-0 left-0 text-[10px] tabular-nums"},De={class:"text-muted-foreground mb-0.5"},Le={class:"flex items-center gap-2 tabular-nums"},Se={class:"ml-auto font-medium"},Ae={class:"flex items-center gap-2 tabular-nums"},Ie={class:"ml-auto font-medium"},Fe={class:"flex items-center gap-2 tabular-nums"},Re={class:"ml-auto font-medium"},qe={key:1,class:"text-muted-foreground absolute inset-0 flex items-center justify-center text-xs"},He={class:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-1"},Ne={class:"text-muted-foreground"},Oe={class:"font-medium tabular-nums"},R=600,K=160,O=8,We=16,Xe=H({__name:"TrafficChart",props:{buckets:{}},setup(B){const f=B,a=Q(null),h=b(()=>f.buckets??[]),x=b(()=>Math.max(1,...h.value.map(d=>d.tcp+d.udp))),I=b(()=>h.value.some(d=>d.tcp+d.udp+d.blocked>0));function k(d){const m=h.value.length;return m<=1?0:d/(m-1)*R}function g(d){const m=K-O-We;return O+m-d/x.value*m}function D(d){if(d.length===0)return"";const m=d.map((L,U)=>`${U===0?"M":"L"}${k(U).toFixed(1)},${g(L).toFixed(1)}`),_=`L${R},${g(0)} L0,${g(0)} Z`;return m.join(" ")+" "+_}function F(d){return d.map((m,_)=>`${_===0?"M":"L"}${k(_).toFixed(1)},${g(m).toFixed(1)}`).join(" ")}const i=b(()=>D(h.value.map(d=>d.tcp+d.udp))),p=b(()=>D(h.value.map(d=>d.tcp))),o=b(()=>F(h.value.map(d=>d.blocked))),$=b(()=>a.value===null?null:h.value[a.value]);function E(d){const m=d.currentTarget.getBoundingClientRect(),_=(d.clientX-m.left)/m.width,L=Math.round(_*(h.value.length-1));a.value=Math.min(h.value.length-1,Math.max(0,L))}const Y=b(()=>{const d=m=>h.value.reduce((_,L)=>_+L[m],0);return[{label:s("dashboard.tcp"),color:"bg-tcp",value:d("tcp")},{label:s("dashboard.udp"),color:"bg-udp",value:d("udp")},{label:s("dashboard.blocked"),color:"bg-block",value:d("blocked")}]});return(d,m)=>(c(),r("div",null,[l("div",{class:"relative to